Skip to content

Commit 1ae8d74

Browse files
committed
Add missing typehints
1 parent 0138dd9 commit 1ae8d74

11 files changed

+38
-3
lines changed

Diff for: src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __toString(): string
4545
return sprintf('"%s"', $this->escapeDoubleQuotedString());
4646
}
4747

48-
private function escapeDoubleQuotedString()
48+
private function escapeDoubleQuotedString(): string
4949
{
5050
$quote = '"';
5151
$escaped = addcslashes($this->value, "\n\r\t\f\v$" . $quote . '\\');

Diff for: src/Ast/PhpDoc/InvalidTagValueNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(string $value, ParserException $exception)
3535
];
3636
}
3737

38-
public function __get(string $name)
38+
public function __get(string $name): ?ParserException
3939
{
4040
if ($name !== 'exception') {
4141
trigger_error(sprintf('Undefined property: %s::$%s', self::class, $name), E_USER_WARNING);

Diff for: src/Ast/PhpDoc/MethodTagValueNode.php

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class MethodTagValueNode implements PhpDocTagValueNode
3030
/** @var string (may be empty) */
3131
public $description;
3232

33+
/**
34+
* @param MethodTagValueParameterNode[] $parameters
35+
* @param TemplateTagValueNode[] $templateTypes
36+
*/
3337
public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description, array $templateTypes = [])
3438
{
3539
$this->isStatic = $isStatic;

Diff for: src/Ast/Type/ArrayShapeNode.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ArrayShapeNode implements TypeNode
2323
public $kind;
2424

2525
/**
26+
* @param ArrayShapeItemNode[] $items
2627
* @param self::KIND_* $kind
2728
*/
2829
public function __construct(array $items, bool $sealed = true, string $kind = self::KIND_ARRAY)

Diff for: src/Ast/Type/CallableTypeNode.php

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class CallableTypeNode implements TypeNode
1919
/** @var TypeNode */
2020
public $returnType;
2121

22+
/**
23+
* @param CallableTypeParameterNode[] $parameters
24+
*/
2225
public function __construct(IdentifierTypeNode $identifier, array $parameters, TypeNode $returnType)
2326
{
2427
$this->identifier = $identifier;

Diff for: src/Ast/Type/GenericTypeNode.php

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class GenericTypeNode implements TypeNode
2525
/** @var (self::VARIANCE_*)[] */
2626
public $variances;
2727

28+
/**
29+
* @param TypeNode[] $genericTypes
30+
* @param (self::VARIANCE_*)[] $variances
31+
*/
2832
public function __construct(IdentifierTypeNode $type, array $genericTypes, array $variances = [])
2933
{
3034
$this->type = $type;

Diff for: src/Ast/Type/IntersectionTypeNode.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class IntersectionTypeNode implements TypeNode
1313
/** @var TypeNode[] */
1414
public $types;
1515

16+
/**
17+
* @param TypeNode[] $types
18+
*/
1619
public function __construct(array $types)
1720
{
1821
$this->types = $types;

Diff for: src/Ast/Type/ObjectShapeNode.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class ObjectShapeNode implements TypeNode
1313
/** @var ObjectShapeItemNode[] */
1414
public $items;
1515

16+
/**
17+
* @param ObjectShapeItemNode[] $items
18+
*/
1619
public function __construct(array $items)
1720
{
1821
$this->items = $items;

Diff for: src/Ast/Type/UnionTypeNode.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class UnionTypeNode implements TypeNode
1313
/** @var TypeNode[] */
1414
public $types;
1515

16+
/**
17+
* @param TypeNode[] $types
18+
*/
1619
public function __construct(array $types)
1720
{
1821
$this->types = $types;

Diff for: tests/PHPStan/Parser/PhpDocParserTest.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,9 @@ public function provideSingleLinePhpDocData(): Iterator
25872587
];
25882588
}
25892589

2590-
2590+
/**
2591+
* @return array<mixed>
2592+
*/
25912593
public function provideMultiLinePhpDocData(): array
25922594
{
25932595
return [
@@ -5275,6 +5277,9 @@ public function provideDescriptionWithOrWithoutHtml(): Iterator
52755277
];
52765278
}
52775279

5280+
/**
5281+
* @return array<mixed>
5282+
*/
52785283
public function dataParseTagValue(): array
52795284
{
52805285
return [
@@ -5517,6 +5522,9 @@ public function testNegatedAssertionToString(): void
55175522
$this->assertSame('@phpstan-assert !Type $param', $assertNode->__toString());
55185523
}
55195524

5525+
/**
5526+
* @return array<mixed>
5527+
*/
55205528
public function dataLinesAndIndexes(): iterable
55215529
{
55225530
yield [

Diff for: tests/PHPStan/Parser/TypeParserTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public function testParse(string $input, $expectedResult, int $nextTokenType = L
7979
}
8080

8181

82+
/**
83+
* @return array<mixed>
84+
*/
8285
public function provideParseData(): array
8386
{
8487
return [
@@ -1905,6 +1908,9 @@ public function provideParseData(): array
19051908
];
19061909
}
19071910

1911+
/**
1912+
* @return array<mixed>
1913+
*/
19081914
public function dataLinesAndIndexes(): iterable
19091915
{
19101916
yield [

0 commit comments

Comments
 (0)