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

Psalm-type messing with generics #8473

Closed
MaximJam opened this issue Dec 6, 2022 · 3 comments
Closed

Psalm-type messing with generics #8473

MaximJam opened this issue Dec 6, 2022 · 3 comments
Labels
Milestone

Comments

@MaximJam
Copy link

MaximJam commented Dec 6, 2022

Bug report

Hello,

I've been trying to fix a project after an update, and a third party added psalm annotations to their classes, which caused some generic template analysis to throw errors.

I've read as much as I could find on the subject with no luck, so I'm asking here.

I could not reproduce the exact issue but here is something similar :
Not working

If I just remove the psalm-type, I've got no more errors.
Working

I've read that phpstan will read psalm annotations since both define generics, and I guess I could always stub the 3rd party to make it work, but I'd rather understand where the problem lies.

I'm sorry for the issue if this is expected behavior, I could not find anything going that way.

And I'd also like to thank all of you for the great work at PhpStan, it's hard to tell the amount of time it saved us, but I know it's substantial.

Have a nice day.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Dec 16, 2022
@phpstan-bot
Copy link
Contributor

@MaximJam After the latest push in 1.10.x, PHPStan now reports different result with your code snippet:

@@ @@
-17: PHPDoc tag @extends contains generic type Paginator<int, AccountEntity> but class Paginator is not generic.
+12: Invalid type definition detected in type alias PagesType.
Full report
Line Error
12 Invalid type definition detected in type alias PagesType.

@phpstan-bot
Copy link
Contributor

@MaximJam After the latest push in 1.10.x, PHPStan now reports different result with your code snippet:

@@ @@
-17: PHPDoc tag @extends contains generic type Paginator<int, AccountEntity> but class Paginator is not generic.
+No errors

@github-actions
Copy link

github-actions bot commented May 6, 2023

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 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants