Code example:
<?php
$weakErrors = 0;
$criticalErrors = 0;
if ($weakErrors > 0 || $criticalErrors > 0) {
LogService::info('Starting processing errors');
if ($weakErrors > 0) {
// Some actions about weak errors
}
if ($criticalErrors > 0) {
// Some ANOTHER actions about critical errors
}
LogService::info('Errors processing finished');
}
Inspection result:

Because it is really duplicated in another branch. The best solution for cases like that is you store it to a variable then reuse that. It should not affects performance too much (about 0.000001%, maybe).
@rentalhost yes, you right. But from my point of view, it's a bit another type of duplication, so I reported it. If it is not a bug, then ok, I will just live with it :)
Hmm... Well, if $criticalErrors variable was changed in mid time, I should agree with you if this warning is happening. But in this case, I think that is okay create a variable to store it ($hasCriticalErrors = $criticalErrors > 0, for instance).
Let see what @kalessil will think about that.
@rentalhost I thnik @kalessil will disable this inspection =)) There are a lot of edge cases
IMO logging should happen inside inner if-s:
The goal is clearer split responsibilities, somehow the warning and @erickskrauch intention are pointing to mixed up responsibilities.