Improve the Unknown Type

parent 76ec695a
......@@ -28,6 +28,8 @@ use PhpParser\Node\Stmt\Trait_;
final class Type
{
public const UNKNOWN = 'Unknown';
/**
* @var string
*/
......@@ -49,7 +51,7 @@ final class Type
public static function constructUnknownFromNode(Node $node): self
{
return new self('Unknown (' . get_class($node) . ')');
return new self(self::UNKNOWN, $node);
}
public static function constructVoid(): self
......@@ -129,4 +131,9 @@ final class Type
{
return $this->nestedType;
}
public function getNodeTreeAsJson(): string
{
return $this->ast ? NodeTypeManagerTrait::resolveNodeTreeAsJson($this->ast) : '';
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment