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

PHPDoc inline in new anonymous class creation causes Internal Error #3661

Closed
dbrekelmans opened this issue Jul 23, 2020 · 2 comments
Closed

Comments

@dbrekelmans
Copy link

dbrekelmans commented Jul 23, 2020

Bug report

PHPDoc inline in new anonymous class creation causes Internal Error.

The use-case is adding a @psalm-immutable annotation to an anonymous class extending an immutable class as is described in the psalm documentation: https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-immutable.

/** @psalm-immutable */
abstract class Foo {
}

new /** @psalm-immutable */ class extends Foo {
};

Using the --debug option prints:

PHP Fatal error:  Uncaught PHPStan\ShouldNotHappenException: Internal error. in phar:///application/vendor/phpstan/phpstan/phpstan/src/Rules/Generics/ClassTemplateTypeRule.php:36

Code snippet that reproduces the problem

https://phpstan.org/r/6a77347f-d037-4793-a23a-a477f4b110c7

Expected output

No errors!

@ondrejmirtes
Copy link
Member

@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 14, 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

Successfully merging a pull request may close this issue.

2 participants