Troubleshooting of Sonar issue: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
Line 68: Line 68:
             throw new InvalidArgumentException($error);
             throw new InvalidArgumentException($error);
         }
         }
</pre>
== How to resolve "Merge this if statement with the enclosing one." ==
Example of Code Not Meeting Standards
<pre>
if (isTrueCondition1) {
  if (isTrueCondition2) {
    ...
  }
}
</pre>
Example of Code Meeting Standards
<pre>
if (isTrueCondition1 && isTrueCondition2) {
  ...
}
</pre>
Example of Code Not Meeting Standards
<pre>
if (isTrueCondition1) {
  if (isTrueCondition2) {
    ...
  }
  if (isTrueCondition3) {
    ...
  }
}
</pre>
Example of Code Meeting Standards
<pre>
if (isTrueCondition1 && isTrueCondition2) {
    ...
}
if (isTrueCondition1 && isTrueCondition3) {
    ...
}
</pre>
</pre>


Anonymous user

Navigation menu