We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://psalm.dev/r/97ea41c274 — an example.
Currently Psalm reports EmptyArrayAccess error in the first part of the code above, while the second part is OK.
EmptyArrayAccess
Bit they are equivalent, the first one just uses short assignment via ??= operator. So no errors should be reported.
??=
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php /** @var array<array{parcel_id: string, location_id: string}> */ $matches = []; $bestMatches = []; foreach ($matches as $match) { $bestMatches[$match['parcel_id']] ??= $match['location_id']; } foreach ($matches as $match) { $bestMatches[$match['parcel_id']] = $bestMatches[$match['parcel_id']] ?? $match['location_id']; }
Psalm output (using commit 8926f1d): ERROR: EmptyArrayAccess - 8:5 - Cannot access value on empty array variable $bestMatches
Sorry, something went wrong.
04bcc32
Thanks a lot!
No branches or pull requests
https://psalm.dev/r/97ea41c274 — an example.
Currently Psalm reports
EmptyArrayAccess
error in the first part of the code above, while the second part is OK.Bit they are equivalent, the first one just uses short assignment via
??=
operator. So no errors should be reported.The text was updated successfully, but these errors were encountered: