Skip to content

Understand at least one argument for non empty array unpacked #4134

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
merged 2 commits into from
Jul 21, 2025

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jul 20, 2025

@@ -188,6 +188,16 @@ public function check(
$arg->getStartLine(),
];
}

if (count($arguments) === 0 && $type->isIterableAtLeastOnce()->yes()) {
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 happen when the constant array is non-empty but all the keys are optional.

@ondrejmirtes ondrejmirtes merged commit 4941982 into phpstan:2.1.x Jul 21, 2025
414 of 419 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.

Method ::load() invoked with 0 parameters, at least 1 required. Non empty array treated as empty when unpacking it as function arguments
2 participants