Skip to content

Fix checking empty constant arrays in array function return type extensions#1696

Merged
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
rvanvelzen:constant-array-is-empty
Sep 5, 2022
Merged

Fix checking empty constant arrays in array function return type extensions#1696
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
rvanvelzen:constant-array-is-empty

Conversation

@rvanvelzen
Copy link
Copy Markdown
Contributor

foreach ($constantArrays as $constantArray) {
if ($constantArray->isEmpty()) {
$iterableAtLeastOnce = $constantArray->isIterableAtLeastOnce();
if (!$iterableAtLeastOnce->yes()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The edits in these extensions should be tested too, right :)

@herndlm
Copy link
Copy Markdown
Contributor

herndlm commented Sep 5, 2022

Oh, did I break this? Thx!

@ondrejmirtes
Copy link
Copy Markdown
Member

Yeah, I was a bit suspicious because isEmpty() cannot really be a bool, should be a TrinaryLogic, and the bug is caused by that :)

@ondrejmirtes ondrejmirtes merged commit f129659 into phpstan:1.8.x Sep 5, 2022
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you very much!

@rvanvelzen rvanvelzen deleted the constant-array-is-empty branch September 6, 2022 09:26
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.

False positive "will always evaluate to false" after array_filter and reset

3 participants