Skip to content

Commit

Permalink
extension to detect dead code (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Sep 17, 2022
1 parent 68318c9 commit 0436095
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/RexStanSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final class RexStanSettings
'phpstan-dba' => 'lib/phpstan-dba.neon',
'cognitive complexity' => 'lib/cognitive-complexity.neon',
'code complexity' => 'lib/code-complexity.neon',
'dead code' => 'lib/dead-code.neon',
];

/**
Expand Down
26 changes: 26 additions & 0 deletions lib/dead-code.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
includes:
- ../vendor/symplify/phpstan-rules/config/services/services.neon

# these rule focus on the whole-project analysis, see https://phpstan.org/developing-extensions/collectors
rules:
- Symplify\PHPStanRules\Rules\DeadCode\UnusedPublicClassConstRule
- Symplify\PHPStanRules\Rules\DeadCode\UnusedPublicClassMethodRule

services:
# for UnusedPublicClassConstRule
-
class: Symplify\PHPStanRules\Collector\ClassConst\ClassConstFetchCollector
tags: [phpstan.collector]

-
class: Symplify\PHPStanRules\Collector\ClassConst\PublicClassLikeConstCollector
tags: [phpstan.collector]

# for UnusedPublicClassMethodRule
-
class: Symplify\PHPStanRules\Collector\ClassMethod\PublicClassMethodCollector
tags: [phpstan.collector]

-
class: Symplify\PHPStanRules\Collector\ClassMethod\MethodCallCollector
tags: [phpstan.collector]

0 comments on commit 0436095

Please sign in to comment.