Skip to content

Conversation

VincentLanglet
Copy link
Contributor

I feel like we should only check for AllowedArrayKeysTypes since others types are checked by InvalidArrayKey rule.

],
[
'*ERROR*',
'mixed',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change revert the one in #4272

28,
],
[
'Offset int|object might not exist on array|string.',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error was added by #4272

It make sens to not have it since

  • int is a valid offset and produce no error
  • object is not a valid offset (and produce a php crash) and is already reported by the InvalidArrayOffsetRule.

12,
],
[
'Offset object does not exist on array<string, int>.',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, already reported by InvalidArrayOffsetRule and this was added by #4272

@VincentLanglet
Copy link
Contributor Author

The 7.4 failure already exists on 2.1.x https://github.com/phpstan/phpstan-src/actions/runs/17398668843/job/49386473327

@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

"ignorable": true
},
{
"message": "Offset stdClass does not exist on array{baz: 21}|array{foo: 17, bar: 19}.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're losing these useful errors. What are they replaced with?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already (above)

Invalid array key type stdClass.

@ondrejmirtes ondrejmirtes merged commit fca060b into phpstan:2.1.x Sep 2, 2025
448 of 455 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants