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:
parent
50cb2bb92a
commit
766f33d6e4
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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], []],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user