@@ -41,7 +41,7 @@ protected function setUp(): void
4141 Factories::reset ();
4242 }
4343
44- protected function getFactoriesStaticProperty (...$ params ): mixed
44+ protected function getFactoriesStaticProperty (string ...$ params ): mixed
4545 {
4646 // First parameter is the actual property
4747 $ name = array_shift ($ params );
@@ -158,14 +158,14 @@ public function testGetsBasenameInvalid(): void
158158
159159 public function testCreatesByBasename (): void
160160 {
161- $ result = Factories::widgets ('SomeWidget ' , ['getShared ' => false ]);
161+ $ result = Factories::widgets ('SomeWidget ' , ['getShared ' => false ]); // @phpstan-ignore staticMethod.notFound
162162
163163 $ this ->assertInstanceOf (SomeWidget::class, $ result );
164164 }
165165
166166 public function testCreatesByClassname (): void
167167 {
168- $ result = Factories::widgets (SomeWidget::class, ['getShared ' => false ]);
168+ $ result = Factories::widgets (SomeWidget::class, ['getShared ' => false ]); // @phpstan-ignore staticMethod.notFound
169169
170170 $ this ->assertInstanceOf (SomeWidget::class, $ result );
171171 }
@@ -179,22 +179,22 @@ public function testCreatesByAbsoluteClassname(): void
179179
180180 public function testCreatesInvalid (): void
181181 {
182- $ result = Factories::widgets ('gfnusvjai ' , ['getShared ' => false ]);
182+ $ result = Factories::widgets ('gfnusvjai ' , ['getShared ' => false ]); // @phpstan-ignore staticMethod.notFound
183183
184184 $ this ->assertNull ($ result );
185185 }
186186
187187 public function testIgnoresNonClass (): void
188188 {
189- $ result = Factories::widgets ('NopeWidget ' , ['getShared ' => false ]);
189+ $ result = Factories::widgets ('NopeWidget ' , ['getShared ' => false ]); // @phpstan-ignore staticMethod.notFound
190190
191191 $ this ->assertNull ($ result );
192192 }
193193
194194 public function testReturnsSharedInstance (): void
195195 {
196- $ widget1 = Factories::widgets ('SomeWidget ' );
197- $ widget2 = Factories::widgets (SomeWidget::class);
196+ $ widget1 = Factories::widgets ('SomeWidget ' ); // @phpstan-ignore staticMethod.notFound
197+ $ widget2 = Factories::widgets (SomeWidget::class); // @phpstan-ignore staticMethod.notFound
198198
199199 $ this ->assertSame ($ widget1 , $ widget2 );
200200 }
@@ -203,7 +203,7 @@ public function testInjection(): void
203203 {
204204 Factories::injectMock ('widgets ' , 'Banana ' , new stdClass ());
205205
206- $ result = Factories::widgets ('Banana ' );
206+ $ result = Factories::widgets ('Banana ' ); // @phpstan-ignore staticMethod.notFound
207207
208208 $ this ->assertInstanceOf ('stdClass ' , $ result );
209209 }
@@ -212,7 +212,7 @@ public function testRespectsComponentAlias(): void
212212 {
213213 Factories::setOptions ('tedwigs ' , ['component ' => 'widgets ' ]);
214214
215- $ result = Factories::tedwigs ('SomeWidget ' );
215+ $ result = Factories::tedwigs ('SomeWidget ' ); // @phpstan-ignore staticMethod.notFound
216216 $ this ->assertInstanceOf (SomeWidget::class, $ result );
217217 }
218218
@@ -228,26 +228,26 @@ public function testRespectsInstanceOf(): void
228228 {
229229 Factories::setOptions ('widgets ' , ['instanceOf ' => 'stdClass ' ]);
230230
231- $ result = Factories::widgets ('SomeWidget ' );
231+ $ result = Factories::widgets ('SomeWidget ' ); // @phpstan-ignore staticMethod.notFound
232232 $ this ->assertInstanceOf (SomeWidget::class, $ result );
233233
234- $ result = Factories::widgets ('OtherWidget ' );
234+ $ result = Factories::widgets ('OtherWidget ' ); // @phpstan-ignore staticMethod.notFound
235235 $ this ->assertNull ($ result );
236236 }
237237
238238 public function testSharedRespectsInstanceOf (): void
239239 {
240240 Factories::injectMock ('widgets ' , 'SomeWidget ' , new OtherWidget ());
241241
242- $ result = Factories::widgets ('SomeWidget ' , ['instanceOf ' => 'stdClass ' ]);
242+ $ result = Factories::widgets ('SomeWidget ' , ['instanceOf ' => 'stdClass ' ]); // @phpstan-ignore staticMethod.notFound
243243 $ this ->assertInstanceOf (SomeWidget::class, $ result );
244244 }
245245
246246 public function testPrioritizesParameterOptions (): void
247247 {
248248 Factories::setOptions ('widgets ' , ['instanceOf ' => 'stdClass ' ]);
249249
250- $ result = Factories::widgets (OtherWidget::class, ['instanceOf ' => null ]);
250+ $ result = Factories::widgets (OtherWidget::class, ['instanceOf ' => null ]); // @phpstan-ignore staticMethod.notFound
251251 $ this ->assertInstanceOf (OtherWidget::class, $ result );
252252 }
253253
@@ -259,7 +259,7 @@ public function testFindsAppFirst(): void
259259 class_alias (SomeWidget::class, $ class );
260260 }
261261
262- $ result = Factories::widgets ('OtherWidget ' );
262+ $ result = Factories::widgets ('OtherWidget ' ); // @phpstan-ignore staticMethod.notFound
263263 $ this ->assertInstanceOf (SomeWidget::class, $ result );
264264 }
265265
@@ -277,6 +277,7 @@ class TestRegistrar
277277
278278 $ result = Factories::config ('TestRegistrar ' );
279279
280+ // @phpstan-ignore argument.type (Config\TestRegistrar is created at runtime by this test)
280281 $ this ->assertInstanceOf ('Config\TestRegistrar ' , $ result );
281282
282283 // Delete the config class in App
@@ -317,14 +318,14 @@ public function testPreferAppIsIgnored(): void
317318 class_alias (SomeWidget::class, $ class );
318319 }
319320
320- $ result = Factories::widgets (OtherWidget::class);
321+ $ result = Factories::widgets (OtherWidget::class); // @phpstan-ignore staticMethod.notFound
321322 $ this ->assertInstanceOf (OtherWidget::class, $ result );
322323 }
323324
324325 public function testCanLoadTwoCellsWithSameShortName (): void
325326 {
326- $ cell1 = Factories::cells ('\\' . SampleClass::class);
327- $ cell2 = Factories::cells ('\\' . \Tests \Support \View \OtherCells \SampleClass::class);
327+ $ cell1 = Factories::cells ('\\' . SampleClass::class); // @phpstan-ignore staticMethod.notFound
328+ $ cell2 = Factories::cells ('\\' . \Tests \Support \View \OtherCells \SampleClass::class); // @phpstan-ignore staticMethod.notFound
328329
329330 $ this ->assertNotSame ($ cell1 , $ cell2 );
330331 }
@@ -369,6 +370,7 @@ public function testDefineSameAliasAndSameClassTwice(): void
369370 UserModel::class,
370371 );
371372
373+ // @phpstan-ignore codeigniter.modelArgumentType (aliased to Tests\Support\Models\UserModel above)
372374 $ model = model ('CodeIgniter\Shield\Models\UserModel ' );
373375
374376 $ this ->assertInstanceOf (UserModel::class, $ model );
@@ -382,7 +384,7 @@ public function testDefineNonExistentClass(): void
382384 Factories::define (
383385 'models ' ,
384386 'CodeIgniter\Shield\Models\UserModel ' ,
385- 'App\Models\UserModel ' ,
387+ 'App\Models\UserModel ' , // @phpstan-ignore argument.type (deliberately does not exist)
386388 );
387389 }
388390
@@ -398,7 +400,7 @@ public function testDefineAfterLoading(): void
398400 Factories::define (
399401 'models ' ,
400402 UserModel::class,
401- 'App\Models\UserModel ' ,
403+ 'App\Models\UserModel ' , // @phpstan-ignore argument.type (deliberately does not exist)
402404 );
403405 }
404406
0 commit comments