,ignored_issues?:list,php_version?:string}> */ public function providerValidCodeParse(): iterable { return [ 'valueOfListClassConstant' => [ 'code' => ' */ public function getKey() { return "bar"; } } ' ], 'valueOfAssociativeArrayClassConstant' => [ 'code' => ' 42 ]; /** @return value-of */ public function getValue() { return 42; } } ' ], 'allValuesOfAssociativeArrayPossible' => [ 'code' => ' 42, "adams" => 43, ]; /** @return value-of */ public function getValue(bool $adams) { if ($adams) { return 42; } return 43; } } ' ], 'valueOfAsArray' => [ 'code' => ' 42, "adams" => 43, ]; /** @return value-of[] */ public function getValues() { return array_values(self::FOO); } } ' ], 'valueOfArrayLiteral' => [ 'code' => '> */ function getKey() { return "42"; } ' ], 'valueOfUnionArrayLiteral' => [ 'code' => '|array> */ function getValue(bool $asFloat) { if ($asFloat) { return 42.0; } return 42; } ' ], 'valueOfStringArrayConformsToString' => [ 'code' => '>[] */ $keys2 = ["foo"]; return $keys2[0]; } ' ], 'acceptLiteralIntInValueOfUnionLiteralInts' => [ 'code' => '|array{0: 3, 1: 4}> */ function getValue(int $i) { if ($i >= 0 && $i <= 4) { return $i; } return 0; } ', ], 'valueOfExpandsPropertiesOf' => [ 'code' => '>> */ function returnPropertyOfA() { return [true, "bar", 42]; } ', ], ]; } /** * @return iterable,php_version?:string}> */ public function providerInvalidCodeParse(): iterable { return [ 'onlyDefinedValuesOfConstantList' => [ 'code' => ' */ public function getValue() { return "adams"; } } ', 'error_message' => 'InvalidReturnStatement' ], 'noIntForValueOfStringArrayLiteral' => [ 'code' => '> */ public function getValue() { return 42; } } ', 'error_message' => 'InvalidReturnStatement' ], 'noStringForValueOfIntList' => [ 'code' => '> */ public function getValue() { return "42"; } } ', 'error_message' => 'InvalidReturnStatement' ], 'noOtherStringAllowedForValueOfKeyedArray' => [ 'code' => ' */ function getValue() { return "adams"; } ', 'error_message' => 'InvalidReturnStatement' ], 'noOtherIntAllowedInValueOfUnionLiteralInts' => [ 'code' => '|array{0: 3, 1: 4}> */ function getValue() { return 5; } ', 'error_message' => 'InvalidReturnStatement' ], ]; } }