
Co-authored-by: Amélie Renard <44666826+amelie-renard-sonarsource@users.noreply.github.com>
27 lines
585 B
Plaintext
27 lines
585 B
Plaintext
[source,php]
|
|
----
|
|
if ($condition)
|
|
firstActionInBlock();
|
|
secondAction(); // Noncompliant: secondAction is executed unconditionally
|
|
thirdAction();
|
|
----
|
|
|
|
[source,php]
|
|
----
|
|
if($condition) firstActionInBlock(); secondAction(); // Noncompliant: secondAction is executed unconditionally
|
|
----
|
|
|
|
[source,php]
|
|
----
|
|
if($condition) firstActionInBlock(); // Noncompliant
|
|
secondAction(); // Executed unconditionally
|
|
----
|
|
|
|
[source,php]
|
|
----
|
|
$str = null;
|
|
for ($i = 0; $i < count($array); $i++)
|
|
$str = $array[$i];
|
|
doTheThing($str); // Noncompliant: executed only on the last element
|
|
----
|