The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces

Overview

SensioLabs DeprecationDetector

Tests Gitter

CAUTION: This package is abandoned and will no longer receive any updates.

The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces. For Symfony projects, it also detects usages of deprecated services. It identifies the use of deprecated code thanks to the @deprecated annotation.

Disclaimer

Please note this tool is in a very early stage of development. Expect bugs and quirks.

Basic knowledge

The Sensiolabs DeprecationDetector is a command line command based on the Symfony Console component. It makes heavy use of the PHP-Parser library for analyzing PHP code.

The command works in three steps:

  1. Scanning your vendor libraries for defined deprecations and cache them as a ruleset
  2. Finding usages of those deprecations from your ruleset.
  3. Output with the affected code parts.

Installation

Composer

For a system-wide installation via Composer, you can run:

$ composer global require sensiolabs-de/deprecation-detector

Make sure you have ~/.composer/vendor/bin/ in your PATH and you will be able to call the deprecation-detector command.

PHAR

You can download the PHAR file available on the releases page:

curl -OL https://github.com/sensiolabs-de/deprecation-detector/releases/download/0.1.0-alpha4/deprecation-detector.phar
php deprecation-detector.phar

Standalone

Clone the repository

$ git clone [email protected]:sensiolabs-de/deprecation-detector.git

Run composer

$ composer install

Create phar archive with Box (optional)

$ box build

Provided you created the phar archive, if you want to call the deprecation-detector globally, it needs to be placed in your PATH. For example with:

$ chmod a+x deprecation-detector.phar
$ mv deprecation-detector.phar /usr/local/bin/deprecation-detector

Otherwise you can call bin/deprecation-detector directly.

Usage

To use the DeprecationDetector you need to provide the source and the ruleset arguments

$ deprecation-detector check src/ vendor/
$ deprecation-detector check src/ composer.lock
$ deprecation-detector check src/ .rules/some_generated_rule_set

Output

There are different output formats available, by default the output is printed in the commandline.

Html

$ 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

The default output might not fit into the cli. If that is the case you can set the output to a list by setting --output=simple.

$ deprecation-detector check src/ vendor/ --output=simple

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.

Contribution

Currently, the SensioLabs DeprecationDetector is in a very early state. Pull requests are welcome!

Maintainers

The DeprecationDetector is a project developed by the team at SensioLabs Deutschland, maintained by @marvin_klemp.

