I tried to set my config to:
parameters:
shipmonkDeadCode:
detect:
deadMethods: false
deadConstants: true
but ended up with all class constants in the project being detected as unused.
I set up a small repo to reproduce that: https://github.com/mdio/test-dead-code-detection-constants-only
Running vendor/bin/phpstan analyse -c phpstan-dead-code.neon with the current setup gives me:
------ ----------------------------------------------
Line ClassWithConstants.php
------ ----------------------------------------------
11 Unused mdio\ClassWithConstants::DEFAULT_PORT
🪪 shipmonk.deadConstant
at ClassWithConstants.php:11
------ ----------------------------------------------
Setting deadMethods: true correctly results in [OK] No errors.
Btw, thanks a lot for this tool! It makes working with a large legacy code base much nicer as it allows me to quickly find stuff I can delete to make it more manageable.
I tried to set my config to:
but ended up with all class constants in the project being detected as unused.
I set up a small repo to reproduce that: https://github.com/mdio/test-dead-code-detection-constants-only
Running
vendor/bin/phpstan analyse -c phpstan-dead-code.neonwith the current setup gives me:Setting
deadMethods: truecorrectly results in[OK] No errors.Btw, thanks a lot for this tool! It makes working with a large legacy code base much nicer as it allows me to quickly find stuff I can delete to make it more manageable.