@@ -117,6 +117,7 @@ protected function getRule(): DeadCodeRule
117117 self ::createReflectionProvider (),
118118 ),
119119 new ClassHierarchy (),
120+ $ this ->detectDeadMethods ,
120121 !$ this ->emitErrorsInGroups ,
121122 new BackwardCompatibilityChecker ([], null ),
122123 );
@@ -134,7 +135,7 @@ protected function getCollectors(): array
134135
135136 return [
136137 new ProvidedUsagesCollector ($ reflectionProvider , $ this ->getMemberUsageProviders (), $ this ->getMemberUsageExcluders ()),
137- new ClassDefinitionCollector ($ reflectionProvider , $ this ->detectDeadMethods , $ this -> detectDeadConstants , $ this ->detectDeadEnumCases ),
138+ new ClassDefinitionCollector ($ reflectionProvider , $ this ->detectDeadConstants , $ this ->detectDeadEnumCases ),
138139 new MethodCallCollector ($ this ->getMemberUsageExcluders ()),
139140 new ConstantFetchCollector ($ reflectionProvider , $ this ->getMemberUsageExcluders ()),
140141 ];
@@ -490,7 +491,7 @@ public function testMethodDetectionCanBeDisabled(): void
490491 $ this ->detectDeadMethods = false ;
491492 $ this ->analyse ([__DIR__ . '/data/other/member-types.php ' ], [
492493 ['Unused MemberTypes\Clazz::CONSTANT ' , 7 ],
493- ['Unused MemberTypes\MyEnum::EnumCase ' , 13 ],
494+ ['Unused MemberTypes\MyEnum::EnumCase ' , 25 ],
494495 ]);
495496 }
496497
@@ -502,8 +503,8 @@ public function testConstantDetectionCanBeDisabled(): void
502503
503504 $ this ->detectDeadConstants = false ;
504505 $ this ->analyse ([__DIR__ . '/data/other/member-types.php ' ], [
505- ['Unused MemberTypes\MyEnum::EnumCase ' , 13 ],
506- ['Unused MemberTypes\Clazz::method ' , 8 ],
506+ ['Unused MemberTypes\MyEnum::EnumCase ' , 25 ],
507+ ['Unused MemberTypes\Clazz::method ' , 10 ],
507508 ]);
508509 }
509510
@@ -516,7 +517,7 @@ public function testEnumCaseDetectionCanBeDisabled(): void
516517 $ this ->detectDeadEnumCases = false ;
517518 $ this ->analyse ([__DIR__ . '/data/other/member-types.php ' ], [
518519 ['Unused MemberTypes\Clazz::CONSTANT ' , 7 ],
519- ['Unused MemberTypes\Clazz::method ' , 8 ],
520+ ['Unused MemberTypes\Clazz::method ' , 10 ],
520521 ]);
521522 }
522523
0 commit comments