-
Notifications
You must be signed in to change notification settings - Fork 144
[CLEANUP] Improve type annotations in LineName
#1198
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
Conversation
d3fd1c5
to
a054bb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a query about array<Type>
. I had assumed that they keys would default to array-key
, but can't find anything in the PHPStan docs.
@@ -12,7 +12,7 @@ | |||
class LineName extends ValueList | |||
{ | |||
/** | |||
* @param array<int, Value|string> $components | |||
* @param array<Value|string> $components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this weaken the type specification, also allowing strings as array keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does. As far as I can see, the array keys are not used, and hence it doesn't matter if string or int array keys are passed in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Yes, that's my assumption, too. ( |
@@ -12,7 +12,7 @@ | |||
class LineName extends ValueList | |||
{ | |||
/** | |||
* @param array<int, Value|string> $components | |||
* @param array<Value|string> $components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
No description provided.