qossmic / deprecation-detector

MIT License
390 stars 40 forks source link

No violations found #131

Open placid2000 opened 7 years ago

placid2000 commented 7 years ago

I installed deprecation-detector on dev-master and I'm on Symfony 2.8

When I run sh bin/deprecation-detector check src/ vendor/ or sh bin/deprecation-detector check src/ .rules or sh bin/deprecation-detector check src/, it says

There are no violations - congratulations!

Even that there are a lot of deprecations! For some reason it doesn't find any.. Did I miss anything ?

slde-robin commented 7 years ago

Can you run it in verbose mode ?

placid2000 commented 7 years ago

I run : ./bin/deprecation-detector check src/ --verbose

Result: Deprecation detection: 261/261Finished searching for deprecations.

Rendering output...

Finished rendering output.

There are no violations - congratulations! Checked 261 source files in 39.297 seconds, 94 MB memory used

Here is just one example of deprecation in the Entity folder it should have found since addViolationAt is deprecated: $context->addViolationAt('financingPlan', 'Kosten dürfen nicht leer sein');

achasseux commented 6 years ago

I have the same behavior, this tool already returns There are no violations - congratulations!

MarvinKlemp commented 6 years ago

is the project open source ? So I can try to recreate the issue ?

achasseux commented 6 years ago

The issue comes from an incompatibility with phpdocumentor/reflection-docblock versions. In your composer.json, you have mentioned "phpdocumentor/reflection-docblock": "~2.0 || ~3.0 || ~4.0"

But in your Visitor into hasDeprecatedDocComment() or getDeprecatedDocComment(), you create the DocBlock in an old way : $docBlock = new DocBlock((string) $node->getDocComment());

The new way for last version of phpdocumentor/reflection-docblock should be like this : $docBlock = (DocBlockFactory::createInstance())->create((string) $node->getDocComment());

I have installed your detector with version 4.2 of reflection-docblock.

Voltash commented 6 years ago

I had the same problem with Symfony 2.8 I disabled cache and then the command started working correctly.

php deprecation-detector.phar check src/ vendor/ --no-cache

Also works if manually set cache dir

php deprecation-detector.phar check src/ vendor/ --cache-dir=app/cache

MarvinKlemp commented 6 years ago

@achasseux do you want to create a pr and fix it ?

achasseux commented 6 years ago

@MarvinKlemp I can work on this issue next week, not before I 'm OK to create a PR