We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
PHP 7.4.16 (cli) (built: Mar 2 2021 14:06:13) ( NTS Visual C++ 2017 x64 ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans
PHP CS Fixer 3.4.0 Si! by Fabien Potencier and Dariusz Ruminski
-vvv
php-cs-fixer fix -vvv --rules=simplified_if_return file.php PHP CS Fixer 3.4.0 Si! by Fabien Potencier and Dariusz Ruminski Runtime: PHP 7.4.16 Loaded config default. Using cache file ".php-cs-fixer.cache". F 1 / 1 (100%) Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error 1) file.php (simplified_if_return) Fixed all files in 0.047 seconds, 12.000 MB memory used
<?php function EqualsAny(string $str, array $letters) : bool { foreach ($letters as $letter) if ($str === $letter) return true; return false; } $str = 'b'; $letters = ['a', 'b']; var_dump(EqualsAny($str, $letters)); //Expected bool(true), Returns bool(true) $letters = []; var_dump(EqualsAny($str, $letters)); //Expected bool(false), Returns bool(false)
<?php function EqualsAny(string $str, array $letters) : bool { foreach ($letters as $letter) return (bool) ($str === $letter) ; } $str = 'b'; $letters = ['a', 'b']; var_dump(EqualsAny($str, $letters)); //Expected bool(true), Returns bool(false) $letters = []; var_dump(EqualsAny($str, $letters)); //Expected bool(false), Returns throws exception!!
Leave the code unchanged.
This is a braces problem, if the code has braces (or if you run --rules=braces,simplified_if_return) the code doesn't change and it's ok.
--rules=braces,simplified_if_return
The text was updated successfully, but these errors were encountered:
thanks for reporting @rodrigoq , proposed fix is here #6266
Sorry, something went wrong.
13f0d2a
Successfully merging a pull request may close this issue.
Bug report
-vvv
)Code snippet that reproduces the problem
Before running PHP CS Fixer
After running PHP CS Fixer
Expected output
Leave the code unchanged.
This is a braces problem, if the code has braces (or if you run
--rules=braces,simplified_if_return
) the code doesn't change and it's ok.The text was updated successfully, but these errors were encountered: