mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Don't migrate virtual nodes (#5780)
* Add a failing test for issue #5002 * Don't try to migrate virtual nodes Fixes #5002
This commit is contained in:
parent
9eda9f9bbf
commit
d82f02879c
@ -30,6 +30,7 @@ use Psalm\Issue\UnusedConstructor;
|
||||
use Psalm\Issue\UnusedMethod;
|
||||
use Psalm\Issue\UnusedProperty;
|
||||
use Psalm\IssueBuffer;
|
||||
use Psalm\Node\VirtualNode;
|
||||
use Psalm\Progress\Progress;
|
||||
use Psalm\Progress\VoidProgress;
|
||||
use Psalm\Storage\ClassLikeStorage;
|
||||
@ -1198,6 +1199,9 @@ class ClassLikes
|
||||
bool $force_change = false,
|
||||
bool $was_self = false
|
||||
) : bool {
|
||||
if ($class_name_node instanceof VirtualNode) {
|
||||
return false;
|
||||
}
|
||||
$calling_fq_class_name = $source->getFQCLN();
|
||||
|
||||
// if we're inside a moved class static method
|
||||
|
@ -708,6 +708,41 @@ class ClassMoveTest extends \Psalm\Tests\TestCase
|
||||
'Bar\Bat' => 'Bar\Baz\Bahh',
|
||||
],
|
||||
],
|
||||
'moveClassBewareOfPropertyNotSetInConstructorCheck' => [
|
||||
'<?php
|
||||
namespace Foo {
|
||||
class Base
|
||||
{
|
||||
protected $property1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->property1 = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Foo {
|
||||
class Hello extends Base {}
|
||||
}',
|
||||
'<?php
|
||||
namespace Foo {
|
||||
class Base
|
||||
{
|
||||
protected $property1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->property1 = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Foo\Bar {
|
||||
class Hello extends \Foo\Base {}
|
||||
}',
|
||||
[
|
||||
'Foo\Hello' => 'Foo\Bar\Hello',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user