How can I find unused functions in a PHP project -


how can find unused functions in php project?

are there features or apis built php allow me analyse codebase - example reflection, token_get_all()?

are these apis feature rich enough me not have rely on third party tool perform type of analysis?

you can try sebastian bergmann's dead code detector:

phpdcd dead code detector (dcd) php code. scans php project declared functions , methods , reports being "dead code" not called @ least once.

source: https://github.com/sebastianbergmann/phpdcd

note it's static code analyzer, might give false positives methods called dynamically, e.g. cannot detect $foo = 'fn'; $foo();

you can install via pear:

pear install phpunit/phpdcd-beta 

after can use following options:

usage: phpdcd [switches] <directory|file> ...  --recursive report code dead if called dead code.  --exclude <dir> exclude <dir> code analysis. --suffixes <suffix> comma-separated list of file suffixes check.  --help prints usage information. --version prints version , exits.  --verbose print progress bar. 

more tools:


note: per repository notice, this project no longer maintained , repository kept archival purposes. mileage may vary.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -