Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php /** * @template T */ abstract class A { /** * @var T */ private $v; /** * @param T $v */ final public function __construct($v) { $this->v = $v; } /** * @return static<T> */ public function foo(): A { // If I remove this if statement everythings works fine if ((bool)random_int(0, 1)) { return new static($this->v); } return new static($this->v); } }
Snippet created on January 15 2021 at 21:32 UTC
Settings
Get link