Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stof opened this issue Feb 28, 2024 · 4 comments
Open

Comments

@stof
Copy link
Contributor

stof commented Feb 28, 2024

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).

phpstan/phpstan-deprecation-rules#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
Copy link
Contributor Author

stof commented Feb 28, 2024

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

@staabm
Copy link
Contributor

staabm commented Mar 5, 2024

the implementation is described in the docs phpstan/phpstan-deprecation-rules@7d78404...27397cd#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R56-R81

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

@stof
Copy link
Contributor Author

stof commented Mar 5, 2024

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

@stof
Copy link
Contributor Author

stof commented Mar 5, 2024

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

  • it should check the class docblock as well (as groups might be defined at the class level too)
  • it should probably apply only in classes extending PHPUnit\Framework\TestCase as this @group legacy has an effect only in tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants