[ 'code' => 'getMessage(); }', ], 'rethrowInterfaceExceptionWithoutInvalidThrow' => [ 'code' => ' [ 'code' => ' [ '$worked' => 'bool', ], ], 'alwaysReturnsBecauseCatchDoesNothing' => [ 'code' => ' [ 'code' => ' [ 'code' => 'getMessage(); // do nothing here either } finally { return true; } }', ], 'stopAnalysisAfterBadTryIssue' => [ 'code' => 'bar(); } catch (\TypeError $e) { $foo = false; } if (!$foo) {}', 'assertions' => [], 'ignored_issues' => [ 'UndefinedGlobalVariable', 'MixedMethodCall', ], ], 'issetAfterTryCatchWithoutAssignmentInCatch' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => 'getMessage();', ], 'varSetInOnlyCatchWithNull' => [ 'code' => 'getMessage();', ], 'allowDoubleNestedLoop' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => 'end = null; }', ], 'returnsInTry' => [ 'code' => 'property) { return $arg; } try { return $arg; } finally { } } }', ], 'finallyArgMaybeUndefined' => [ 'code' => 'startTransaction(); try { $this->workThatMayOrMayNotThrow(); $success = true; } finally { $this->endTransaction($success ?? false); } } private function workThatMayOrMayNotThrow(): void {} }', ], 'finallyArgIsNotUndefinedIfSet' => [ 'code' => ' [ 'code' => ' [ 'code' => ' * @psalm-suppress MixedAssignment */ function fetchFromCache(mixed $m) { $data = []; try { $value = $m; } catch (Throwable $e) { $value = $m; } $data[] = $value; return $data; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'issetInCatch' => [ 'code' => ' [ 'code' => ' [ 'code' => ' 'InvalidCatch', ], 'invalidThrowClass' => [ 'code' => ' 'InvalidThrow', ], 'theresNoCatch' => [ 'code' => ' 'InvalidReturnType', ], 'catchDoesNotReturn' => [ 'code' => ' 'InvalidReturnType', ], 'catchWithNoReturnAndFinallyDoesNotReturn' => [ 'code' => 'getMessage(); // do nothing here either } finally { } }', 'error_message' => 'InvalidReturnType', ], 'catchWithNoReturnAndNoFinally' => [ 'code' => 'getMessage(); // do nothing here either } }', 'error_message' => 'InvalidReturnType', ], 'preventPossiblyUndefinedVarInTry' => [ 'code' => ' 'PossiblyUndefinedGlobalVariable', ], 'possiblyNullReturnInTry' => [ 'code' => ' 'NullableReturnStatement', ], 'isAlwaysDefinedInFinally' => [ 'code' => ' 'RedundantCondition', ], ]; } }