Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Dec 5, 2023
1 parent 7453d4d commit 463e1b4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/CrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Models\Entity;
use App\Models\AttributeTemplate;
use App\Models\Bookmark;
use App\Models\Family;
use App\Models\MiscModel;
use App\Sanitizers\MiscSanitizer;
use App\Services\MultiEditingService;
Expand Down Expand Up @@ -156,6 +157,7 @@ public function crudIndex(Request $request)
// Do this to avoid an extra sql query when no filters are selected
if ($this->filterService->hasFilters()) {
$unfilteredCount = $base->count();
// @phpstan-ignore-next-line
$base = $base->filter($this->filterService->filters());

$models = $base->paginate();
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Front/HelperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers\Front;

use App\Models\Family;
use App\Models\MiscModel;
use Exception;
use Illuminate\Support\Str;
Expand Down Expand Up @@ -29,6 +30,7 @@ public function apiFilters()
if (!$misc instanceof MiscModel) {
abort(404);
}
// @phpstan-ignore-next-line
$filters = $misc->getFilterableColumns();

return view('helpers.api-filters', compact(
Expand Down
6 changes: 2 additions & 4 deletions app/Http/Requests/StoreAbilityEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ public function rules()
return [
'ability_id' => 'required|exists:entities,id',
'visibility_id' => 'required|exists:visibilities,id',
'entities' => 'required',
'entities' => [
'*' => 'different:ability_id|exists:entities,id',
],
'entities' => 'array|required',
'entities.*' => ['different:ability_id|exists:entities,id'],
];
}
}
3 changes: 2 additions & 1 deletion app/Models/CampaignDashboardWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function entities()
$entityType = $this->conf('entity');
if (!empty($entityType) && !empty($this->config['filters'])) {
$className = 'App\Models\\' . Str::studly($entityType);
/** @var MiscModel|Character $model */
/** @var Character|mixed $model */
$model = new $className();

/** @var FilterService $filterService */
Expand Down Expand Up @@ -320,6 +320,7 @@ public function randomEntity()
->model($model)
->make($entityType);

// @phpstan-ignore-next-line
$models = $model
->select($model->getTable() . '.id')
->filter($filterService->filters())
Expand Down
1 change: 1 addition & 0 deletions app/Services/Campaign/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ protected function smartWith(array $with, string $entityClass): array
{
/** @var MiscModel $class */
$class = app()->make($entityClass);
// @phpstan-ignore-next-line
foreach ($class->exportRelations() as $rel) {
$with[] = $rel;
}
Expand Down
1 change: 1 addition & 0 deletions app/Traits/TreeControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function tree(Request $request, Campaign $campaign)
// Do this to avoid an extra sql query when no filters are selected
if ($this->filterService->hasFilters()) {
$unfilteredCount = $base->count();
// @phpstan-ignore-next-line
$base = $base->filter($this->filterService->filters());

$models = $base->paginate();
Expand Down

0 comments on commit 463e1b4

Please sign in to comment.