Reputation: 93
I have a very big PHP project with i think a lot of useless stuffs .
Do you have some tips or maybe some tools to detect useless part of code or useless files ?
Upvotes: 4
Views: 2657
Reputation: 146
Nowadays, your best option for unused PHP code is probably PHPStan extension called Dead Code Detector:
It can detect dead cycles, supports popular PHP libraries (like Symfony, Doctrine, PHPUnit, etc.) and can even remove the dead code by itself. You can customize it to your needs and use it in your CI.
Upvotes: 1
Reputation: 1165
PHPMD will show to you all mess created in your code. It's also show the cyclomatic complexity of your codem which will let you do a few code optimizations.
PHPMD is a spin-off of PHP Depend. PHP Depend will show to you better metrics and graphics of your software than PHPMD. A really powerfull tool, better than PHPMD for optimization, but with a different purpose.
Mark Baker also talked about PHP Dead Code Detector (PHPDCD). IDK the project, but seems very similar to PHPMD.
Upvotes: 3