qossmic / deprecation-detector

MIT License
392 stars 40 forks source link

Dependency conflict #144

Open sanpii opened 6 years ago

sanpii commented 6 years ago

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
TomasVotruba commented 6 years ago

Shameless plug: you might like @rectorphp