Skip to content

Commit ebc0cae

Browse files
authored
Merge pull request #18 from joelbladt/feature-increase-PHPStan-level-to-max
Increase PHPStan level to max and fix related issues
2 parents ae37061 + cff805e commit ebc0cae

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

app/Http/Requests/StoreBookRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public function rules(): array
8181
'string',
8282
'filled',
8383
Rule::unique('books')
84-
->where(function ($query) {
85-
return $query->where('isbn', $this->isbn);
84+
->where(function (\Illuminate\Database\Query\Builder $query) {
85+
$query->where('isbn', $this->isbn);
8686
}),
8787
],
8888
'publisher_id' => 'integer|nullable',

app/Http/Requests/StorePublisherRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ public function rules(): array
8888
'min:3',
8989
'max:255',
9090
Rule::unique('publishers')
91-
->where(function ($query) {
92-
return $query->where('email', $this->email)
93-
&& $query->where('website', $this->website);
91+
->where(function (\Illuminate\Database\Query\Builder $query) {
92+
$query
93+
->where('email', $this->email)
94+
->where('website', $this->website);
9495
}),
9596
],
9697
'email' => 'required|string|email|filled',

app/Http/Requests/UpdateBookRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public function rules(): array
8282
'filled',
8383
Rule::unique('books')
8484
->ignore($this->books)
85-
->where(function ($query) {
86-
return $query->where('isbn', $this->isbn);
85+
->where(function (\Illuminate\Database\Query\Builder $query) {
86+
$query->where('isbn', $this->isbn);
8787
}),
8888
],
8989
'publisher_id' => 'integer|nullable',

app/Http/Requests/UpdatePublisherRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ public function rules(): array
8888
'max:255',
8989
Rule::unique('publishers')
9090
->ignore($this->publisher)
91-
->where(function ($query) {
92-
return $query->where('email', $this->email)
93-
&& $query->where('website', $this->website);
91+
->where(function (\Illuminate\Database\Query\Builder $query) {
92+
$query
93+
->where('email', $this->email)
94+
->where('website', $this->website);
9495
}),
9596
],
9697
'email' => 'sometimes|required|string|email|filled',

app/Providers/AppServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Repositories\PublisherRepository;
99
use App\Services\BookService;
1010
use App\Services\PublisherService;
11+
use Illuminate\Contracts\Foundation\Application;
1112
use Illuminate\Support\ServiceProvider;
1213

1314
class AppServiceProvider extends ServiceProvider
@@ -18,15 +19,15 @@ class AppServiceProvider extends ServiceProvider
1819
public function register(): void
1920
{
2021
$this->app->bind(BookRepositoryInterface::class, BookRepository::class);
21-
$this->app->bind(BookService::class, function ($app) {
22+
$this->app->bind(BookService::class, function (Application $app) {
2223
return new BookService(
2324
$app->make(BookRepositoryInterface::class),
2425
$app->make(PublisherRepositoryInterface::class),
2526
);
2627
});
2728

2829
$this->app->bind(PublisherRepositoryInterface::class, PublisherRepository::class);
29-
$this->app->bind(PublisherService::class, function ($app) {
30+
$this->app->bind(PublisherService::class, function (Application $app) {
3031
return new PublisherService($app->make(PublisherRepositoryInterface::class));
3132
});
3233
}

phpstan.neon.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ parameters:
55
paths:
66
- app/
77

8-
# Level 9 is the highest level
9-
level: 9
8+
# Level 9 is the highest numeric level
9+
level: max
1010

1111
# ignoreErrors:
1212
# - '#PHPDoc tag @var#'

0 commit comments

Comments
 (0)