[ ' [ '$a' => 'string|null', ], ], 'nullableReturnTypeInDocblock' => [ ' [ '$a' => 'null|string', ], ], 'nullableArgument' => [ ' [ ' [ ' [ ' [ ' [ '$id1' => 'int', '$name1' => 'string', '$id2' => 'int', '$name2' => 'string', ], ], 'arrayDestructuringInForeach' => [ ' [ ' 1, "name" => "Tom"], ["id" => 2, "name" => "Fred"], ]; // list() style list("id" => $id1, "name" => $name1) = $data[0]; // [] style ["id" => $id2, "name" => $name2] = $data[1];', 'assertions' => [ '$id1' => 'int', '$name1' => 'string', '$id2' => 'int', '$name2' => 'string', ], ], 'arrayListDestructuringInForeachWithKeys' => [ ' 1, "name" => "Tom"], ["id" => 2, "name" => "Fred"], ]; $last_id = null; $last_name = null; // list() style foreach ($data as list("id" => $id, "name" => $name)) { $last_id = $id; $last_name = $name; }', 'assertions' => [ '$last_id' => 'null|int', '$last_name' => 'null|string', ], ], 'arrayDestructuringInForeachWithKeys' => [ ' 1, "name" => "Tom"], ["id" => 2, "name" => "Fred"], ]; $last_id = null; $last_name = null; // [] style foreach ($data as ["id" => $id, "name" => $name]) { $last_id = $id; $last_name = $name; }', 'assertions' => [ '$last_id' => 'null|int', '$last_name' => 'null|string', ], ], 'iterableArg' => [ ' $iter */ function iterator(iterable $iter): void { foreach ($iter as $val) { // } } iterator([1, 2, 3, 4]); iterator(new SplFixedArray(5));', ], 'traversableObject' => [ ' [ ' [ ' [ ' 'InaccessibleClassConstant', ], 'invalidPrivateClassConstFetchFromSubclass' => [ ' 'InaccessibleClassConstant', ], 'invalidProtectedClassConstFetch' => [ ' 'InaccessibleClassConstant', ], 'invalidIterableArg' => [ ' $iter */ function iterator(iterable $iter): void { foreach ($iter as $val) { // } } class A { } iterator(new A());', 'error_message' => 'InvalidArgument', ], ]; } }