Skip to content

Add PHPStan #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ before_install:

install: composer update --prefer-source --no-interaction --dev

script: vendor/bin/phpunit --testdox
script: composer test
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"orchestra/testbench": "^7.0",
"mockery/mockery": "^1.0.0"
"mockery/mockery": "^1.0.0",
"phpstan/phpstan": "^1.9"
},
"license": "MIT",
"authors": [
Expand All @@ -42,7 +43,12 @@
]
},
"scripts": {
"test": "phpunit"
"test:unit": "phpunit",
"test:analyse": "vendor/bin/phpstan analyse src --memory-limit=2G --ansi",
"test": [
"@test:analyse",
"@test:unit"
]
},
"extra": {
"laravel": {
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/ConversationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Musonza\Chat\Http\Controllers;

use Chat;
use Exception;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Response;
use Musonza\Chat\Exceptions\DeletingConversationWithParticipantsException;
use Musonza\Chat\Facades\ChatFacade as Chat;
use Musonza\Chat\Http\Requests\DestroyConversation;
use Musonza\Chat\Http\Requests\StoreConversation;
use Musonza\Chat\Http\Requests\UpdateConversation;
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/ConversationMessageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Musonza\Chat\Http\Controllers;

use Chat;
use Musonza\Chat\Facades\ChatFacade as Chat;
use Musonza\Chat\Http\Requests\ClearConversation;
use Musonza\Chat\Http\Requests\DeleteMessage;
use Musonza\Chat\Http\Requests\GetParticipantMessages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Musonza\Chat\Http\Controllers;

use Chat;
use Musonza\Chat\Facades\ChatFacade as Chat;
use Musonza\Chat\Http\Requests\StoreParticipation;
use Musonza\Chat\Http\Requests\UpdateParticipation;
use Musonza\Chat\Models\Conversation;
Expand Down
2 changes: 2 additions & 0 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Illuminate\Support\Facades\Route;

$chatRoutesPrefix = config('musonza_chat.routes.path_prefix');
$middleware = config('musonza_chat.routes.middleware');

Expand Down
2 changes: 1 addition & 1 deletion src/Messages/SendMessageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SendMessageCommand
* @param Model $sender The sender identifier
* @param string $type The message type
*/
public function __construct(Conversation $conversation, $body, Model $sender, $type = 'text', $data)
public function __construct(Conversation $conversation, $body, Model $sender, string $type = 'text', array $data = [])
{
$this->conversation = $conversation;
$this->body = $body;
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Musonza\Chat\Models;

use Chat;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
Expand All @@ -17,6 +16,7 @@
use Musonza\Chat\Exceptions\DeletingConversationWithParticipantsException;
use Musonza\Chat\Exceptions\DirectMessagingExistsException;
use Musonza\Chat\Exceptions\InvalidDirectMessageNumberOfParticipants;
use Musonza\Chat\Facades\ChatFacade as Chat;

class Conversation extends BaseModel
{
Expand Down
2 changes: 2 additions & 0 deletions src/Notifications/MessageSent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class MessageSent extends Notification
{
use Queueable;

private $data;

/**
* Create a new notification instance.
*
Expand Down