Tag reference
@self-out
The @self-out tag documents the refined type of $this after a method call, letting callers see a narrower object type than the one they started with.
Grammar
"@phpstan-self-out" <Type> [ <Description> ]"@self-out" <Type> [ <Description> ]"@phpstan-this-out" <Type> [ <Description> ]"@psalm-self-out" <Type> [ <Description> ]"@psalm-this-out" <Type> [ <Description> ]Examples
/** * @phpstan-self-out self<T> */public function add(mixed $item): void/** * @phpstan-this-out static<T> */public function push(mixed $item): void/** * @psalm-self-out self<int> */public function useIntegers(): void/** * @psalm-this-out static<string> */public function useStrings(): voidNames by platform
- phpstan
@phpstan-self-out@phpstan-this-out- psalm
@psalm-self-out@psalm-this-out