,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'orWithAssignment' => [ ' 4 ? "test" : null; } function test(): string { $foo = maybeString(); ($foo !== null) || ($foo = ""); return $foo; }' ], 'andWithAssignment' => [ ' 4 ? "test" : null; } function test(): string { $foo = maybeString(); ($foo === null) && ($foo = ""); return $foo; }' ], 'assertHardConditionalWithString' => [ 'maybeConvert($value)) === null || !$value->isValid()) { throw new Exception(); } return $value; // $value is SomeObject here and cannot be a string }' ], 'assertOnRemainderOfArray' => [ ' [ ' [ 'foo();', [ '$a' => 'bool', ] ], 'assertVarRedefinedInOpWithOr' => [ 'foo();', [ '$a' => 'bool', ] ], 'assertVarInOrAfterAnd' => [ ' [ ' [ 'foo(); } }' ], 'definedInConditionalAndCheckedInSubbranch' => [ 'foo(); } } }' ], 'definedInRhsOfConditionalInNegation' => [ 'foo(); } }' ], 'definedInOrRHS' => [ 'foo(); }' ], 'possiblyDefinedVarInAssertion' => [ 'test()) { return; } echo isset($a); }' ], 'applyTruthyAssertionsToRightHandSideOfAssignment' => [ ' [ 'c)) { // do something } else { /** @psalm-suppress MixedMethodCall */ $a->foo(); } }' ], 'allowBasicOrAssignment' => [ ' [ 'function test(int $x = null): int { \assert($x || ($x = rand(0, 10))); return $x; }' ], 'noParadoxicalConditionAfterTwoAssignments' => [ ' [ ' [ ' [ ' 5) { echo "hello"; } elseif ($row = (rand(0, 10) ? [5] : null)) { echo $row[0]; }', ], 'ifNotEqualsFalse' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' 5) { } elseif (($a = rand(0, 1) ? new A : null) && $a->foo) {}', ], 'noParadoxAfterConditionalAssignment' => [ ' [ ' */ public function providerInvalidCodeParse(): iterable { return [ 'assignmentInBranchOfAnd' => [ ' 'InvalidReturnStatement', ], ]; } }