Skip to content
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

[Php71] Skip iterable on CountOnNullRector #1691

Merged
merged 2 commits into from
Jan 17, 2022

Conversation

samsonasik
Copy link
Member

Given the following code:

final class SkipOnIterable
{
    private function findAll(): iterable
    {
        return [];
    }

    public function run()
    {
        return count($this->findAll());
    }
}

It currently produce:

-        return count($this->findAll());
+        return is_array($this->findAll()) || $this->findAll() instanceof \Countable ? count($this->findAll()) : 0;

which should be skipped.

@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba TomasVotruba merged commit bf2f6dd into main Jan 17, 2022
@TomasVotruba TomasVotruba deleted the skip-count-on-null-iterable branch January 17, 2022 11:05
@TomasVotruba
Copy link
Member

Thanks 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants