-
Notifications
You must be signed in to change notification settings - Fork 661
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
Imported types cannot be used as array keys in 5.18.0 #10496
Comments
I found these snippets: https://psalm.dev/r/72f05104ae<?php
/**
* @psalm-type ArrayKeyType array-key
*/
class Bar {}
/**
* @psalm-import-type ArrayKeyType from Bar
* @psalm-type UsesArrayKeyType array<ArrayKeyType, bool>
*/
class Foo {}
|
Yeah, I expected this, since I don't have a complete list of all string-ish types of psalm. This is a good first issue to add the additional types to the conditions there - validate that they are any of the allowed array-key types though |
ging-dev
added a commit
to ging-dev/psalm
that referenced
this issue
Dec 19, 2023
ging-dev
added a commit
to ging-dev/psalm
that referenced
this issue
Dec 19, 2023
ging-dev
added a commit
to ging-dev/psalm
that referenced
this issue
Dec 19, 2023
ging-dev
added a commit
to ging-dev/psalm
that referenced
this issue
Dec 20, 2023
ging-dev
added a commit
to ging-dev/psalm
that referenced
this issue
Dec 20, 2023
Merged
orklah
added a commit
that referenced
this issue
Jan 9, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link: https://psalm.dev/r/72f05104ae
Note that there are no errors in psalm.dev at the time of writing (but it's also running a week-old commit: a75d26a).
Psalm 5.17 reports no errors, while Psalm 5.18 reports:
As far as I can tell
ArrayKeyType
asarray-key
is definitely an okay array key type.The text was updated successfully, but these errors were encountered: