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

@phpstan-assert-if-true miss when implements #9123

Closed
snapshotpl opened this issue Mar 31, 2023 · 5 comments
Closed

@phpstan-assert-if-true miss when implements #9123

snapshotpl opened this issue Mar 31, 2023 · 5 comments

Comments

@snapshotpl
Copy link

snapshotpl commented Mar 31, 2023

Bug report

When use @phpstan-assert-if-true in interface with template and implementation define type, then @phpstan-assert-if-true doesn't respect given type.

Code snippet that reproduces the problem

https://phpstan.org/r/b546d60e-e115-443a-9dbc-1d5cb757d2de

Expected output

Event type in both cases

@phpstan-bot
Copy link
Contributor

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

@@ @@
+ 3: Declare strict_types must be the very first statement.
 32: Dumped type: T of Event (class EventListener, parameter)
 51: Dumped type: MyEvent
Full report
Line Error
3 Declare strict_types must be the very first statement.
32 Dumped type: T of Event (class EventListener, parameter)
51 Dumped type: MyEvent

@phpstan-bot
Copy link
Contributor

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

@@ @@
+ 3: Declare strict_types must be the very first statement.
 32: Dumped type: T of Event (class EventListener, parameter)
+37: Cannot declare class Implementation because the name is already in use.
 51: Dumped type: MyEvent
Full report
Line Error
3 Declare strict_types must be the very first statement.
32 Dumped type: T of Event (class EventListener, parameter)
37 Cannot declare class Implementation because the name is already in use.
51 Dumped type: MyEvent

@snapshotpl
Copy link
Author

I fixed a little a playground example https://phpstan.org/r/95d2b8a3-4a73-4a82-89ed-70ebef42914a

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2909

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

No branches or pull requests

3 participants