Menu

#2 New check : unnecessary conditionals

Accepted
nobody
None
Medium
Task
2011-01-25
2011-01-25
Anonymous
No

Originally created by: tch...@hotmail.com
Originally owned by: tch...@hotmail.com

Check for unnecessary conditionals.

Exemple 1 :
if(true) {
// do something
}

Exemple 2 :
if($a) {
// do something
}

Where $a il always true.

Exemple 3 :
if($a == $b) {
  return true;
} else {
  return false;
}

Could be simplified to return ($a == $b)

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.