Skip to content

Fix internal error with named DataProvider arguments - #363

Merged
staabm merged 3 commits into
phpstan:2.1.xfrom
MohannadElemary:fix/named-data-provider-argument
Nov 26, 2026
Merged

staabm merged 3 commits into
phpstan:2.1.xfrom
MohannadElemary:fix/named-data-provider-argument

Conversation

@MohannadElemary

Copy link
Copy Markdown
Contributor

#[DataProvider(methodName: 'provideValues')] crashes the analysis with bleedingEdge on (strcasecmp(): null given), because the reflection reader assumes the argument is at key 0.

This reads the provider name from either 0 or methodName and skips non-string values. I added a regression case to the EmptyDataProviderRule fixture that checks an empty provider referenced by a named argument is still reported.

Tests and PHPStan passed locally across all 46 build.yml matrix configurations, and the reported crash reproduces before the fix and is gone after it with PHPUnit 10 and 13.

Fixes #361.

@staabm
staabm merged commit df82e59 into phpstan:2.1.x Nov 26, 2026
113 checks passed
@staabm

staabm commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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.

Internal error in EmptyDataProviderRule with a named argument in #[DataProvider] (2.1.3)

2 participants