,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'nullTypeRemovedAfterNegatedAssertionAgainstArrayOfInt' => [ ' [ ' $y * @return int */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { return $x; } throw new \Exception(); } ', ], 'typeNotChangedAfterAssertionAgainstArrayOfMixed' => [ ' $y * @return int|null */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { throw new \Exception(); } return $x; }', ], 'unionTypeReconciledToUnionTypeOfHaystackValueTypes' => [ ' $y * @return int|string */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { return $x; } throw new \Exception(); } ', ], 'unionTypesReducedToIntersectionWithinAssertion' => [ ' $y * @return int */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { return $x; } throw new Exception(); }', ], 'unionTypesReducedToIntersectionOutsideOfNegatedAssertion' => [ ' $y * @return int */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { throw new Exception(); } return $x; }', ], 'assertInArrayOfNotIntersectingTypeReturnsOriginalTypeOutsideOfAssertion' => [ ' $y * @return int */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { throw new \Exception(); } return $x; }', 'assertions' => [], 'error_level' => ['RedundantConditionGivenDocblockType'], ], 'assertNegatedInArrayOfNotIntersectingTypeReturnsOriginalType' => [ ' $y * @return int */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { return $x; } throw new \Exception(); }', 'assertions' => [], 'error_level' => ['RedundantConditionGivenDocblockType'], ], 'assertAgainstListOfLiteralsAndScalarUnion' => [ ' $y * @return "a"|"b" */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { return $x; } throw new Exception(); }', ], 'assertAgainstListOfLiteralsAndScalarUnionTypeHint' => [ ' $y * @return "a"|"b" */ function assertInArray(string|bool $x, $y) { if (in_array($x, $y, true)) { return $x; } throw new Exception(); }', [], [], '8.0' ], 'in_arrayNullOrString' => [ ' [ ' [ ' [ ' */ public function providerInvalidCodeParse(): iterable { return [ 'typeNotChangedAfterNegatedAssertionAgainstUnsealedArrayOfMixed' => [ ' $y * @return int */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { return $x; } throw new \Exception(); } ', 'error_message' => 'NullableReturnStatement', ], 'typeNotChangedAfterNegatedAssertionAgainstUnsealedArrayOfUnionType' => [ ' $y * @return int */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { return $x; } throw new \Exception(); } ', 'error_message' => 'NullableReturnStatement', ], 'initialTypeRemainsOutsideOfAssertion' => [ ' $y * @return int */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { throw new Exception(); } return $x; }', 'error_message' => 'InvalidReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:11:32 - The inferred type \'bool|int\' does not match the declared return type \'int\' for assertInArray', ], 'initialTypeRemainsWithinTheNegatedAssertion' => [ ' $y * @return int */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { return $x; } throw new Exception(); }', 'error_message' => 'InvalidReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:9:36 - The inferred type \'bool|int\' does not match the declared return type \'int\' for assertInArray', ], 'assertInArrayOfNotIntersectingTypeTriggersTypeContradiction' => [ ' $y * @return int */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { throw new \Exception(); } return $x; }', 'error_message' => 'RedundantConditionGivenDocblockType - src' . DIRECTORY_SEPARATOR . 'somefile.php:8:29 - Docblock-defined type int for $x is never string', ], 'assertNegatedInArrayOfNotIntersectingTypeTriggersRedundantCondition' => [ ' $y * @return int */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { return $x; } throw new \Exception(); }', 'error_message' => 'RedundantConditionGivenDocblockType - src' . DIRECTORY_SEPARATOR . 'somefile.php:8:30 - Docblock-defined type int for $x is never string', ], 'assertInArrayOfNotIntersectingTypeTriggersRedundantCondition' => [ ' $y * @return string */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { return $x; } throw new \Exception(); }', 'error_message' => 'RedundantConditionGivenDocblockType - src' . DIRECTORY_SEPARATOR . 'somefile.php:8:29 - Docblock-defined type int for $x is never string', ], 'assertInArrayOfNotIntersectingTypeReturnsTriggersMixedReturnStatement' => [ ' $y * @return string */ function assertInArray($x, $y) { if (in_array($x, $y, true)) { return $x; } throw new \Exception(); }', 'error_message' => 'MixedReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:9:36 - Could not infer a return type', 'error_levels' => ['RedundantConditionGivenDocblockType'], ], 'assertNegatedInArrayOfNotIntersectingTypeTriggersTypeContradiction' => [ ' $y * @return string */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { throw new \Exception(); } return $x; }', 'error_message' => 'RedundantConditionGivenDocblockType - src' . DIRECTORY_SEPARATOR . 'somefile.php:8:30 - Docblock-defined type int for $x is never string', ], 'assertNegatedInArrayOfNotIntersectingTypeTriggersMixedReturnStatement' => [ ' $y * @return string */ function assertInArray($x, $y) { if (!in_array($x, $y, true)) { throw new \Exception(); } return $x; }', 'error_message' => 'MixedReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:12:32 - Could not infer a return type', 'error_level' => ['RedundantConditionGivenDocblockType'], ], 'inArrayDetectType' => [ ' 'RedundantCondition', ], 'inArrayRemoveInvalid' => [ ' 'RedundantCondition', ], ]; } }