Describe the bug When an object (in my case a class field) is assigned, the documented type is replaced in that scope, even when the object has an explicit type already declared. This is a regression as this did not happen in prior versions.
To Reproduce
class A
{
/** int */
public $b;
}
class B
{
/** A */
private $a;
private function replace() { return "test"; }
public function __construct()
{
$this->a->b; // shows proper type info
$this->a = $this->replace();
// $this->a now shows as "string"
}
}
Expected behavior Since $a has an explicit documentation, assignments should not replace the type. In a polymorphic/factory-based system, the base class will often be returned instead of the specific subclass being created, and this prevents immediate typing from working properly.
Platform and version Win10 x64, Intelliphense 2.3.13
该提问来源于开源项目:bmewburn/vscode-intelephense