mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Create a virtual ClassConstFetch when encountering a TLiteralClassString
This commit is contained in:
parent
ffbdaa80b1
commit
a1c4ece7bd
@ -6,6 +6,7 @@ use PhpParser;
|
|||||||
use Psalm\Internal\Scanner\ParsedDocblock;
|
use Psalm\Internal\Scanner\ParsedDocblock;
|
||||||
use Psalm\Node\Expr\VirtualArray;
|
use Psalm\Node\Expr\VirtualArray;
|
||||||
use Psalm\Node\Expr\VirtualArrayItem;
|
use Psalm\Node\Expr\VirtualArrayItem;
|
||||||
|
use Psalm\Node\Expr\VirtualClassConstFetch;
|
||||||
use Psalm\Node\Expr\VirtualConstFetch;
|
use Psalm\Node\Expr\VirtualConstFetch;
|
||||||
use Psalm\Node\Expr\VirtualVariable;
|
use Psalm\Node\Expr\VirtualVariable;
|
||||||
use Psalm\Node\Name\VirtualFullyQualified;
|
use Psalm\Node\Name\VirtualFullyQualified;
|
||||||
@ -331,6 +332,10 @@ class StubsGenerator
|
|||||||
public static function getExpressionFromType(Type\Union $type) : PhpParser\Node\Expr
|
public static function getExpressionFromType(Type\Union $type) : PhpParser\Node\Expr
|
||||||
{
|
{
|
||||||
foreach ($type->getAtomicTypes() as $atomic_type) {
|
foreach ($type->getAtomicTypes() as $atomic_type) {
|
||||||
|
if ($atomic_type instanceof Type\Atomic\TLiteralClassString) {
|
||||||
|
return new VirtualClassConstFetch(new VirtualName($atomic_type->value), new VirtualIdentifier('class'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($atomic_type instanceof Type\Atomic\TLiteralString) {
|
if ($atomic_type instanceof Type\Atomic\TLiteralString) {
|
||||||
return new VirtualString($atomic_type->value);
|
return new VirtualString($atomic_type->value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user