The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces. For Symfony2 projects, it also detects usages of deprecated services.
It identifies the use of deprecated code thanks to the
Please note this tool is in a very early stage of development. Expect bugs and quirks.
The command works in three steps:
- Scanning your vendor libraries for defined deprecations and cache them as a
- Finding usages of those deprecations from your ruleset.
- Output with the affected code parts.
Clone the repository
$ git clone firstname.lastname@example.org:sensiolabs-de/deprecation-detector.git
$ composer install
Create phar archive with Box (optional)
$ box build
If you want to call the deprecation-detector globally, it needs to be placed in your
PATH. For example with:
$ sudo chmod a+x deprecation-detector.phar $ sudo mv deprecation-detector.phar /usr/local/bin/deprecation-detector
To use the DeprecationDetector you need to provide the
source and the
$ deprecation-detector check src/ vendor/ $ deprecation-detector check src/ composer.lock $ deprecation-detector check src/ .rules/some_generated_rule_set
There are different output formats available, by default the output is printed in the commandline.
$ deprecation-detector check src/ vendor/ --log-html deprecationlog.html
You can get a list of all options and arguments by running
$ deprecation-detector check --help
Excluding deprecated method calls
You can exclude deprecated method calls by using the
filter-methods option. This option takes a comma separated list of method references to exclude.
$ deprecation-detector check --filter-methods=MyClass::method,Foo::bar src/ vendor/
This will exclude all deprecated calls to MyClass::method and Foo::bar.
Currently, the SensioLabs DeprecationDetector is in a very early state. Pull requests are welcome!