5151use ShipMonk \PHPStan \DeadCode \Provider \VendorUsageProvider ;
5252use ShipMonk \PHPStan \DeadCode \Provider \VirtualUsageData ;
5353use ShipMonk \PHPStan \DeadCode \Transformer \FileSystem ;
54+ use ShipMonk \PHPStanDev \RuleTestCase as ShipMonkRuleTestCase ;
5455use Throwable ;
5556use Traversable ;
5657use function array_filter ;
7374use const PHP_VERSION_ID ;
7475
7576/**
76- * @extends RuleTestCase <DeadCodeRule>
77+ * @extends ShipMonkRuleTestCase <DeadCodeRule>
7778 */
78- class DeadCodeRuleTest extends RuleTestCase
79+ class DeadCodeRuleTest extends ShipMonkRuleTestCase
7980{
8081
8182 /**
@@ -225,25 +226,25 @@ private function doTestDead(
225226 self ::markTestSkipped ('Requirements not met ' );
226227 }
227228
228- $ this ->analyseFiles (is_array ($ files ) ? $ files : [$ files ]);
229+ $ this ->analyzeFiles (is_array ($ files ) ? $ files : [$ files ]);
229230 }
230231
231232 public function testMixedCallsTracked (): void
232233 {
233- $ this ->analyseFiles ([__DIR__ . '/data/methods/mixed/tracked.php ' ]);
234- $ this ->analyseFiles ([__DIR__ . '/data/constants/mixed/tracked.php ' ]);
234+ $ this ->analyzeFiles ([__DIR__ . '/data/methods/mixed/tracked.php ' ]);
235+ $ this ->analyzeFiles ([__DIR__ . '/data/constants/mixed/tracked.php ' ]);
235236 }
236237
237238 public function testMixedCallsNotTracked (): void
238239 {
239240 $ this ->trackMixedAccess = false ;
240- $ this ->analyseFiles ([__DIR__ . '/data/methods/mixed/untracked.php ' ]);
241- $ this ->analyseFiles ([__DIR__ . '/data/constants/mixed/untracked.php ' ]);
241+ $ this ->analyzeFiles ([__DIR__ . '/data/methods/mixed/untracked.php ' ]);
242+ $ this ->analyzeFiles ([__DIR__ . '/data/constants/mixed/untracked.php ' ]);
242243 }
243244
244245 public function testDiagnoseMixedCalls (): void
245246 {
246- $ this ->analyseFiles ([__DIR__ . '/data/methods/mixed/tracked.php ' ]);
247+ $ this ->analyzeFiles ([__DIR__ . '/data/methods/mixed/tracked.php ' ]);
247248 $ rule = $ this ->getRule ();
248249
249250 $ actualOutput = '' ;
@@ -267,7 +268,7 @@ public function testDiagnoseMixedCalls(): void
267268
268269 public function testDiagnoseFullyMixedCalls (): void
269270 {
270- $ this ->analyseFiles ([__DIR__ . '/data/mixed-member/full-mixed-method.php ' ]);
271+ $ this ->analyzeFiles ([__DIR__ . '/data/mixed-member/full-mixed-method.php ' ]);
271272 $ rule = $ this ->getRule ();
272273
273274 $ actualOutput = '' ;
@@ -289,7 +290,7 @@ public function testDiagnoseFullyMixedCalls(): void
289290
290291 public function testDiagnoseFullyMixedFetches (): void
291292 {
292- $ this ->analyseFiles ([__DIR__ . '/data/mixed-member/full-mixed-const.php ' ]);
293+ $ this ->analyzeFiles ([__DIR__ . '/data/mixed-member/full-mixed-const.php ' ]);
293294 $ rule = $ this ->getRule ();
294295
295296 $ actualOutput = '' ;
@@ -333,7 +334,7 @@ public function testDebugUsage(): void
333334 'DebugUnsupported\Foo::notDead ' ,
334335 'DebugZero\Foo::__construct ' ,
335336 ];
336- $ this ->analyseFiles ([
337+ $ this ->analyzeFiles ([
337338 __DIR__ . '/data/debug/alternative.php ' ,
338339 __DIR__ . '/data/debug/builtin.php ' ,
339340 __DIR__ . '/data/debug/ctor.php ' ,
@@ -433,7 +434,7 @@ public function testDebugUsageInvalidArgs(
433434 $ this ->expectExceptionMessage ($ error );
434435
435436 $ this ->debugMembers = [$ member ];
436- $ this ->analyseFiles ([__DIR__ . '/data/debug/alternative.php ' ]);
437+ $ this ->analyzeFiles ([__DIR__ . '/data/debug/alternative.php ' ]);
437438 $ this ->getRule ();
438439 }
439440
@@ -1188,6 +1189,20 @@ private function trimFgColors(string $output): string
11881189 return $ replaced ;
11891190 }
11901191
1192+ /**
1193+ * @param list<Error> $actualErrors
1194+ * @return list<string>
1195+ */
1196+ protected function processActualErrors (array $ actualErrors ): array
1197+ {
1198+ foreach ($ actualErrors as $ error ) {
1199+ self ::assertNotNull ($ error ->getIdentifier (), "Missing error identifier for error: {$ error ->getMessage ()}" );
1200+ self ::assertStringStartsWith ('shipmonk. ' , $ error ->getIdentifier (), "Unexpected error identifier for: {$ error ->getMessage ()}" );
1201+ }
1202+
1203+ return parent ::processActualErrors ($ actualErrors );
1204+ }
1205+
11911206 /**
11921207 * Allows secondary analysis within same testcase with different setup
11931208 */
0 commit comments