[ ' [ '$a' => 'mixed', ], 'error_levels' => ['MixedAssignment'], ], 'nullCoalesce' => [ ' [ '$a' => 'mixed', ], 'error_levels' => ['MixedAssignment'], ], 'nullCoalesceWithGoodVariable' => [ ' 5 ? "hello" : null; $a = $b ?? null;', 'assertions' => [ '$a' => 'string|null', ], ], 'issetKeyedOffset' => [ ' [ '$foo[\'a\']' => 'mixed', ], 'error_levels' => [], 'scope_vars' => [ '$foo' => \Psalm\Type::getArray(), ], ], 'issetKeyedOffsetORFalse' => [ ' "bar"] : false; if (isset($bar["foo"])) { takesString($bar["foo"]); }', 'assertions' => [], 'error_levels' => ['PossiblyInvalidArrayAccess'], ], 'nullCoalesceKeyedOffset' => [ ' [ '$foo[\'a\']' => 'mixed', ], 'error_levels' => ['MixedAssignment'], 'scope_vars' => [ '$foo' => \Psalm\Type::getArray(), ], ], 'noRedundantConditionOnMixed' => [ ' [], 'error_levels' => ['MixedAssignment', 'MixedArrayAccess'], ], 'testUnset' => [ ' [ ' [ "foo" => "bar", ], "groups" => [ "foo" => "bar", "hide" => rand() % 2 > 0, ], ]; foreach ($arr as $item) { if (!isset($item["hide"]) || !$item["hide"]) {} }', ], 'issetPropertyAffirmsObject' => [ 'id)) { return $a; } return new A(); }', ], 'issetVariableKeysWithoutChange' => [ ' [ ' $arr */ function foo(array $arr) : int { $b = rand(0, 3); if (!isset($arr[$b])) { throw new \Exception("bad"); } return $arr[$b]; }', ], 'issetArrayOffsetConditionalCreationWithInt' => [ ' $arr */ function foo(array $arr) : string { if (!isset($arr[0])) { $arr[0] = "hello"; } return $arr[0]; }', ], 'issetArrayOffsetConditionalCreationWithVariable' => [ ' $arr */ function foo(array $arr) : string { $b = 5; if (!isset($arr[$b])) { $arr[$b] = "hello"; } return $arr[$b]; }', ], 'noExceptionOnBracketString' => [ ' [ 'b)) { return $arr[1]->b; } throw new \Exception("bad"); }', ], 'allowUnknownAdditionToInt' => [ ' [ ' [ ' [ ' [ ' [ ' 'UndefinedMethod', ], 'issetVariableKeysWithChange' => [ ' 'NullArrayAccess', ], 'issetAdditionalVarWithSealedObjectLike' => [ ' "bat"]; if (isset($params[self::FOO])) { return true; } return false; } }', 'error_message' => 'InvalidArrayOffset', ], ]; } }