Skip to content

Commit

Permalink
ci: fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 29, 2024
1 parent 15ca1e3 commit 5ef9399
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 17 deletions.
18 changes: 15 additions & 3 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
"license": "MIT",
"type": "project",
"keywords": [
"framework",
"laravel"
"php",
"laravel",
"boilerplate",
"laravel-boilerplate",
"starter-template",
"laravel-package",
"starter-kit",
"laravel-application",
"starter-project",
"laravel-starter-template",
"laravel-starter-kit",
"laravel-api",
"laravel-ddd",
"ddd"
],
"require": {
"php": "^8.2",
Expand All @@ -17,7 +29,7 @@
"league/fractal": "^0.20.1",
"sentry/sentry-laravel": "^4.5",
"spatie/laravel-fractal": "^6.2",
"spatie/laravel-query-builder": "^5.8",
"spatie/laravel-query-builder": "^6.0",
"spatie/laravel-route-attributes": "^1.22",
"wayofdev/laravel-open-docs": "^2.1"
},
Expand Down
17 changes: 9 additions & 8 deletions app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/src/Bridge/Laravel/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class Application extends LaravelApplication

public function path($path = ''): string
{
return $this->basePath . DIRECTORY_SEPARATOR . 'src/Bridge/Laravel' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
return $this->basePath . DIRECTORY_SEPARATOR . 'src/Bridge/Laravel' . ($path !== '' ? DIRECTORY_SEPARATOR . $path : $path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final class RedirectIfAuthenticated
*/
public function handle(Request $request, Closure $next, string ...$guards): Response
{
// @phpstan-ignore-next-line
$guards = empty($guards) ? [null] : $guards;

foreach ($guards as $guard) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/Bridge/Laravel/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class EventServiceProvider extends ServiceProvider
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
* @var array<string, array<int, string>>
*/
protected $listen = [
Registered::class => [
Expand Down
2 changes: 1 addition & 1 deletion app/src/Bridge/Laravel/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class RouteServiceProvider extends ServiceProvider
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
return Limit::perMinute(60)->by($request->user()?->id ?? $request->ip());

Check warning on line 30 in app/src/Bridge/Laravel/Providers/RouteServiceProvider.php

View check run for this annotation

Codecov / codecov/patch

app/src/Bridge/Laravel/Providers/RouteServiceProvider.php#L30

Added line #L30 was not covered by tests
});

$this->routes(function (): void {
Expand Down
6 changes: 3 additions & 3 deletions app/src/Support/Filters/FuzzyFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public function __construct(string ...$fields)
$this->fields = $fields;
}

public function __invoke(Builder $query, $value, string $property): Builder
public function __invoke(Builder $query, mixed $value, string $property): Builder

Check warning on line 22 in app/src/Support/Filters/FuzzyFilter.php

View check run for this annotation

Codecov / codecov/patch

app/src/Support/Filters/FuzzyFilter.php#L22

Added line #L22 was not covered by tests
{
$query->where(function (Builder $query) use ($value): void {
foreach ($this->fields as $field) {
$values = (array) $value;

foreach ($values as $value) {
$query->orWhere($field, 'LIKE', "%{$value}%");
foreach ($values as $item) {
$query->orWhere($field, 'LIKE', "%{$item}%");

Check warning on line 29 in app/src/Support/Filters/FuzzyFilter.php

View check run for this annotation

Codecov / codecov/patch

app/src/Support/Filters/FuzzyFilter.php#L28-L29

Added lines #L28 - L29 were not covered by tests
}
}
});
Expand Down

0 comments on commit 5ef9399

Please sign in to comment.