forked from eatvio/eatvio-infra
make static-analyse code
This commit is contained in:
@@ -6,24 +6,26 @@ use App\Events\ChatMessageUpdated;
|
||||
use App\Models\Chat;
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class MessageWindow extends Component
|
||||
{
|
||||
public $messages = [];
|
||||
public array|Collection $messages = [];
|
||||
|
||||
public $curMessage = '';
|
||||
public string $curMessage = '';
|
||||
|
||||
public $curUserId;
|
||||
public int $curUserId;
|
||||
|
||||
public $recipientUserId;
|
||||
public int|null $recipientUserId = null;
|
||||
|
||||
public $recipientUser;
|
||||
public User|null $recipientUser = null;
|
||||
|
||||
public $chanId;
|
||||
public string $chanId;
|
||||
|
||||
public $curUser;
|
||||
public User $curUser;
|
||||
|
||||
public function getListeners()
|
||||
public function getListeners(): array
|
||||
{
|
||||
return [
|
||||
'echo-private:direct-chat.'.$this->chanId.',ChatMessageUpdated' => 'notifyNewMessage',
|
||||
@@ -33,7 +35,7 @@ class MessageWindow extends Component
|
||||
];
|
||||
}
|
||||
|
||||
public function notifyNewMessage($e): void
|
||||
public function notifyNewMessage(array $e): void
|
||||
{
|
||||
$message = $e['message'];
|
||||
|
||||
@@ -41,11 +43,11 @@ class MessageWindow extends Component
|
||||
->prepend($message);
|
||||
}
|
||||
|
||||
public function updateRecipientId($id = null)
|
||||
public function updateRecipientId(int $id = null): void
|
||||
{
|
||||
}
|
||||
|
||||
public function whisperTypeing()
|
||||
public function whisperTypeing(): void
|
||||
{
|
||||
$this->dispatch(
|
||||
'typing',
|
||||
@@ -58,7 +60,7 @@ class MessageWindow extends Component
|
||||
}
|
||||
|
||||
// FIXME
|
||||
public function mount($recipientUserId)
|
||||
public function mount(int $recipientUserId = null): void
|
||||
{
|
||||
$this->recipientUserId = $recipientUserId;
|
||||
$this->recipientUser = User::find($recipientUserId);
|
||||
@@ -74,12 +76,12 @@ class MessageWindow extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View
|
||||
{
|
||||
return view('livewire.chat.message-window');
|
||||
}
|
||||
|
||||
public function sendChatMessage()
|
||||
public function sendChatMessage(): void
|
||||
{
|
||||
$chatMessage = [
|
||||
'data' => $this->curMessage,
|
||||
|
||||
Reference in New Issue
Block a user