Repository navigation
Replies: 1 comment 1 reply
|
Hi @VincentLanglet, thanks for implementing Sorry for the ping. Since you worked on this feature, I was wondering if you could clarify whether the behavior described above is intentional. In particular, should PHPStan verify that every type listed in Thanks! |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Consider the following example:
https://phpstan.org/r/15a71033-265f-47e3-83d6-6a88f1c7d7b3
PHPStan accepts this even though Z does not implement XYZ.
I would expect
@phpstan-sealedto describe the complete set of allowed subtypes ofXYZ. Under that interpretation, every type listed in@phpstan-sealedshould itself be a subtype ofXYZ.In other words, this:
would imply that PHPStan should validate:
and report an error for Z in the example above.
Is the current behavior intentional?
If so, what is the intended semantic meaning of the types listed in @phpstan-sealed? Are they only treated as a whitelist for inheritance/implementation checks, without requiring them to actually be subtypes of the sealed type?
All reactions