Skip to content

Commit

Permalink
chore: fix as many phpstan errors, put rest in baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroverts committed Feb 25, 2025
1 parent 6a34967 commit d00b37f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function index(): View
public function create(): View
{
$airportLink = new AirportLink();
$airportLinkTypes = AirportLinkType::all(['id', 'name'])->pluck('name', 'id');
$airportLinkTypes = AirportLinkType::pluck('name', 'id');
$airports = Airport::all(['id', 'icao', 'iata', 'name'])->keyBy('id')
->map(function ($airport) {
/** @var Airport $airport */
Expand All @@ -52,7 +52,7 @@ public function store(StoreAirportLink $request): RedirectResponse

public function edit(AirportLink $airportLink): View
{
$airportLinkTypes = AirportLinkType::all(['id', 'name'])->pluck('name', 'id');
$airportLinkTypes = AirportLinkType::pluck('name', 'id');

return view('airportLink.admin.form', compact('airportLink', 'airportLinkTypes'));
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Event/EventAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function create(): View
/** @var Airport $airport */
return "$airport->icao | $airport->name | $airport->iata";
});
$eventTypes = EventType::all()->pluck('name', 'id');
$eventTypes = EventType::pluck('name', 'id');
return view('event.admin.form', compact('event', 'airports', 'eventTypes'));
}

Expand Down Expand Up @@ -87,7 +87,7 @@ public function edit(Event $event): View
/** @var Airport $airport */
return "$airport->icao | $airport->name | $airport->iata";
});
$eventTypes = EventType::all()->pluck('name', 'id');
$eventTypes = EventType::pluck('name', 'id');
return view('event.admin.form', compact('event', 'airports', 'eventTypes'));
}

Expand Down
7 changes: 4 additions & 3 deletions app/Http/Controllers/EventLink/EventLinkAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public function index(): View
return view('eventLink.admin.overview', compact('eventLinks'));
}

public function create(Event $event): View
public function create(): View
{
$eventLink = new EventLink();
$eventLinkTypes = AirportLinkType::all(['id', 'name'])->pluck('name', 'id');
$eventLinkTypes = AirportLinkType::pluck('name', 'id');
$events = Event::where('endEvent', '>', now())
->orderBy('startEvent')
->get(['id', 'name', 'startEvent'])
Expand All @@ -39,6 +39,7 @@ public function create(Event $event): View
/** @var Event $event */
return "$event->name [{$event->startEvent->format('d-m-Y')}]";
});

return view('eventLink.admin.form', compact('eventLink', 'eventLinkTypes', 'events'));
}

Expand All @@ -55,7 +56,7 @@ public function store(StoreEventLink $request): RedirectResponse

public function edit(EventLink $eventLink): View
{
$eventLinkTypes = AirportLinkType::all(['id', 'name'])->pluck('name', 'id');
$eventLinkTypes = AirportLinkType::pluck('name', 'id');
return view('eventLink.admin.form', compact('eventLink', 'eventLinkTypes'));
}

Expand Down
2 changes: 1 addition & 1 deletion app/View/Components/Forms/Inputs/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Input extends OriginalInput
{
public function __construct(string $name, string $id = null, string $type = 'text', ?string $value = '')
public function __construct(string $name, ?string $id = null, string $type = 'text', ?string $value = '')
{
$this->name = $name;
$this->id = $id ?? $name;
Expand Down
20 changes: 0 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Variable \\$events might not be defined\\.$#"
count: 1
path: app/Http/Controllers/EventLink/EventLinkAdminController.php

-
message: "#^Parameter \\#1 \\$key of function old expects string\\|null, false given\\.$#"
count: 4
path: app/Http/Controllers/Faq/FaqAdminController.php

-
message: "#^Strict comparison using \\=\\=\\= between 'is_online' and 0 will always evaluate to false\\.$#"
count: 2
path: app/Http/Controllers/Faq/FaqAdminController.php

-
message: "#^Strict comparison using \\=\\=\\= between 'is_online' and 1 will always evaluate to false\\.$#"
count: 2
path: app/Http/Controllers/Faq/FaqAdminController.php

-
message: "#^Method App\\\\Http\\\\Controllers\\\\OAuthController\\:\\:updateToken\\(\\) should return League\\\\OAuth2\\\\Client\\\\Token\\\\AccessToken\\|null but returns League\\\\OAuth2\\\\Client\\\\Token\\\\AccessTokenInterface\\.$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions resources/views/faq/admin/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

<x-forms.form-group name="is_online" :label="__('Is online')" inline>

<x-forms.radio inline name="is_online" value="0" :label="__('No')" required :should-be-checked="old('is_online' === 0, !$faq->is_online )" />
<x-forms.radio inline name="is_online" value="1" :label="__('Yes')" required :should-be-checked="old('is_online' === 1, $faq->is_online )" />
<x-forms.radio inline name="is_online" value="0" :label="__('No')" required :should-be-checked="old('is_online' === false, !$faq->is_online )" />
<x-forms.radio inline name="is_online" value="1" :label="__('Yes')" required :should-be-checked="old('is_online' === true, $faq->is_online )" />

</x-forms.form-group>

Expand Down

0 comments on commit d00b37f

Please sign in to comment.