Skip to content

Don't crash analysis on wrongly typed argument values - #365

Merged
staabm merged 3 commits into
phpstan:2.1.xfrom
staabm:fix-crash
Nov 27, 2026
Merged

staabm merged 3 commits into
phpstan:2.1.xfrom
staabm:fix-crash

Conversation

@staabm

@staabm staabm commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

closes #364
similar to #363

@staabm
staabm marked this pull request as ready for review November 27, 2026 06:48
@staabm

staabm commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

//cc @SanderMuller

$versionRequirement = $args[0];
// named arguments are handled just to make sure we don't crash on them.
$versionRequirement = $args[0] ?? $args['versionRequirement'] ?? null;
if (!is_string($versionRequirement)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we don't handle other argument types, because phpstan-src will verify types already.
just skip everything invalid

@staabm
staabm merged commit f4a0b7b into phpstan:2.1.x Nov 27, 2026
114 checks passed
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.

crash on int arguments

1 participant