Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 20, 2021

@staabm
Copy link
Contributor Author

staabm commented Sep 20, 2021

Build error is unrelated

@staabm staabm marked this pull request as draft September 20, 2021 22:19
@staabm staabm marked this pull request as ready for review September 21, 2021 05:02
@staabm staabm changed the title report error on multi-dimensional array given to implode() Added ImplodeFunctionRule Sep 22, 2021
return [];
}

if ($arrayType->getIterableValueType()->toString() instanceof ErrorType) {
Copy link
Member

Choose a reason for hiding this comment

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

We should also employ RuleLevelHelper::findTypeToCheck so that partially-wrong unions aren't reported until level 7.

Ther are many usages of that method, look through the codebase.

Copy link
Contributor Author

@staabm staabm Sep 22, 2021

Choose a reason for hiding this comment

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

adjusted. seems to work. does this require some kind of unit-test?

I am not sure yet, which case this new logic supports, which the previous didn't.

Copy link
Member

Choose a reason for hiding this comment

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

Check out LevelsIntegrationTest, add something in acceptTypes.php, and re-run this test case. The JSON snapshots will be updated.

Copy link
Contributor Author

@staabm staabm Sep 22, 2021

Choose a reason for hiding this comment

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

thx, I guess it works now.

@ondrejmirtes ondrejmirtes merged commit be79bce into phpstan:master Sep 22, 2021
@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.

Implode should error out when the second argument is a multidimensional array
3 participants