Comments
  • PHP fatal errors when run

    PHP fatal errors when run

    git clone composer install box build ./deprecation-detector.phar

    Checking your application for deprecations - this could take a while ...
    
    Loading RuleSet...
    
    PHP Catchable fatal error:  Argument 2 passed to SensioLabs\DeprecationDetector\RuleSet\DirectoryTraverser::traverse() must be an instance of SensioLabs\DeprecationDetector\RuleSet\RuleSet, boolean given, called in phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/Loader/ComposerLoader.php on line 115 and defined in phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/DirectoryTraverser.php on line 34
    PHP Stack trace:
    PHP   1. {main}() /var/www/html/deprecation-detector/deprecation-detector.phar:0
    PHP   2. require() /var/www/html/deprecation-detector/deprecation-detector.phar:10
    PHP   3. Symfony\Component\Console\Application->run() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/bin/deprecation-detector:17
    PHP   4. Symfony\Component\Console\Application->doRun() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Application.php:120
    PHP   5. Symfony\Component\Console\Application->doRunCommand() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Application.php:189
    PHP   6. Symfony\Component\Console\Command\Command->run() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Application.php:838
    PHP   7. SensioLabs\DeprecationDetector\Console\Command\CheckCommand->execute() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Command/Command.php:256
    PHP   8. SensioLabs\DeprecationDetector\DeprecationDetector->checkForDeprecations() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/Console/Command/CheckCommand.php:121
    PHP   9. SensioLabs\DeprecationDetector\RuleSet\Loader\ComposerLoader->loadRuleSet() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/DeprecationDetector.php:77
    PHP  10. SensioLabs\DeprecationDetector\RuleSet\Loader\ComposerLoader->loadPackageRuleSet() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/Loader/ComposerLoader.php:50
    PHP  11. SensioLabs\DeprecationDetector\RuleSet\DirectoryTraverser->traverse() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/Loader/ComposerLoader.php:115
    
    Catchable fatal error: Argument 2 passed to SensioLabs\DeprecationDetector\RuleSet\DirectoryTraverser::traverse() must be an instance of SensioLabs\DeprecationDetector\RuleSet\RuleSet, boolean given, called in phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/Loader/ComposerLoader.php on line 115 and defined in phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/DirectoryTraverser.php on line 34
    
    Call Stack:
        0.0132    1368160   1. {main}() /var/www/html/deprecation-detector/deprecation-detector.phar:0
        0.0133    1364088   2. require('phar:///var/www/html/deprecation-detector/deprecation-detector.phar/bin/deprecation-detector') /var/www/html/deprecation-detector/deprecation-detector.phar:10
        0.0197    2858304   3. Symfony\Component\Console\Application->run() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/bin/deprecation-detector:17
        0.0212    3189728   4. Symfony\Component\Console\Application->doRun() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Application.php:120
        0.0214    3230152   5. Symfony\Component\Console\Application->doRunCommand() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Application.php:189
        0.0214    3230728   6. Symfony\Component\Console\Command\Command->run() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Application.php:838
        0.0216    3234792   7. SensioLabs\DeprecationDetector\Console\Command\CheckCommand->execute() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/vendor/symfony/console/Command/Command.php:256
        0.0352    7424736   8. SensioLabs\DeprecationDetector\DeprecationDetector->checkForDeprecations() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/Console/Command/CheckCommand.php:121
        0.0354    7464592   9. SensioLabs\DeprecationDetector\RuleSet\Loader\ComposerLoader->loadRuleSet() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/DeprecationDetector.php:77
        0.0372    7958200  10. SensioLabs\DeprecationDetector\RuleSet\Loader\ComposerLoader->loadPackageRuleSet() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/Loader/ComposerLoader.php:50
        0.0372    7958800  11. SensioLabs\DeprecationDetector\RuleSet\DirectoryTraverser->traverse() phar:///var/www/html/deprecation-detector/deprecation-detector.phar/src/RuleSet/Loader/ComposerLoader.php:115
    

    php -v

    PHP 5.6.15 (cli) (built: Oct 29 2015 14:59:23) 
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
        with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethan
    
    bug 
    opened by nask0 11
  • Missing

    Missing "symfony/expression-language" dependency

    I analyzed some symfony bundles I maintain. It worked great. However, when I analyzed a different project I received the following fatal error:

    PHP Fatal error: Class 'Symfony\Component\ExpressionLanguage\Expression' not found in deprecation-detector/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php on line 384

    The difference is that in the second project, I use the expression language syntax in a few places in the dependency injection yaml configuration files.

    The fix is to add "symfony/expression-language" as a dependency.

    Cheers, Kevin

    opened by kevintweber 8
  • Added a html output option

    Added a html output option

    Hi,

    at the Symfony Hack in Berlin @PhilippSchreiber, @ThYpHo0n and me hack this little extension. It allows you to create a file with a bootstrap style table of violations.

    I modified the PR according to the comments on PR #42.

    opened by datenbrille 8
  • Cannot redeclare class ...

    Cannot redeclare class ...

    The project to be checked has same dependencies as the deprecation-detector (e.g. nikic/php-parser), so I get following error by running the check: PHP Fatal error: Cannot redeclare class PhpParser\Autoloader in /local/some_project/vendor/nikic/php-parser/lib/PhpParser/Autoloader.php on line 9

    In my case I just can install the compoer-vendor-stuff with --no-dev to solve the problem, but I think, this is no solution for all. Any ideas?

    bug 
    opened by DrSchimke 6
  • Output failing file on syntax error

    Output failing file on syntax error

    If a source file fails to compile, the detector aborts with an error message like this:

    [PhpParser\Error]
    Syntax error, unexpected EOF on line 11

    In large projects there might be abandoned files that don't even compile, so I think it would be great to have the path of the file that fails.

    Perhaps it makes sense to continue the detection run even if some files fail.

    bug 
    opened by umulmrum 6
  • Consider simplifying its use as a global tool

    Consider simplifying its use as a global tool

    First of all, thanks for publishing this cool and useful tool.

    I plan to use this tool similarly to phpunit and php-cs-fixer. I've built the PHAR file and installed in the global bin directory. But this project could provide the PHAR already built (like other projects do) to simplify its use.

    Besides, this PHAR could also provide "self-updating" feature (such as PHP-CS-Fixer, Composer, the Symfony Installer, etc.) This makes it much easier to stay up-to-date.

    opened by javiereguiluz 4
  • Parser errors noted, but execution continues

    Parser errors noted, but execution continues

    This is a fix for #10 Output failing file on syntax error.

    ParsedPhpFileFinder has been modified to collect PhpParser\Error and expose them to the outside. CheckCommand can now detect if there were any parser errors and print them to the command line, but actual execution of the application continues

    opened by ghost 4
  • Supports Symfony 4

    Supports Symfony 4

    I would like to install this tool (even in dev) in my project dev-dependencies: composer req --dev sensiolabs-de/deprecation-detector:dev-master. Installation failed because of symfony/* requirements limited to ~3.0.

    I'll try to open a PR to add Symfony 4 & PHP 7 supports.

    opened by vincentchalamon 3
  • Symmetric array destructuring results in 'Syntax error'

    Symmetric array destructuring results in 'Syntax error'

    When I run the deprecation detector on a codebase using PHP 7.1 which is using the new Symmetric array destructuring feature I get the following error:

    Syntax error, unexpected '=' in file /Users/ck/Documents/Work/geh-web/src/Geh/EntityBundle/Request/ParamConverter/EntityParamConverter.php

    <?php
    [$namespaceAlias, $simpleClassName] = explode(':', 'SomeNamespace:SomeClass');
    

    I don't know if it's an limitation of used php functions which results in that error, just wanted to note that it currently not works correct.

    Alternatively don't state '^7.0' in the composer.json and only add tested Version constraints.

    opened by Blackskyliner 3
  • Rendering in Travis CI

    Rendering in Travis CI

    It would be nice if the CLI output would fit in small screens. Obviously not asking for making it readable on a phone but at least on a terminal like Travis CI or AppVeyor:

    screen shot 2016-03-06 at 13 12 40
    opened by theofidry 3
  • Fix anonymous classes

    Fix anonymous classes

    The deprecation detector crashes if anonymous classes are used.

    Part of PHPUnit that lets the detector break (original file).

    $o = new class { public function foo() {} };
    $o = new class{public function foo(){}};
    $o = new class extends stdClass {};
    $o = new class extends stdClass {};
    $o = new class implements foo {};
    

    Some classes try to access the name or namespacedName attribute of an AST class node and generate an Usage with that name. Because the namespacedName is no longer provided if the node is an anonymous class the issue occurs.

    e.g FindDeprecatedTagsVisitor in line 44

    public function enterNode(Node $node)
    {
        if ($node instanceof Node\Stmt\ClassLike) {
            $this->parentName = $node->namespacedName->toString();
        }
    
        ...
    }
    

    As $node->namespacedName is not provided anymore in any class

    PHP Notice:  Undefined property: PhpParser\Node\Stmt\Class_::$namespacedName in /vagrant/www/contrib/deprecation-detector/src/Visitor/Deprecation/FindDeprecatedTagsVisitor.php on line 44
    PHP Stack trace:
    PHP   1. {main}() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:0
    PHP   2. Symfony\Component\Console\Application->run() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:18
    PHP   3. Symfony\Component\Console\Application->doRun() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:126
    PHP   4. Symfony\Component\Console\Application->doRunCommand() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:195
    PHP   5. Symfony\Component\Console\Command\Command->run() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:886
    PHP   6. SensioLabs\DeprecationDetector\Console\Command\CheckCommand->execute() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Command/Command.php:259
    PHP   7. SensioLabs\DeprecationDetector\Detector\ViolationDetector->getViolations() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:144
    PHP   8. SensioLabs\DeprecationDetector\Finder\ParsedPhpFileFinder->getIterator() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:45
    PHP   9. SensioLabs\DeprecationDetector\Parser\UsageParser->parseFile() /vagrant/www/contrib/deprecation-detector/src/Finder/ParsedPhpFileFinder.php:49
    PHP  10. PhpParser\NodeTraverser->traverse() /vagrant/www/contrib/deprecation-detector/src/Parser/UsageParser.php:70
    PHP  11. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
    PHP  12. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
    PHP  13. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP  14. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
    PHP  15. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP  16. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
    PHP  17. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:97
    PHP  18. SensioLabs\DeprecationDetector\Visitor\Deprecation\FindDeprecatedTagsVisitor->enterNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:88
    
    Notice: Undefined property: PhpParser\Node\Stmt\Class_::$namespacedName in /vagrant/www/contrib/deprecation-detector/src/Visitor/Deprecation/FindDeprecatedTagsVisitor.php on line 44
    
    Call Stack:
        0.0006     224152   1. {main}() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:0
        0.2352    2014264   2. Symfony\Component\Console\Application->run() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:18
        0.3031    2359816   3. Symfony\Component\Console\Application->doRun() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:126
        0.3033    2360736   4. Symfony\Component\Console\Application->doRunCommand() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:195
        0.3278    2431448   5. Symfony\Component\Console\Command\Command->run() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:886
        0.3285    2436536   6. SensioLabs\DeprecationDetector\Console\Command\CheckCommand->execute() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Command/Command.php:259
       52.5725   12499048   7. SensioLabs\DeprecationDetector\Detector\ViolationDetector->getViolations() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:144
       59.7791   12500712   8. SensioLabs\DeprecationDetector\Finder\ParsedPhpFileFinder->getIterator() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:45
      136.1687   27920912   9. SensioLabs\DeprecationDetector\Parser\UsageParser->parseFile() /vagrant/www/contrib/deprecation-detector/src/Finder/ParsedPhpFileFinder.php:49
      136.1840   28011408  10. PhpParser\NodeTraverser->traverse() /vagrant/www/contrib/deprecation-detector/src/Parser/UsageParser.php:70
      136.1840   28010328  11. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
      136.1844   28016784  12. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
      136.1844   28019672  13. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
      136.1846   28021160  14. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
      136.1846   28024040  15. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
      136.1847   28025880  16. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
      136.1850   28028536  17. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:97
      136.1850   28029360  18. SensioLabs\DeprecationDetector\Visitor\Deprecation\FindDeprecatedTagsVisitor->enterNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:88
    
    PHP Fatal error:  Call to a member function toString() on a non-object in /vagrant/www/contrib/deprecation-detector/src/Visitor/Deprecation/FindDeprecatedTagsVisitor.php on line 44
    PHP Stack trace:
    PHP   1. {main}() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:0
    PHP   2. Symfony\Component\Console\Application->run() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:18
    PHP   3. Symfony\Component\Console\Application->doRun() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:126
    PHP   4. Symfony\Component\Console\Application->doRunCommand() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:195
    PHP   5. Symfony\Component\Console\Command\Command->run() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:886
    PHP   6. SensioLabs\DeprecationDetector\Console\Command\CheckCommand->execute() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Command/Command.php:259
    PHP   7. SensioLabs\DeprecationDetector\Detector\ViolationDetector->getViolations() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:144
    PHP   8. SensioLabs\DeprecationDetector\Finder\ParsedPhpFileFinder->getIterator() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:45
    PHP   9. SensioLabs\DeprecationDetector\Parser\UsageParser->parseFile() /vagrant/www/contrib/deprecation-detector/src/Finder/ParsedPhpFileFinder.php:49
    PHP  10. PhpParser\NodeTraverser->traverse() /vagrant/www/contrib/deprecation-detector/src/Parser/UsageParser.php:70
    PHP  11. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
    PHP  12. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
    PHP  13. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP  14. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
    PHP  15. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
    PHP  16. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
    PHP  17. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:97
    PHP  18. SensioLabs\DeprecationDetector\Visitor\Deprecation\FindDeprecatedTagsVisitor->enterNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:88
    
    Fatal error: Call to a member function toString() on a non-object in /vagrant/www/contrib/deprecation-detector/src/Visitor/Deprecation/FindDeprecatedTagsVisitor.php on line 44
    
    Call Stack:
        0.0006     224152   1. {main}() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:0
        0.2352    2014264   2. Symfony\Component\Console\Application->run() /vagrant/www/contrib/deprecation-detector/bin/deprecation-detector:18
        0.3031    2359816   3. Symfony\Component\Console\Application->doRun() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:126
        0.3033    2360736   4. Symfony\Component\Console\Application->doRunCommand() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:195
        0.3278    2431448   5. Symfony\Component\Console\Command\Command->run() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Application.php:886
        0.3285    2436536   6. SensioLabs\DeprecationDetector\Console\Command\CheckCommand->execute() /vagrant/www/contrib/deprecation-detector/vendor/symfony/console/Command/Command.php:259
       52.5725   12499048   7. SensioLabs\DeprecationDetector\Detector\ViolationDetector->getViolations() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:144
       59.7791   12500712   8. SensioLabs\DeprecationDetector\Finder\ParsedPhpFileFinder->getIterator() /vagrant/www/contrib/deprecation-detector/src/Console/Command/CheckCommand.php:45
      136.1687   27920912   9. SensioLabs\DeprecationDetector\Parser\UsageParser->parseFile() /vagrant/www/contrib/deprecation-detector/src/Finder/ParsedPhpFileFinder.php:49
      136.1840   28011408  10. PhpParser\NodeTraverser->traverse() /vagrant/www/contrib/deprecation-detector/src/Parser/UsageParser.php:70
      136.1840   28010328  11. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
      136.1844   28016784  12. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
      136.1844   28019672  13. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
      136.1846   28021160  14. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
      136.1846   28024040  15. PhpParser\NodeTraverser->traverseArray() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
      136.1847   28025880  16. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
      136.1850   28028536  17. PhpParser\NodeTraverser->traverseNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:97
      136.1850   28029360  18. SensioLabs\DeprecationDetector\Visitor\Deprecation\FindDeprecatedTagsVisitor->enterNode() /vagrant/www/contrib/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:88
    
    bug 
    opened by MarvinKlemp 3
  • Bump symfony/cache from 3.2.7 to 3.4.47

    Bump symfony/cache from 3.2.7 to 3.4.47

    Bumps symfony/cache from 3.2.7 to 3.4.47.

    Release notes

    Sourced from symfony/cache's releases.

    v3.4.47

    Changelog (https://github.com/symfony/cache/compare/v3.4.46...v3.4.47)

    • no changes

    v3.4.46

    Changelog (https://github.com/symfony/cache/compare/v3.4.45...v3.4.46)

    • no changes

    v3.4.45

    Changelog (https://github.com/symfony/cache/compare/v3.4.44...v3.4.45)

    • no changes

    v3.4.44

    Changelog (https://github.com/symfony/cache/compare/v3.4.43...v3.4.44)

    • bug #37671 fix saving no-expiry items with ArrayAdapter (philipp-kolesnikov)

    v3.4.43

    Changelog (https://github.com/symfony/cache/compare/v3.4.42...v3.4.43)

    • bug #37635 fix catching auth errors (nicolas-grekas)
    • bug #37562 Use the default expiry when saving (not when creating) items (philipp-kolesnikov)
    • bug #37563 Fix DBAL deprecation (nicolas-grekas)
    • bug #37526 ensure compatibility with PHP 8 stack traces (xabbuh)
    • bug #37342 fix compat with DBAL v3 (nicolas-grekas)

    v3.4.42

    Changelog (https://github.com/symfony/cache/compare/v3.4.41...v3.4.42)

    • bug #37169 fix forward compatibility with Doctrine DBAL 3 (xabbuh)

    v3.4.41

    Changelog (https://github.com/symfony/cache/compare/v3.4.40...v3.4.41)

    • bug #36987 Handle fetch mode deprecation of DBAL 2.11. (derrabus)
    • bug #36917 Accessing undefined constants raises an Error in php8 (derrabus)

    v3.4.40

    Changelog (https://github.com/symfony/cache/compare/v3.4.39...v3.4.40)

    • bug #36555 skip APCu in chains when the backend is disabled (nicolas-grekas)
    • bug #36460 Avoid memory leak in TraceableAdapter::reset() (lyrixx)

    v3.4.39

    Changelog (https://github.com/symfony/cache/compare/v3.4.38...v3.4.39)

    • no changes

    ... (truncated)

    Changelog

    Sourced from symfony/cache's changelog.

    CHANGELOG

    5.3.0

    • added support for connecting to Redis Sentinel clusters when using the Redis PHP extension

    5.2.0

    • added integration with Messenger to allow computing cached values in a worker
    • allow ISO 8601 time intervals to specify default lifetime

    5.1.0

    • added max-items + LRU + max-lifetime capabilities to ArrayCache
    • added CouchbaseBucketAdapter
    • added context cache-adapter to log messages

    5.0.0

    • removed all PSR-16 implementations in the Simple namespace
    • removed SimpleCacheAdapter
    • removed AbstractAdapter::unserialize()
    • removed CacheItem::getPreviousTags()

    4.4.0

    • added support for connecting to Redis Sentinel clusters
    • added argument $prefix to AdapterInterface::clear()
    • improved RedisTagAwareAdapter to support Redis server >= 2.8 and up to 4B items per tag
    • added TagAwareMarshaller for optimized data storage when using AbstractTagAwareAdapter
    • added DeflateMarshaller to compress serialized values
    • removed support for phpredis 4 compression
    • [BC BREAK] RedisTagAwareAdapter is not compatible with RedisCluster from Predis anymore, use phpredis instead
    • Marked the CacheDataCollector class as @final.
    • added SodiumMarshaller to encrypt/decrypt values using libsodium

    4.3.0

    • removed psr/simple-cache dependency, run composer require psr/simple-cache if you need it
    • deprecated all PSR-16 adapters, use Psr16Cache or Symfony\Contracts\Cache\CacheInterface implementations instead
    • deprecated SimpleCacheAdapter, use Psr16Adapter instead

    4.2.0

    ... (truncated)

    Commits
    • a7a14c4 Remove branch-version (keep them for contracts only)
    • 14c3476 Don't skip Doctrine tests on php 8.
    • b4a38d5 Fix branch-version
    • f9d4352 Remove "version" from composer.json files, use "branch-version" instead
    • 988c330 Update versions in composer.json
    • 55d571d Remove "branch-alias", populate "version"
    • 1287b85 [Cache] fix DBAL v3 compat
    • 01f4cc9 Enable "native_constant_invocation" CS rule
    • a3e381d fix expected exception messages on PHP 8
    • 4f1f1e2 [Cache] Fix #37667
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Argument 1 passed to PhpParser\Node\Stmt\StaticVar::__construct() must be an instance of PhpParser\Node\Expr\Variable, string given

    Argument 1 passed to PhpParser\Node\Stmt\StaticVar::__construct() must be an instance of PhpParser\Node\Expr\Variable, string given

    when I run check I get the following error

    [Symfony\Component\Debug\Exception\FatalThrowableError] Argument 1 passed to PhpParser\Node\Stmt\StaticVar::__construct() must be an instance of PhpParser\Node\Expr\Variable, string given, called in /Users /patricklock/Sites/deprecation-detector/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php on line 1854

    opened by PaddyLock 2
  • Dependency conflict

    Dependency conflict

    In a project requires nikic/php-parser in version 4.0, deprecation-detector throws an error due to incompatibilities between php-parser 3 and 4. I don’t understand why the phar uses local vendor instead of embeded.

    Here minimals commands to reproduce the error:

    composer --no-interaction require symfony/http-kernel nikic/php-parser
    wget https://github.com/sensiolabs-de/deprecation-detector/releases/download/0.1.0-alpha4/deprecation-detector.phar
    mkdir src
    echo '<?php declare(strict_types = 1);
    
    require __DIR__ . "/../vendor/autoload.php";
    
    class Kernel extends Symfony\Component\HttpKernel\Kernel
    {
        public function registerBundles()
        {
        }
    
        public function registerContainerConfiguration()
        {
        }
    }
    
    new Kernel('dev', true);' > src/app.php
    php deprecation-detector.phar
    

    And the error message, take attention to php file paths:

    Checking your application for deprecations - this could take a while ...
    
    Loading RuleSet...
    
    RuleSet loaded.
    
    Parsing files & Searching for deprecations...
    
    PHP Fatal error:  Uncaught TypeError: Argument 3 passed to PhpParser\Node\Stmt\UseUse::__construct() must be of the type integer, array given, called in phar:///home/sanpi/tests/php/deprecation-detector.phar/vendor/nikic/php-parser/lib/PhpParser/Parser.php on line 1126 and defined in /home/sanpi/tests/php/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php:25
    Stack trace:
    #0 phar:///home/sanpi/tests/php/deprecation-detector.phar/vendor/nikic/php-parser/lib/PhpParser/Parser.php(1126): PhpParser\Node\Stmt\UseUse->__construct(Object(PhpParser\Node\Name), NULL, Array)                                                           
    #1 phar:///home/sanpi/tests/php/deprecation-detector.phar/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(242): PhpParser\Parser->reduceRule20()                                                                                                     
    #2 phar:///home/sanpi/tests/php/deprecation-detector.phar/src/Parser/UsageParser.php(69): PhpParser\ParserAbstract->parse('<?php\n\n/*\n * Th...')                                                                                                            
    #3 phar:///home/sanpi/tests/php/deprecation-detector.phar/src/TypeGuessing/AncestorResolver.php(187): SensioLabs\DeprecationDetector\Parser\UsageParser->parseFile( in /home/sanpi/tests/php/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php on line 25
    
    opened by sanpii 1
  • Support of PHP 7.1

    Support of PHP 7.1

    I get a syntax error while testing on PHP 7.1 code:

    Your project contains invalid code:
    Syntax error, unexpected '?' in file /var/www/html/www/src/Acme/Bundle/MyClass.php
    

    this file contains the optional return value operator public function getValue() ?int

    a quick look into this composer.json reveals the support of php 7.0 - so I'd like to know are there any plans to upgrade to support php 7.1? I assume of course, pull requests are welcome ;)

    opened by bartrail 3
  • New release?

    New release?

    Hello!

    Are there any plans for tagging a new release of this? Any blocking issues we can help with?

    The ~2.0 constraint on phpdocumentor/reflection-docblock in the latest release is causing problems for us - and it was fixed by https://github.com/sensiolabs-de/deprecation-detector/pull/136 but hasn't made it into a release yet.

    Thanks!

    opened by balsama 3
Releases(0.1.0-alpha4)
Owner
QOSSMIC GmbH
QOSSMIC GmbH
Find undefined and unused variables with the PHP Codesniffer static analysis tool.

PHP_CodeSniffer VariableAnalysis Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use. Warns if variables ar

Payton Swick 116 Dec 14, 2022
Dobren Dragojević 6 Jun 11, 2023
This library can be used, among other things, to retrieve the classes, interfaces, traits, enums, functions and constants declared in a file

marijnvanwezel/reflection-file Library that allows reflection of files. This library can be used, among other things, to retrieve the classes, interfa

Marijn van Wezel 5 Apr 17, 2022
PHPStan extension for sealed classes and interfaces.

Sealed classes with PHPStan This extension adds support for sealed classes and interfaces to PHPStan. Installation To use this extension, require it v

Jiří Pudil 14 Nov 28, 2022
Snuffleupagus is a PHP 7+ and 8+ module designed to drastically raise the cost of attacks against websites, by killing entire bug classes

Snuffleupagus is a PHP 7+ and 8+ module designed to drastically raise the cost of attacks against websites, by killing entire bug classes

Julien Voisin 625 Jan 3, 2023
bin/magento command to display configured preferences for classes or interfaces

bin/magento command to display configured preferences for classes or interfaces A bin/magento command that will show you the configured preferences fo

David Manners 14 Jul 18, 2022
Um repositório com classes, interfaces para padronizar os projetos de PHP da empresa

php-utils PHP Utilities for Laravel/Lumen Installation cd /path/to/your/project composer require logcomex/php-utils Utilities Packages Contracts Excep

LogComex 1 Oct 10, 2022
A pure PHP implementation of the open Language Server Protocol. Provides static code analysis for PHP for any IDE.

A pure PHP implementation of the open Language Server Protocol. Provides static code analysis for PHP for any IDE.

Felix Becker 1.1k Jan 4, 2023
Perform static analysis of Drupal PHP code with phpstan-drupal.

Perform static analysis of Drupal PHP code with PHPStan and PHPStan-Drupal on Drupal using PHP 8. For example: docker run --rm \ -v $(pwd)/example01

Dcycle 0 Dec 10, 2021
QaraTMS is open source test case, test suites, test plans and test runs management tool.

QaraTMS - Open Source Test Management System QaraTMS is open source test management software for managing test suites, test cases, test plans, test ru

Alex H 29 Dec 22, 2022
Beautiful and understandable static analysis tool for PHP

PhpMetrics PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report. Documentation | Twitter | Contributing

PhpMetrics 2.3k Jan 5, 2023
WooCommerce function and class declaration stubs for static analysis.

WooCommerce Stubs This package provides stub declarations for WooCommerce functions, classes and interfaces. These stubs can help plugin and theme dev

PHP Stubs Library 54 Dec 27, 2022
Docker image that provides static analysis tools for PHP

Static Analysis Tools for PHP Docker image providing static analysis tools for PHP. The list of available tools and the installer are actually managed

Jakub Zalas 1.1k Jan 1, 2023
Dockerise Symfony Application (Symfony 6 + Clean Architecture+ DDD+ CQRS + Docker + Xdebug + PHPUnit + Doctrine ORM + JWT Auth + Static analysis)

Symfony Dockerise Symfony Application Install Docker Install Docker Compose Docker PHP & Nginx Create Symfony Application Debugging Install Xdebug Con

null 48 Jan 5, 2023
Attributes to define PHP language extensions (to be enforced by static analysis)

PHP Language Extensions (currently in BETA) This library provides attributes for extending the PHP language (e.g. adding package visibility). The inte

Dave Liddament 70 Dec 19, 2022
Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.

PhpDeprecationDetector PhpDeprecationDetector - analyzer of PHP code to search usages of deprecated functionality in newer interpreter versions - depr

Sergey 312 Dec 26, 2022
Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.

PhpDeprecationDetector PhpDeprecationDetector - analyzer of PHP code to search usages of deprecated functionality in newer interpreter versions - depr

Sergey 312 Dec 26, 2022
Find forgotten variables dump in PHP source code.

PHP VarDump Check This repository is abandoned. Suggested alternative: https://github.com/php-parallel-lint/PHP-Var-Dump-Check PHP console application

Jakub Onderka 27 Jul 13, 2022
Find forgotten variables dump in PHP source code.

PHP VarDump Check PHP console application for find forgotten variable dump. Support PHP build in method print_r, var_dump and var_export method and al

PHP Parallel lint 13 Jul 13, 2022