*/ public function providerValidCodeParse(): array { return [ 'addPureAnnotationToFunction' => [ 'i = $i; } public function getPlus5() { return $this->i + 5; } }', 'i = $i; } public function getPlus5() { return $this->i + 5; } }', '7.4', ['MissingImmutableAnnotation'], true, ], 'addPureAnnotationToFunctionWithExistingDocblock' => [ 'i = $i; } public function getPlus5() { return $this->i + 5; } }', 'i = $i; } public function getPlus5() { return $this->i + 5; } }', '7.4', ['MissingImmutableAnnotation'], true, ], 'dontAddPureAnnotationWhenMethodHasImpurity' => [ 'i = $i; } public function getPlus5() { echo $this->i; return $this->i + 5; } }', 'i = $i; } public function getPlus5() { echo $this->i; return $this->i + 5; } }', '7.4', ['MissingImmutableAnnotation'], true, ], 'addPureAnnotationWhenClassCanHoldMutableData' => [ 'b = $b; } public function getPlus5() { return $this->b->i + 5; } } $b = new B(); $a = new A($b); echo $a->getPlus5(); $b->i = 6; echo $a->getPlus5();', 'b = $b; } public function getPlus5() { return $this->b->i + 5; } } $b = new B(); $a = new A($b); echo $a->getPlus5(); $b->i = 6; echo $a->getPlus5();', '7.4', ['MissingImmutableAnnotation'], true, ], 'addPureAnnotationToClassThatExtends' => [ 'i = $i; } public function mutate() : void { echo "hello"; } } class A extends AParent { public function getPlus5() { return $this->i + 5; } }', 'i = $i; } public function mutate() : void { echo "hello"; } } class A extends AParent { public function getPlus5() { return $this->i + 5; } }', '7.4', ['MissingImmutableAnnotation'], true, ], ]; } }