[ 'code' => 'baz(); $bar->far(); ', ], 'changeTemplateArguments' => [ 'code' => ' */ public array $data; /** * @param T $data */ public function __construct($data) { $this->data = [$data]; } /** * @template NewT as int * @param NewT $data * * @psalm-this-out self */ public function setData($data): void { /** @psalm-suppress InvalidPropertyAssignmentValue */ $this->data = [$data]; } /** * @template NewT as int * @param NewT $data * * @psalm-this-out self */ public function addData($data): void { /** @psalm-suppress InvalidPropertyAssignmentValue */ $this->data []= $data; } /** * @return list */ public function getData(): array { return $this->data; } } $a = new container(1); $data1 = $a->getData(); $a->setData(2); $data2 = $a->getData(); $a->addData(3); $data3 = $a->getData(); ', 'assertions' => [ '$data1===' => 'list<1>', '$data2===' => 'list<2>', '$data3===' => 'list<2|3>', ], ], 'provideDefaultTypeToTypeArguments' => [ 'code' => <<<'PHP' */ public function __construct() {} /** * @psalm-if-this-is self<'idle'> * @psalm-this-out self<'running'> */ public function start(): void {} } $app = new App(); PHP, 'assertions' => [ '$app===' => "App<'idle'>", ], ], ]; } }