From 7d62aa90548a9072c76374ac65ccc21f2e2fc39b Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Thu, 6 Jul 2023 14:49:13 +0200 Subject: [PATCH] Apply Developer tools --- composer.json | 2 +- .../Components/Products/Form/Edit.php | 3 +- .../Components/Products/Form/Variants.php | 3 +- .../Livewire/Components/Products/Variant.php | 5 +- .../Livewire/Pages/Auth/ForgotPassword.php | 2 +- .../core/src/Repositories/BaseRepository.php | 2 +- .../sidebar/src/Contracts/Builder/Badge.php | 2 +- phpstan-baseline.neon | 107 ++++-------------- 8 files changed, 29 insertions(+), 97 deletions(-) diff --git a/composer.json b/composer.json index 4784c4dae..a65936081 100644 --- a/composer.json +++ b/composer.json @@ -82,7 +82,7 @@ "baseline": "./vendor/bin/phpstan analyse --generate-baseline", "pint": "./vendor/bin/pint", "pest": "./vendor/bin/pest", - "phpstan": "./vendor/bin/phpstan analyse" + "stan": "./vendor/bin/phpstan analyse" }, "config": { "sort-packages": true, diff --git a/packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php b/packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php index 3625f58c3..79292db14 100644 --- a/packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php +++ b/packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php @@ -6,7 +6,6 @@ use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; -use Illuminate\Database\Eloquent\Model; use Livewire\WithFileUploads; use Shopper\Core\Events\Products\Updated; use Shopper\Core\Exceptions\GeneralException; @@ -27,7 +26,7 @@ class Edit extends AbstractBaseComponent use WithUploadProcess; use WithSeoAttributes; - public Model $product; + public $product; public int $productId; diff --git a/packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php b/packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php index c0a94b62e..defa4a695 100644 --- a/packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php +++ b/packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php @@ -7,7 +7,6 @@ use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Model; use Livewire\Component; use Livewire\WithFileUploads; use Livewire\WithPagination; @@ -25,7 +24,7 @@ class Variants extends Component public string $search = ''; - public Model $product; + public $product; public $quantity; diff --git a/packages/admin/src/Http/Livewire/Components/Products/Variant.php b/packages/admin/src/Http/Livewire/Components/Products/Variant.php index 3fb2b2886..0ca8db22e 100644 --- a/packages/admin/src/Http/Livewire/Components/Products/Variant.php +++ b/packages/admin/src/Http/Livewire/Components/Products/Variant.php @@ -7,7 +7,6 @@ use Filament\Notifications\Notification; use Illuminate\Contracts\View\View; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\Model; use Illuminate\Validation\Rule; use Livewire\Component; use Livewire\WithFileUploads; @@ -21,9 +20,9 @@ class Variant extends Component use WithUploadProcess; use WithAttributes; - public Model $product; + public $product; - public Model $variant; + public $variant; public Collection $inventories; diff --git a/packages/admin/src/Http/Livewire/Pages/Auth/ForgotPassword.php b/packages/admin/src/Http/Livewire/Pages/Auth/ForgotPassword.php index b5fd3188e..18bb655ae 100644 --- a/packages/admin/src/Http/Livewire/Pages/Auth/ForgotPassword.php +++ b/packages/admin/src/Http/Livewire/Pages/Auth/ForgotPassword.php @@ -4,7 +4,7 @@ namespace Shopper\Http\Livewire\Pages\Auth; -use Illuminate\Contracts\Auth\PasswordBroker; +use Illuminate\Auth\Passwords\PasswordBroker; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Password; use Livewire\Component; diff --git a/packages/core/src/Repositories/BaseRepository.php b/packages/core/src/Repositories/BaseRepository.php index c38126f2d..23e676d34 100755 --- a/packages/core/src/Repositories/BaseRepository.php +++ b/packages/core/src/Repositories/BaseRepository.php @@ -138,7 +138,7 @@ public function get(array $columns = ['*']): Collection return $models; } - public function getById($id, array $columns = ['*']): Collection|Model + public function getById($id, array $columns = ['*']): Model { $this->unsetClauses(); diff --git a/packages/sidebar/src/Contracts/Builder/Badge.php b/packages/sidebar/src/Contracts/Builder/Badge.php index 09f55672f..5aac419b0 100644 --- a/packages/sidebar/src/Contracts/Builder/Badge.php +++ b/packages/sidebar/src/Contracts/Builder/Badge.php @@ -4,7 +4,7 @@ namespace Shopper\Sidebar\Contracts\Builder; -interface Badge +interface Badge extends Authorizable { public function getValue(): mixed; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f5c56f1c6..99e7147c1 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -475,36 +475,11 @@ parameters: count: 2 path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:addMedia\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:categories\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:collections\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getMedia\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:scopes\\(\\)\\.$#" count: 2 path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - - message: "#^Parameter \\#1 \\$product of class Shopper\\\\Core\\\\Events\\\\Products\\\\Updated constructor expects Shopper\\\\Core\\\\Models\\\\Product, Illuminate\\\\Database\\\\Eloquent\\\\Model given\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Edit.php - - message: "#^Ternary operator condition is always false\\.$#" count: 2 @@ -555,46 +530,11 @@ parameters: count: 2 path: packages/admin/src/Http/Livewire/Components/Products/Form/Seo.php - - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$id\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:where\\(\\)\\.$#" count: 1 path: packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php - - - message: "#^Parameter \\#1 \\$product of class Shopper\\\\Core\\\\Events\\\\Products\\\\Deleted constructor expects Shopper\\\\Core\\\\Models\\\\Product, Illuminate\\\\Database\\\\Eloquent\\\\Collection\\|Illuminate\\\\Database\\\\Eloquent\\\\Model given\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Form/Variants.php - - - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$id\\.$#" - count: 3 - path: packages/admin/src/Http/Livewire/Components/Products/Variant.php - - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:addMedia\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Variant.php - - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getFirstMedia\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Variant.php - - - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getMedia\\(\\)\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Variant.php - - - - message: "#^Parameter \\#1 \\$product of class Shopper\\\\Core\\\\Events\\\\Products\\\\Updated constructor expects Shopper\\\\Core\\\\Models\\\\Product, Illuminate\\\\Database\\\\Eloquent\\\\Model given\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Components/Products/Variant.php - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$id\\.$#" count: 3 @@ -920,11 +860,6 @@ parameters: count: 1 path: packages/admin/src/Http/Livewire/Modals/CreateValue.php - - - message: "#^Parameter \\#1 \\$product of class Shopper\\\\Core\\\\Events\\\\Products\\\\Deleted constructor expects Shopper\\\\Core\\\\Models\\\\Product, Illuminate\\\\Database\\\\Eloquent\\\\Collection\\|Illuminate\\\\Database\\\\Eloquent\\\\Model given\\.$#" - count: 1 - path: packages/admin/src/Http/Livewire/Modals/DeleteProduct.php - - message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:whereHas\\(\\)\\.$#" count: 1 @@ -970,11 +905,6 @@ parameters: count: 1 path: packages/admin/src/Http/Livewire/Modals/UpdateValue.php - - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Collection\\|Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$stock\\.$#" - count: 2 - path: packages/admin/src/Http/Livewire/Modals/UpdateVariantStock.php - - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$id\\.$#" count: 3 @@ -982,7 +912,7 @@ parameters: - message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$stock\\.$#" - count: 1 + count: 3 path: packages/admin/src/Http/Livewire/Modals/UpdateVariantStock.php - @@ -1175,21 +1105,6 @@ parameters: count: 1 path: packages/core/database/seeders/AuthTableSeeder.php - - - message: "#^Constructor of class Shopper\\\\Core\\\\Events\\\\Products\\\\Created has an unused parameter \\$product\\.$#" - count: 1 - path: packages/core/src/Events/Products/Created.php - - - - message: "#^Constructor of class Shopper\\\\Core\\\\Events\\\\Products\\\\Deleted has an unused parameter \\$product\\.$#" - count: 1 - path: packages/core/src/Events/Products/Deleted.php - - - - message: "#^Constructor of class Shopper\\\\Core\\\\Events\\\\Products\\\\Updated has an unused parameter \\$product\\.$#" - count: 1 - path: packages/core/src/Events/Products/Updated.php - - message: "#^Access to an undefined property Shopper\\\\Core\\\\Models\\\\Address\\:\\:\\$first_name\\.$#" count: 2 @@ -1774,3 +1689,23 @@ parameters: message: "#^Cannot access property \\$code on array\\\\|Illuminate\\\\Database\\\\Eloquent\\\\Builder\\|Illuminate\\\\Database\\\\Eloquent\\\\Collection\\|Illuminate\\\\Database\\\\Eloquent\\\\Model\\.$#" count: 1 path: packages/core/src/helpers.php + + - + message: "#^Method Shopper\\\\Sidebar\\\\Presentation\\\\View\\\\AppendRenderer\\:\\:render\\(\\) should return Illuminate\\\\Contracts\\\\View\\\\View\\|null but returns string\\.$#" + count: 1 + path: packages/sidebar/src/Presentation/View/AppendRenderer.php + + - + message: "#^Method Shopper\\\\Sidebar\\\\Presentation\\\\View\\\\BadgeRenderer\\:\\:render\\(\\) should return Illuminate\\\\Contracts\\\\View\\\\View\\|null but returns string\\.$#" + count: 1 + path: packages/sidebar/src/Presentation/View/BadgeRenderer.php + + - + message: "#^Method Shopper\\\\Sidebar\\\\Presentation\\\\View\\\\GroupRenderer\\:\\:render\\(\\) should return Illuminate\\\\Contracts\\\\View\\\\View\\|null but returns string\\.$#" + count: 1 + path: packages/sidebar/src/Presentation/View/GroupRenderer.php + + - + message: "#^Method Shopper\\\\Sidebar\\\\Presentation\\\\View\\\\ItemRenderer\\:\\:render\\(\\) should return Illuminate\\\\Contracts\\\\View\\\\View\\|null but returns string\\.$#" + count: 1 + path: packages/sidebar/src/Presentation/View/ItemRenderer.php