,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'worksAfterConvert' => [ 'convert(); $f->test(); ' ], 'withTemplate' => [ 'state = $state; } /** * @param string $name * @param mixed $val * @psalm-if-this-is Foo * @return void */ public function set($name, $val) { } /** * @return Foo */ public function freeze() { /** @var Foo */ $f = clone $this; return $f; } } $f = new Foo(new Unfrozen()); $f->set("asd", 10); ' ], 'subclass' => [ 'test(); ' ] ]; } /** * @return array */ public function providerInvalidCodeParse(): iterable { return [ 'failsWithWrongTemplate1' => [ 'data = $data; } /** * @psalm-if-this-is a */ public function test(): void { } } $i = new a("test"); $i->test(); ', 'error_message' => 'IfThisIsMismatch' ], 'failsWithWrongTemplate2' => [ 'state = $state; } /** * @param string $name * @param mixed $val * @psalm-if-this-is Foo * @return void */ public function set($name, $val) {} /** * @return Foo */ public function freeze() { /** @var Foo */ $f = clone $this; return $f; } } $f = new Foo(new Unfrozen()); $f->set("asd", 10); $g = $f->freeze(); $g->set("asd", 20); // Fails ', 'error_message' => 'IfThisIsMismatch' ], ]; } }