,ignored_issues?:list}> */ public function providerValidCodeParse(): iterable { return [ 'functionParameterNoViolation' => [ 'code' => ' [ 'code' => ' 5) { $str = null; } }', ], 'trackFunctionReturnRefs' => [ 'code' => 'foo; } } function useString(string &$s) : void {} $a = new A(); useString($a->getString());', ], 'makeByRefUseMixed' => [ 'code' => ' [], 'ignored_issues' => ['MixedArgument'], ], 'assignByRefToMixed' => [ 'code' => ' [], 'ignored_issues' => [ 'MixedAssignment', 'MixedArrayAccess', 'MixedReturnStatement', 'MixedInferredReturnType', 'MixedOperand', ], ], 'paramOutRefineType' => [ 'code' => ' [ 'code' => ' [ '$a' => 'int', ], ], 'paramOutReturn' => [ 'code' => ' [ '$b' => 'bool', ], ], 'dontChangeThis' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ',php_version?:string}> */ public function providerInvalidCodeParse(): iterable { return [ 'functionParameterViolation' => [ 'code' => ' 'ReferenceConstraintViolation', ], 'classMethodParameterViolation' => [ 'code' => 'foo = &$foo; $foo = "hello"; } } $bar = 5; $a = new A($bar); // $bar is constrained to an int $bar = null; // ReferenceConstraintViolation issue emitted', 'error_message' => 'ReferenceConstraintViolation', ], 'classMethodParameterViolationInPostAssignment' => [ 'code' => 'foo = &$foo; } } $bar = 5; $a = new A($bar); $bar = null;', 'error_message' => 'ReferenceConstraintViolation', ], 'contradictoryReferenceConstraints' => [ 'code' => 'foo = &$foo; } } class B { /** @var string */ private $bar; public function __construct(string &$bar) { $this->bar = &$bar; } } if (rand(0, 1)) { $v = 5; $c = (new A($v)); // $v is constrained to an int } else { $v = "hello"; $c = (new B($v)); // $v is constrained to a string } $v = 8;', 'error_message' => 'ConflictingReferenceConstraint', ], 'invalidDocblockForBadAnnotation' => [ 'code' => ' $ar */ function foo(array &$ar) : void {}', 'error_message' => 'InvalidDocblock', ], 'preventTernaryPassedByReference' => [ 'code' => ' 'InvalidPassByReference', ], 'SKIPPED-referenceToTypedArrayConstrainsAssignment' => [ 'code' => ' */ public array $arr = []; public function __construct() { assert(isset($this->arr[0])); $int = &$this->arr[0]; $int = (string) $int; } } ', 'error_message' => 'ReferenceConstraintViolation', ], 'SKIPPED-referenceToTypedArrayConstrainsAssignmentWithNullReferenceInitialization' => [ 'code' => ' */ public array $arr = []; public function __construct() { $int = &$this->arr[0]; // If $this->arr[0] isn\'t set, this will set it to null. } } ', 'error_message' => 'PossiblyInvalidPropertyAssignmentValue', ], ]; } }