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

[CodeQuality] Handle not identical return false then true on SimplifyIfReturnBoolRector #1969

Merged
merged 13 commits into from
Mar 27, 2022

Conversation

samsonasik
Copy link
Member

Currently, the following code is skipped:

        $docToken = new Token([]);
        if (strpos($docToken->getContent(), "\n") !== false) {
            return false;
        }

        return true;

which should be transformed to:

-        if (strpos($docToken->getContent(), "\n") !== false) {
-            return false;
-        }

-        return true;
+        return strpos($docToken->getContent(), "\n") === false;

@samsonasik
Copy link
Member Author

implemented 🎉

@samsonasik
Copy link
Member Author

It seems make invalid for the following condition:


        if ($firstChar !== $lastChar) {
            return false;
        }

        return in_array($firstChar, self::POSSIBLE_DELIMITERS, true);

I will check.

@samsonasik samsonasik force-pushed the handle-not-identical-return-false-then-true branch from a7ed82e to 0a1ac07 Compare March 27, 2022 12:24
@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik
Copy link
Member Author

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

@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit 82656ad into main Mar 27, 2022
@TomasVotruba TomasVotruba deleted the handle-not-identical-return-false-then-true branch March 27, 2022 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants