phpstan / phpstan-symfony

Symfony extension for PHPStan
MIT License
698 stars 89 forks source link

Remove reporting of deprecated method calls in tests flagged as `@group legacy` #383

Open stof opened 6 months ago

stof commented 6 months ago

symfony/phpunit-bridge defines a convention where adding @group legacy on a test (either by adding it on the method or on the class as PHPUnit considers that a @group added on a class applies to all tests defined in that class) disables the reporting of deprecations in that test, as this test is about covering the legacy behavior (and so using deprecated APIs is expected).

https://github.com/phpstan/phpstan-deprecation-rules/pull/99 has added an extension point allowing to implement such feature. It would be great to provide an implementation of the interface following this convention.

stof commented 6 months ago

This was initially requested in https://github.com/phpstan/phpstan-deprecation-rules/issues/64, which end up introducing the needed extension point. But solving this entirely actually require using the extension point, not just introducing it.

staabm commented 6 months ago

the implementation is described in the docs https://github.com/phpstan/phpstan-deprecation-rules/compare/7d7840458a6df74a8890a0f1bf192c682148912d...27397cd9b1aff47824d5ccfe7e0c2a4ada8eb6d2#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R56-R81

so your request is to ship this documented default impl with the phpstan-symfony extension?

stof commented 6 months ago

Yes. As this is a Symfony convention, it might make sense to ship it in phpstan-symfony automatically.

stof commented 6 months ago

Note that the shipped implementation should be a little more involved IMO: