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

Final annotation forces now excludes_analyse #3427

Closed
dereuromark opened this issue Jun 9, 2020 · 5 comments
Closed

Final annotation forces now excludes_analyse #3427

dereuromark opened this issue Jun 9, 2020 · 5 comments

Comments

@dereuromark
Copy link
Contributor

Bug report

We have now several classes we extend that are now failing in PHPStan
And apparently, one cannot ignoreErrors that one, but must use excludes_analyse here.

Code snippet that reproduces the problem

/**
 * Represents a template filter.
 *
 * @final
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class TwigFilter

and

use Twig\TwigFilter as BaseTwigFilter;

class TwigFilter extends BaseTwigFilter

Resulting in

  12     Class Spryker\Shared\Twig\TwigFilter extends final class  
         Twig\TwigFilter.   

Expected output

We would like to ignore this annotation for the time being until we can upgrade away from it.
At the same time we don't want to excludes_analyse the whole class as everything else in there still would be nice to have analyzed.

Is there a way we can add a softer way to exclude this without throwing out the whole file?
Like some config flag?

@mergeable
Copy link

mergeable bot commented Jun 9, 2020

This bug report is missing a link to reproduction on phpstan.org.
It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

This was never supposed to be reported. Fixed: phpstan/phpstan-src@3b2c806

@b1rdex
Copy link
Contributor

b1rdex commented Jun 10, 2020

Wow. I felt embarrassed reporting this and just excluded the file from the analysis... Glad this is fixed 😅

I suppose this should be reported on some high level. Usually @final is used to denote that class became final or is going to be final in the future versions. It's used to not break BC.

It'd be perfect to distinguish between real final class extension and @final to allow ignoring of the latter.

@ondrejmirtes
Copy link
Member

Reporting extending @final is too opinionated, for example for @deprecated there's https://github.com/phpstan/phpstan-deprecation-rules so we'd need something similar :) The rule with the bug is supposed to report only things that PHP itself crashes on.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants