How is @internal
inheritance supposed to work
#6275
Unanswered
TRowbotham
asked this question in
Q&A
Replies: 1 comment 10 replies
-
That's a good question, however I think having the interface in there just obscures things. To put the question more squarely, should a method, inherited from internal class by a non-internal class be considered internal? (https://psalm.dev/r/963f6d0a52) |
Beta Was this translation helpful? Give feedback.
10 replies
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.
-
Take the following example:
https://psalm.dev/r/724600be11
The abstract
BasicToken
class is labeled as@internal
to indicate that other packages should not extend the class. TheIdentifier
andDelimiter
classes extendBasicToken
and are intended to be consumed by other packages. When the token is typed with theToken
interface, there is no warning reported, however, after checking the type of the token usinginstanceof
, psalm reportsCan
@internal
not be used in this way?Even though
instanceof
validates the token type asIdentifier
orDelimiter
, those classes still implement theToken
interface and thus satisfy the contract, so thegetValue
method should still be non-internal per the interface, no?Beta Was this translation helpful? Give feedback.
All reactions