Skip to content

Commit 8633125

Browse files
committed
Type::toPhpDocNode()
1 parent e5793df commit 8633125

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+927
-5
lines changed

phpstan-baseline.neon

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,11 @@ parameters:
993993
count: 3
994994
path: src/Type/Generic/TemplateConstantIntegerType.php
995995

996+
-
997+
message: "#^Method PHPStan\\\\Type\\\\Generic\\\\TemplateConstantIntegerType\\:\\:toPhpDocNode\\(\\) should return PHPStan\\\\PhpDocParser\\\\Ast\\\\Type\\\\ConstTypeNode but returns PHPStan\\\\PhpDocParser\\\\Ast\\\\Type\\\\IdentifierTypeNode\\.$#"
998+
count: 1
999+
path: src/Type/Generic/TemplateConstantIntegerType.php
1000+
9961001
-
9971002
message: "#^Doing instanceof PHPStan\\\\Type\\\\IntersectionType is error\\-prone and deprecated\\.$#"
9981003
count: 3
@@ -1150,7 +1155,7 @@ parameters:
11501155

11511156
-
11521157
message: "#^Doing instanceof PHPStan\\\\Type\\\\Accessory\\\\AccessoryType is error\\-prone and deprecated\\. Use methods on PHPStan\\\\Type\\\\Type instead\\.$#"
1153-
count: 2
1158+
count: 3
11541159
path: src/Type/IntersectionType.php
11551160

11561161
-

src/Type/Accessory/AccessoryArrayListType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\TrinaryLogic;
79
use PHPStan\Type\AcceptsResult;
810
use PHPStan\Type\BooleanType;
@@ -472,4 +474,9 @@ public function exponentiate(Type $exponent): Type
472474
return new ErrorType();
473475
}
474476

477+
public function toPhpDocNode(): TypeNode
478+
{
479+
return new IdentifierTypeNode('list');
480+
}
481+
475482
}

src/Type/Accessory/AccessoryLiteralStringType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\TrinaryLogic;
79
use PHPStan\Type\AcceptsResult;
810
use PHPStan\Type\BenevolentUnionType;
@@ -333,4 +335,9 @@ public function exponentiate(Type $exponent): Type
333335
]);
334336
}
335337

338+
public function toPhpDocNode(): TypeNode
339+
{
340+
return new IdentifierTypeNode('literal-string');
341+
}
342+
336343
}

src/Type/Accessory/AccessoryNonEmptyStringType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\TrinaryLogic;
79
use PHPStan\Type\AcceptsResult;
810
use PHPStan\Type\BenevolentUnionType;
@@ -338,4 +340,9 @@ public function exponentiate(Type $exponent): Type
338340
]);
339341
}
340342

343+
public function toPhpDocNode(): TypeNode
344+
{
345+
return new IdentifierTypeNode('non-empty-string');
346+
}
347+
341348
}

src/Type/Accessory/AccessoryNonFalsyStringType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\TrinaryLogic;
79
use PHPStan\Type\AcceptsResult;
810
use PHPStan\Type\BenevolentUnionType;
@@ -329,4 +331,9 @@ public function exponentiate(Type $exponent): Type
329331
]);
330332
}
331333

334+
public function toPhpDocNode(): TypeNode
335+
{
336+
return new IdentifierTypeNode('non-falsy-string');
337+
}
338+
332339
}

src/Type/Accessory/AccessoryNumericStringType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\TrinaryLogic;
79
use PHPStan\Type\AcceptsResult;
810
use PHPStan\Type\BenevolentUnionType;
@@ -340,4 +342,9 @@ public function exponentiate(Type $exponent): Type
340342
]);
341343
}
342344

345+
public function toPhpDocNode(): TypeNode
346+
{
347+
return new IdentifierTypeNode('numeric-string');
348+
}
349+
343350
}

src/Type/Accessory/HasMethodType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace PHPStan\Type\Accessory;
44

5+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
6+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
57
use PHPStan\Reflection\ClassMemberAccessAnswerer;
68
use PHPStan\Reflection\Dummy\DummyMethodReflection;
79
use PHPStan\Reflection\ExtendedMethodReflection;
@@ -193,4 +195,9 @@ public static function __set_state(array $properties): Type
193195
return new self($properties['methodName']);
194196
}
195197

198+
public function toPhpDocNode(): TypeNode
199+
{
200+
return new IdentifierTypeNode(''); // no PHPDoc representation
201+
}
202+
196203
}

src/Type/Accessory/HasOffsetType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\TrinaryLogic;
79
use PHPStan\Type\AcceptsResult;
810
use PHPStan\Type\BooleanType;
@@ -366,4 +368,9 @@ public static function __set_state(array $properties): Type
366368
return new self($properties['offsetType']);
367369
}
368370

371+
public function toPhpDocNode(): TypeNode
372+
{
373+
return new IdentifierTypeNode(''); // no PHPDoc representation
374+
}
375+
369376
}

src/Type/Accessory/HasOffsetValueType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace PHPStan\Type\Accessory;
44

55
use PHPStan\Php\PhpVersion;
6+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
7+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
68
use PHPStan\ShouldNotHappenException;
79
use PHPStan\TrinaryLogic;
810
use PHPStan\Type\AcceptsResult;
@@ -422,4 +424,9 @@ public static function __set_state(array $properties): Type
422424
return new self($properties['offsetType'], $properties['valueType']);
423425
}
424426

427+
public function toPhpDocNode(): TypeNode
428+
{
429+
return new IdentifierTypeNode(''); // no PHPDoc representation
430+
}
431+
425432
}

src/Type/Accessory/HasPropertyType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace PHPStan\Type\Accessory;
44

5+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
6+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
57
use PHPStan\Reflection\ClassMemberAccessAnswerer;
68
use PHPStan\Reflection\TrivialParametersAcceptor;
79
use PHPStan\TrinaryLogic;
@@ -155,4 +157,9 @@ public static function __set_state(array $properties): Type
155157
return new self($properties['propertyName']);
156158
}
157159

160+
public function toPhpDocNode(): TypeNode
161+
{
162+
return new IdentifierTypeNode(''); // no PHPDoc representation
163+
}
164+
158165
}

0 commit comments

Comments
 (0)