Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

!array_key_exists() should imply array for PHP8+ #4417

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

Merged
ondrejmirtes merged 14 commits into phpstan:2.1.x from staabm:arr-key
Oct 16, 2025

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 7, 2025
edited
Loading

@staabm staabm marked this pull request as ready for review October 7, 2025 08:06
Copy link
Collaborator

This pull request has been marked as ready for review.

throw new \RuntimeException('Absolute URLs are prohibited for the redirectTo parameter.');
}

assertType('array{scheme?: string, host?: string, port?: int<0, 65535>, user?: string, pass?: string, path?: string, query?: string, fragment?: string}', $parsedUrl);
Copy link
Contributor Author

@staabm staabm Oct 7, 2025
edited
Loading

Choose a reason for hiding this comment

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

in this case we got more preicse, because we no longer have a union array{...}|false but just the plain array-shape.
but on the other hand we no longer know that the 'host' offset cannot exist at this point.

I tried several variants, but wasn't successfull in combining the specified types in a way which turns the mixed into array while also removing the offset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured it out

@staabm staabm force-pushed the arr-key branch 4 times, most recently from e479f0e to cebec02 Compare October 12, 2025 07:49
Copy link
Contributor Author

staabm commented Oct 12, 2025
edited
Loading

Memo for me: add test for the issue-bot report

Edit: ✅

@ondrejmirtes ondrejmirtes merged commit bab0af7 into phpstan:2.1.x Oct 16, 2025
541 of 551 checks passed
Copy link
Member

Thank you!

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

!array_key_exists() should imply array for PHP8+ Creating new array on mixed[] should be allowed if key does not exist.

AltStyle によって変換されたページ (->オリジナル) /