,error_levels?:string[]}> */ public function providerValidCodeParse() { return [ 'assertArrayReturnTypeNarrowed' => [ ' [ ' [ ' [ 'format("Y-m-d"); } }', ], 'assertCheckOnNonZeroArrayOffset' => [ ' [ ' $arr */ function uriToPath(array $arr) : string { if (!isset($arr["a"]) || $arr["b"] !== "foo") { throw new \InvalidArgumentException("bad"); } return (string) $arr["c"]; }', ], 'combineAfterLoopAssert' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' 0; }', ], 'assertHasArrayAccess' => [ ' [ '> $array * @return array */ function getBar(array $array) : array { if (isset($array[\'foo\'][\'bar\'])) { return $array[\'foo\']; } return []; }', ], 'assertHasArrayAccessOnSimpleXMLElement' => [ 'bar)) {} }', ], 'assertArrayOffsetToTraversable' => [ ' [ ' [ ' [ ' $arr * @return non-empty-array */ function foo(array $arr) : array { if (isset($arr["a"])) { return $arr; } return ["b" => 1]; }' ], 'setArrayConstantOffset' => [ ' [ ' $arr */ function foo(A $a, array $arr): void { if (!isset($arr[$a->id])) { $arr[$a->id] = new B(); } $arr[$a->id]->foo(); }' ], 'assertAfterNotEmptyArrayCheck' => [ ' [ 'c[$s]) && empty($this->c[$t])) {} } }' ], 'assertNotEmptyTwiceOnStaticPropertyArray' => [ ' [ ' [ ' [ ' [ 'arr[0])) { return $this->arr[0]; } $this->arr[0] = new stdClass; return $this->arr[0]; } }' ], 'assertArrayKeyExistsRefinesType' => [ ' */ public const DAYS = [ 1 => "mon", 2 => "tue", 3 => "wed", 4 => "thu", 5 => "fri", 6 => "sat", 7 => "sun", ]; /** @param key-of $dayNum*/ private static function doGetDayName(int $dayNum): string { return self::DAYS[$dayNum]; } /** @throws LogicException */ public static function getDayName(int $dayNum): string { if (! array_key_exists($dayNum, self::DAYS)) { throw new \LogicException(); } return self::doGetDayName($dayNum); } }' ], 'assertPropertiesOfElseStatement' => [ 'a === "foo") { } elseif ($obj->b === "bar") { } else if ($obj->b === "baz") {} if ($obj->b === "baz") {} }' ], 'assertPropertiesOfElseifStatement' => [ 'a === "foo") { } elseif ($obj->b === "bar") { } elseif ($obj->b === "baz") {} if ($obj->b === "baz") {} }' ], 'assertArrayWithOffset' => [ ' [ ' [ ' [ 'foo();', [ '$a' => 'bool', ] ], 'SKIPPED-assertVarRedefinedInOpWithOr' => [ 'foo();', [ '$a' => 'bool', ] ], 'SKIPPED-assertVarRedefinedInIfWithAnd' => [ ' [ ' [ ' [ 'foo(); } }' ], 'assertOnArrayThings' => [ '> */ $a = null; if (isset($a["b"]) || isset($a["c"])) { $all_params = ($a["b"] ?? []) + ($a["c"] ?? []); }' ] ]; } }