Created
March 22, 2016 11:13
-
-
Save rtuin/f4b3de6fae6645ba35a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($someArray as $value) { | |
if (isSomething($value)) { | |
$output->writeln("It's true!"); | |
} else { | |
$output->writeln("It's false!"); | |
} | |
} | |
// phpmd: The method x uses an else expression. Else is never necessary and you can simplify the code to work without else. | |
// Oh sure, let me refactor that! | |
foreach ($someArray as $value) { | |
if (isSomething($value)) { | |
$output->writeln("It's true!"); | |
continue; | |
} | |
$output->writeln("It's false!"); | |
} | |
// Meh... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cheat!
$output->writeln(isSomething($value) ? "It's true!" : "It's false!");