1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix add in missing property in LSP mode

This commit is contained in:
Brown 2018-11-15 18:09:57 -05:00
parent 50cb2bb92a
commit 766f33d6e4
2 changed files with 34 additions and 0 deletions

View File

@ -80,6 +80,13 @@ class Properties
return true;
}
if ($calling_method_id) {
$this->file_reference_provider->addReferenceToClassMethod(
$calling_method_id,
strtolower($fq_class_name) . '::$' . $property_name
);
}
return false;
}

View File

@ -759,6 +759,33 @@ class TemporaryUpdateTest extends \Psalm\Tests\TestCase
],
'error_positions' => [[197], []],
],
'fixMissingProperty' => [
[
[
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
namespace Foo;
class A {
public function foo() : void {
echo $this->bar;
}
}',
],
[
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '<?php
namespace Foo;
class A {
/** @var string */
private $bar = "hello";
public function foo() : void {
echo $this->bar;
}
}',
],
],
'error_positions' => [[192, 192], []],
],
];
}
}