,error_levels?:string[]}> */ public function providerValidCodeParse() { 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() { return [ 'blocksWithoutConvert' => [ 'test(); ', 'error_message' => 'IfThisIsMismatch' ], 'failsWithWrongTemplate' => [ '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' ], ]; } }