-
-
Couldn't load subscription status.
- Fork 933
Open
Description
Bug report
Problem:
PHPStan's @Property annotation correctly narrows the type for public properties, but fails to apply the same narrowing for protected or private properties.
Actual Behavior:
- Public properties: The
@propertyint $a annotation successfully narrowsint|string$a to int - Protected/Private properties: The
@propertyint $a annotation is ignored, and PHPStan infers the type asint|string
Code snippet that reproduces the problem
https://phpstan.org/r/c354ca2f-f42a-4194-99b1-f43aed7cd1e7
Expected output
The @Property annotation should narrow the property type regardless of the property's visibility (public, protected, or private).
Did PHPStan help you today? Did it make you happy in any way?
No response
Metadata
Metadata
Assignees
Labels
No labels