Skip to content

Commit e983188

Browse files
committed
Phpstan fixes
1 parent 98fabea commit e983188

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

phpstan-baseline.neon

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ parameters:
1010
count: 1
1111
path: src/AbstractWizard.php
1212

13-
-
14-
message: "#^Method Arcanist\\\\AbstractWizard\\:\\:summary\\(\\) should return array\\{id\\: int\\|string, slug\\: string, title\\: string, steps\\: array\\<int, array\\{slug\\: string, isComplete\\: bool, title\\: string, active\\: bool, url\\: string\\|null\\}\\>\\} but returns array\\{id\\: int\\|string\\|null, slug\\: string, title\\: string, steps\\: array\\<int, array\\{slug\\: string, isComplete\\: bool, title\\: string, active\\: bool, url\\: string\\|null\\}\\>\\}\\.$#"
15-
count: 1
16-
path: src/AbstractWizard.php
17-
1813
-
1914
message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\Collection\\<int,mixed\\>\\:\\:filter\\(\\) expects \\(callable\\(mixed, int\\)\\: bool\\)\\|null, Closure\\(Arcanist\\\\WizardStep\\)\\: bool given\\.$#"
2015
count: 1
@@ -56,9 +51,14 @@ parameters:
5651
path: src/AbstractWizard.php
5752

5853
-
59-
message: "#^Property Arcanist\\\\AbstractWizard\\:\\:\\$id \\(int\\|string\\|null\\) does not accept mixed\\.$#"
54+
message: "#^Cannot access offset 'config' on Illuminate\\\\Contracts\\\\Foundation\\\\Application\\.$#"
6055
count: 1
61-
path: src/AbstractWizard.php
56+
path: src/ArcanistServiceProvider.php
57+
58+
-
59+
message: "#^Cannot access offset 'events' on Illuminate\\\\Contracts\\\\Foundation\\\\Application\\.$#"
60+
count: 1
61+
path: src/ArcanistServiceProvider.php
6262

6363
-
6464
message: "#^Parameter \\#1 \\$implementation of method Illuminate\\\\Contracts\\\\Container\\\\ContextualBindingBuilder\\:\\:give\\(\\) expects array\\|Closure\\|string, mixed given\\.$#"
@@ -76,6 +76,6 @@ parameters:
7676
path: src/ArcanistServiceProvider.php
7777

7878
-
79-
message: "#^Cannot access offset '\\:\\:step\\-with…' on mixed\\.$#"
80-
count: 2
81-
path: tests/InvalidateDependentFieldsTest.php
79+
message: "#^Parameter \\#1 \\$id of method Arcanist\\\\AbstractWizard\\:\\:setId\\(\\) expects int\\|string\\|null, Ramsey\\\\Uuid\\\\UuidInterface given\\.$#"
80+
count: 1
81+
path: src/Repository/CacheWizardRepository.php

phpstan.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ parameters:
77

88
paths:
99
- src
10-
- tests
1110

1211
level: 9
1312

14-
ignoreErrors:
15-
- '/Parameter #1 \$response of class Illuminate\\Testing\\TestResponse constructor expects*/'
16-
- /Cannot access offset '\w+' on Illuminate\\Contracts\\Foundation\\Application/
17-
1813
excludePaths:
1914
- tests/__snapshots__/*
2015

src/AbstractWizard.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ public function getId(): mixed
148148
return $this->id;
149149
}
150150

151+
/**
152+
* @param int|string|null $id
153+
*/
151154
public function setId(mixed $id): void
152155
{
153156
$this->id = $id;
@@ -311,7 +314,7 @@ public function exists(): bool
311314
* Returns a summary about the current wizard and its steps.
312315
*
313316
* @return array{
314-
* id: string|int,
317+
* id: string|int|null,
315318
* slug: string,
316319
* title: string,
317320
* steps: array<int, SummaryStep>,

src/Repository/Wizard.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,27 @@
1313

1414
namespace Arcanist\Repository;
1515

16+
use Arcanist\AbstractWizard;
1617
use Illuminate\Database\Eloquent\Factories\HasFactory;
1718
use Illuminate\Database\Eloquent\Model;
1819

1920
/**
20-
* @property string $class
21-
* @property array $data
21+
* @property string|class-string<AbstractWizard> $class
22+
* @property array<string, mixed> $data
2223
* @property int $id
2324
*/
2425
class Wizard extends Model
2526
{
2627
use HasFactory;
28+
29+
/**
30+
* @var array<int, string>
31+
*/
2732
protected $guarded = [];
33+
34+
/**
35+
* @var array<string, string>
36+
*/
2837
protected $casts = [
2938
'data' => 'array',
3039
];

0 commit comments

Comments
 (0)