mirror of
https://github.com/danog/phpdoc-parser.git
synced 2025-01-23 06:12:09 +01:00
drop support for complement type
This commit is contained in:
parent
d23d1c922c
commit
7492b2a16e
@ -1,6 +1,5 @@
|
||||
Type
|
||||
::= Atomic (Union | Intersection)?
|
||||
| Complement
|
||||
|
||||
Union
|
||||
::= ('|' Atomic)+
|
||||
@ -8,9 +7,6 @@ Union
|
||||
Intersection
|
||||
::= ('&' Atomic)+
|
||||
|
||||
Complement
|
||||
::= '~' Atomic
|
||||
|
||||
Atomic
|
||||
::= Identifier (Generic | Array)?
|
||||
| '(' Type ')' Array?
|
||||
|
@ -1,6 +1,5 @@
|
||||
Type
|
||||
= Atomic (Union / Intersection)?
|
||||
/ Complement
|
||||
|
||||
Union
|
||||
= ('|' Atomic)+
|
||||
@ -8,9 +7,6 @@ Union
|
||||
Intersection
|
||||
= ('&' Atomic)+
|
||||
|
||||
Complement
|
||||
= '~' Atomic
|
||||
|
||||
Atomic
|
||||
= Identifier (Generic / Array)?
|
||||
/ '(' Type ')' Array?
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PhpStan\TypeParser\Ast;
|
||||
|
||||
|
||||
class ComplementNode implements Node
|
||||
{
|
||||
/** @var Node */
|
||||
public $type;
|
||||
|
||||
|
||||
public function __construct(Node $type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return '~' . $this->type;
|
||||
}
|
||||
}
|
@ -67,18 +67,13 @@ class Parser
|
||||
|
||||
private function parseType(): Ast\Node
|
||||
{
|
||||
if ($this->tokenType === Lexer::TOKEN_COMPLEMENT) {
|
||||
$type = $this->parseComplement();
|
||||
$type = $this->parseAtomic();
|
||||
|
||||
} else {
|
||||
$type = $this->parseAtomic();
|
||||
if ($this->tokenType === Lexer::TOKEN_UNION) {
|
||||
$type = $this->parseUnion($type);
|
||||
|
||||
if ($this->tokenType === Lexer::TOKEN_UNION) {
|
||||
$type = $this->parseUnion($type);
|
||||
|
||||
} elseif ($this->tokenType === Lexer::TOKEN_INTERSECTION) {
|
||||
$type = $this->parseIntersection($type);
|
||||
}
|
||||
} elseif ($this->tokenType === Lexer::TOKEN_INTERSECTION) {
|
||||
$type = $this->parseIntersection($type);
|
||||
}
|
||||
|
||||
return $type;
|
||||
@ -140,13 +135,6 @@ class Parser
|
||||
}
|
||||
|
||||
|
||||
private function parseComplement(): Ast\Node
|
||||
{
|
||||
$this->consume(Lexer::TOKEN_COMPLEMENT);
|
||||
return new Ast\ComplementNode($this->parseAtomic());
|
||||
}
|
||||
|
||||
|
||||
private function parseGeneric(Ast\SimpleNode $baseType): Ast\Node
|
||||
{
|
||||
$this->consume(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
|
||||
|
Loading…
x
Reference in New Issue
Block a user