,ignored_issues?:list,php_version?:string}> */ public function providerValidCodeParse(): iterable { return [ 'updateReferencedTypes' => [ 'code' => ' [ '$a===' => '2', '$b===' => '4', '$c===' => '4', ], ], 'SKIPPED-referenceToArrayItemChangesArrayType' => [ 'code' => ' */ $arr = []; assert(isset($arr[0])); $int = &$arr[0]; $int = (string) $int; ', 'assertions' => [ '$arr' => 'list', ], ], 'referenceToReference' => [ 'code' => ' [ '$a===' => '2', '$b===' => '3', '$c===' => '2', '$d===' => '3', ], ], 'referenceToSubsequentCatch' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ '$a===' => 'null', '$b===' => 'null', ], ], 'referenceShadowedByGlobal' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ',php_version?:string}> */ public function providerInvalidCodeParse(): iterable { return [ 'referenceReuseForeachValue' => [ 'code' => ' */ $arr = []; foreach ($arr as &$var) { $var += 1; } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referenceReuseDeclaredInForeach' => [ 'code' => ' */ $arr = []; foreach ($arr as $val) { $var = &$val; $var += 1; } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referenceReuseDeclaredInFor' => [ 'code' => ' */ $arr = []; for ($i = 0; $i < count($arr); ++$i) { $var = &$arr[$i]; $var += 1; } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referenceReuseDeclaredInIf' => [ 'code' => ' */ $arr = []; if (isset($arr[0])) { $var = &$arr[0]; $var += 1; } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referenceReuseDeclaredInElseif' => [ 'code' => ' */ $arr = []; if (random_int(0, 1)) { } elseif (isset($arr[0])) { $var = &$arr[0]; $var += 1; } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referenceReuseDeclaredInElse' => [ 'code' => ' */ $arr = []; if (!isset($arr[0])) { } else { $var = &$arr[0]; $var += 1; } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referenceReuseDeeplyNested' => [ 'code' => '>> */ $arr = []; for ($i = 0; $i < count($arr); ++$i) { foreach ($arr[$i] as $inner_arr) { if (isset($inner_arr[0])) { $var = &$inner_arr[0]; $var += 1; } } } $var = "foo"; ', 'error_message' => 'ReferenceReusedFromConfusingScope', ], 'referencesIgnoreVarAnnotation' => [ 'code' => ' 'InvalidDocblock - src' . DIRECTORY_SEPARATOR . 'somefile.php:4:21 - Docblock type cannot be used for reference assignment', ], 'unsetOnlyPreventsReferenceConfusionAfterCall' => [ 'code' => ' 'ReferenceReusedFromConfusingScope', ], 'assignmentAsReferenceOnlyPreventsReferenceConfusionAfterAssignment' => [ 'code' => ' 'ReferenceReusedFromConfusingScope', ], ]; } }