Skip to content

Improved handling of class_alias

Choose a tag to compare

@muglug muglug released this 21 Dec 22:14

Fixes #1135, where a user had problems with a Laravel-based project that made heavy use of class_alias. Also fixed an issue (in the same ticket) reasoning about arrays that had been passed by reference to a function. Thanks to @josephzidell for his enormous patience as I tracked down the various Psalm bugs he stumbled upon.

Also fixed an issue where Psalm would not properly inherit a param type if a signature type was also given, e.g. here:

interface I {
  /** @param string[] $f */
  function foo(array $f) : void {}
}

class C implements I {
  /** @var string[] */
  private $f = [];
  
  /**
   * {@inheritdoc}
   */
  public function foo(array $f) : void {
    $this->f = $f; // Psalm thought $f was array<mixed, mixed>
  }
}

Psalm will now bypass the signature check if @inheritdoc is present in the docblock.