[ ' [ '$b' => 'null|stdClass', ], 'error_levels' => ['RedundantCondition'], ], 'byrefNoRedundantCondition' => [ ' [ ' [ ' [ 'foo) {} break; default: break; } }', ], 'noRedundantConditionTypeReplacementWithDocblock' => [ ' [ ' [], 'error_levels' => ['PossiblyUndefinedGlobalVariable'], ], 'noRedundantConditionAfterFromDocblockRemoval' => [ 'foo() || $a->bar()) {}', ], 'noEmptyUndefinedArrayVar' => [ ' [], 'error_levels' => ['MixedAssignment', 'MixedArrayAccess'], ], 'noComplaintWithIsNumericThenIsEmpty' => [ ' [ ' 0) { throw new RuntimeException("Failed"); } $value = new stdClass(); if (rand() % 2 > 0) { throw new RuntimeException("Failed"); } } catch (Exception $e) { if ($value) { var_export($value); } } if ($value) {} }', ], 'noRedundantConditionInFalseCheck' => [ ' [ 'next) {} } }', ], 'noRedundantConditionComparingBool' => [ ' [ ' [ ' 'RedundantCondition', ], 'ifNotTrue' => [ ' 'RedundantCondition', ], 'ifTrue' => [ ' 'RedundantCondition', ], 'unnecessaryInstanceof' => [ 'fooFoo(); }', 'error_message' => 'RedundantCondition', ], 'failedTypeResolution' => [ ' 'RedundantCondition', ], 'failedTypeResolutionWithDocblock' => [ ' 'RedundantCondition', ], 'typeResolutionFromDocblockAndInstanceof' => [ ' 'RedundantCondition', ], 'typeResolutionRepeatingConditionWithSingleVar' => [ ' 5; if ($a && $a) {}', 'error_message' => 'RedundantCondition', ], 'typeResolutionRepeatingConditionWithVarInMiddle' => [ ' 5; $b = rand(0, 10) > 5; if ($a && $b && $a) {}', 'error_message' => 'RedundantCondition', ], 'typeResolutionIsIntAndIsNumeric' => [ ' 5 ? "hello" : 3; if (is_int($c) && is_numeric($c)) {}', 'error_message' => 'RedundantCondition', ], 'typeResolutionWithInstanceOfAndNotEmpty' => [ ' 5 ? new stdClass : null; if ($x instanceof stdClass && $x) {}', 'error_message' => 'RedundantCondition', ], 'methodWithMeaninglessCheck' => [ 'fooFoo(); } }', 'error_message' => 'RedundantCondition', ], 'SKIPPED-twoVarLogicNotNestedWithElseifNegatedInIf' => [ ' 'RedundantCondition', ], 'refineTypeInMethodCall' => [ ' 'RedundantCondition - src/somefile.php:15', ], ]; } }