Skip to content

Commit bdfec7c

Browse files
committed
Update build-cs
1 parent 2c7df21 commit bdfec7c

File tree

89 files changed

+1463
-1751
lines changed

Some content is hidden

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

89 files changed

+1463
-1751
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
repository: "phpstan/build-cs"
5858
path: "build-cs"
59-
ref: "1.x"
59+
ref: "2.x"
6060

6161
- name: "Install PHP"
6262
uses: "shivammathur/setup-php@v2"

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lint:
1616
.PHONY: cs-install
1717
cs-install:
1818
git clone https://github.com/phpstan/build-cs.git || true
19-
git -C build-cs fetch origin && git -C build-cs reset --hard origin/1.x
19+
git -C build-cs fetch origin && git -C build-cs reset --hard origin/2.x
2020
composer install --working-dir build-cs
2121

2222
.PHONY: cs

src/Ast/ConstExpr/ConstExprArrayItemNode.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ class ConstExprArrayItemNode implements ConstExprNode
1010

1111
use NodeAttributes;
1212

13-
/** @var ConstExprNode|null */
14-
public $key;
13+
public ?ConstExprNode $key = null;
1514

16-
/** @var ConstExprNode */
17-
public $value;
15+
public ConstExprNode $value;
1816

1917
public function __construct(?ConstExprNode $key, ConstExprNode $value)
2018
{

src/Ast/ConstExpr/ConstExprArrayNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ConstExprArrayNode implements ConstExprNode
1111
use NodeAttributes;
1212

1313
/** @var ConstExprArrayItemNode[] */
14-
public $items;
14+
public array $items;
1515

1616
/**
1717
* @param ConstExprArrayItemNode[] $items

src/Ast/ConstExpr/ConstExprFloatNode.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class ConstExprFloatNode implements ConstExprNode
99

1010
use NodeAttributes;
1111

12-
/** @var string */
13-
public $value;
12+
public string $value;
1413

1514
public function __construct(string $value)
1615
{

src/Ast/ConstExpr/ConstExprIntegerNode.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class ConstExprIntegerNode implements ConstExprNode
99

1010
use NodeAttributes;
1111

12-
/** @var string */
13-
public $value;
12+
public string $value;
1413

1514
public function __construct(string $value)
1615
{

src/Ast/ConstExpr/ConstExprStringNode.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class ConstExprStringNode implements ConstExprNode
2121

2222
use NodeAttributes;
2323

24-
/** @var string */
25-
public $value;
24+
public string $value;
2625

2726
/** @var self::SINGLE_QUOTED|self::DOUBLE_QUOTED */
2827
public $quoteType;

src/Ast/ConstExpr/ConstFetchNode.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ class ConstFetchNode implements ConstExprNode
1010
use NodeAttributes;
1111

1212
/** @var string class name for class constants or empty string for non-class constants */
13-
public $className;
13+
public string $className;
1414

15-
/** @var string */
16-
public $name;
15+
public string $name;
1716

1817
public function __construct(string $className, string $name)
1918
{

src/Ast/ConstExpr/DoctrineConstExprStringNode.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class DoctrineConstExprStringNode extends ConstExprStringNode
1313

1414
use NodeAttributes;
1515

16-
/** @var string */
17-
public $value;
16+
public string $value;
1817

1918
public function __construct(string $value)
2019
{

src/Ast/NodeAttributes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trait NodeAttributes
88
{
99

1010
/** @var array<string, mixed> */
11-
private $attributes = [];
11+
private array $attributes = [];
1212

1313
/**
1414
* @param mixed $value

src/Ast/NodeTraverser.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ final class NodeTraverser
6262
public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4;
6363

6464
/** @var list<NodeVisitor> Visitors */
65-
private $visitors = [];
65+
private array $visitors = [];
6666

6767
/** @var bool Whether traversal should be stopped */
68-
private $stopTraversal;
68+
private bool $stopTraversal;
6969

7070
/**
7171
* @param list<NodeVisitor> $visitors
@@ -151,7 +151,7 @@ private function traverseNode(Node $node): Node
151151
break 2;
152152
} else {
153153
throw new LogicException(
154-
'enterNode() returned invalid value of type ' . gettype($return)
154+
'enterNode() returned invalid value of type ' . gettype($return),
155155
);
156156
}
157157
}
@@ -176,11 +176,11 @@ private function traverseNode(Node $node): Node
176176
} elseif (is_array($return)) {
177177
throw new LogicException(
178178
'leaveNode() may only return an array ' .
179-
'if the parent structure is an array'
179+
'if the parent structure is an array',
180180
);
181181
} else {
182182
throw new LogicException(
183-
'leaveNode() returned invalid value of type ' . gettype($return)
183+
'leaveNode() returned invalid value of type ' . gettype($return),
184184
);
185185
}
186186
}
@@ -237,7 +237,7 @@ private function traverseArray(array $nodes): array
237237
break 2;
238238
} else {
239239
throw new LogicException(
240-
'enterNode() returned invalid value of type ' . gettype($return)
240+
'enterNode() returned invalid value of type ' . gettype($return),
241241
);
242242
}
243243
}
@@ -267,7 +267,7 @@ private function traverseArray(array $nodes): array
267267
break 2;
268268
} else {
269269
throw new LogicException(
270-
'leaveNode() returned invalid value of type ' . gettype($return)
270+
'leaveNode() returned invalid value of type ' . gettype($return),
271271
);
272272
}
273273
}

src/Ast/PhpDoc/AssertTagMethodValueNode.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,18 @@ class AssertTagMethodValueNode implements PhpDocTagValueNode
1111

1212
use NodeAttributes;
1313

14-
/** @var TypeNode */
15-
public $type;
14+
public TypeNode $type;
1615

17-
/** @var string */
18-
public $parameter;
16+
public string $parameter;
1917

20-
/** @var string */
21-
public $method;
18+
public string $method;
2219

23-
/** @var bool */
24-
public $isNegated;
20+
public bool $isNegated;
2521

26-
/** @var bool */
27-
public $isEquality;
22+
public bool $isEquality;
2823

2924
/** @var string (may be empty) */
30-
public $description;
25+
public string $description;
3126

3227
public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality = false)
3328
{

src/Ast/PhpDoc/AssertTagPropertyValueNode.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,18 @@ class AssertTagPropertyValueNode implements PhpDocTagValueNode
1111

1212
use NodeAttributes;
1313

14-
/** @var TypeNode */
15-
public $type;
14+
public TypeNode $type;
1615

17-
/** @var string */
18-
public $parameter;
16+
public string $parameter;
1917

20-
/** @var string */
21-
public $property;
18+
public string $property;
2219

23-
/** @var bool */
24-
public $isNegated;
20+
public bool $isNegated;
2521

26-
/** @var bool */
27-
public $isEquality;
22+
public bool $isEquality;
2823

2924
/** @var string (may be empty) */
30-
public $description;
25+
public string $description;
3126

3227
public function __construct(TypeNode $type, string $parameter, string $property, bool $isNegated, string $description, bool $isEquality = false)
3328
{

src/Ast/PhpDoc/AssertTagValueNode.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,16 @@ class AssertTagValueNode implements PhpDocTagValueNode
1111

1212
use NodeAttributes;
1313

14-
/** @var TypeNode */
15-
public $type;
14+
public TypeNode $type;
1615

17-
/** @var string */
18-
public $parameter;
16+
public string $parameter;
1917

20-
/** @var bool */
21-
public $isNegated;
18+
public bool $isNegated;
2219

23-
/** @var bool */
24-
public $isEquality;
20+
public bool $isEquality;
2521

2622
/** @var string (may be empty) */
27-
public $description;
23+
public string $description;
2824

2925
public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description, bool $isEquality = false)
3026
{

src/Ast/PhpDoc/DeprecatedTagValueNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DeprecatedTagValueNode implements PhpDocTagValueNode
1111
use NodeAttributes;
1212

1313
/** @var string (may be empty) */
14-
public $description;
14+
public string $description;
1515

1616
public function __construct(string $description)
1717
{

src/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ class DoctrineAnnotation implements Node
1111

1212
use NodeAttributes;
1313

14-
/** @var string */
15-
public $name;
14+
public string $name;
1615

1716
/** @var list<DoctrineArgument> */
18-
public $arguments;
17+
public array $arguments;
1918

2019
/**
2120
* @param list<DoctrineArgument> $arguments

src/Ast/PhpDoc/Doctrine/DoctrineArgument.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class DoctrineArgument implements Node
1515

1616
use NodeAttributes;
1717

18-
/** @var IdentifierTypeNode|null */
19-
public $key;
18+
public ?IdentifierTypeNode $key = null;
2019

2120
/** @var ValueType */
2221
public $value;

src/Ast/PhpDoc/Doctrine/DoctrineArray.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class DoctrineArray implements Node
1212
use NodeAttributes;
1313

1414
/** @var list<DoctrineArrayItem> */
15-
public $items;
15+
public array $items;
1616

1717
/**
1818
* @param list<DoctrineArrayItem> $items

src/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ class DoctrineTagValueNode implements PhpDocTagValueNode
1111

1212
use NodeAttributes;
1313

14-
/** @var DoctrineAnnotation */
15-
public $annotation;
14+
public DoctrineAnnotation $annotation;
1615

1716
/** @var string (may be empty) */
18-
public $description;
17+
public string $description;
1918

2019

2120
public function __construct(

src/Ast/PhpDoc/ExtendsTagValueNode.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ class ExtendsTagValueNode implements PhpDocTagValueNode
1111

1212
use NodeAttributes;
1313

14-
/** @var GenericTypeNode */
15-
public $type;
14+
public GenericTypeNode $type;
1615

1716
/** @var string (may be empty) */
18-
public $description;
17+
public string $description;
1918

2019
public function __construct(GenericTypeNode $type, string $description)
2120
{

src/Ast/PhpDoc/GenericTagValueNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class GenericTagValueNode implements PhpDocTagValueNode
1010
use NodeAttributes;
1111

1212
/** @var string (may be empty) */
13-
public $value;
13+
public string $value;
1414

1515
public function __construct(string $value)
1616
{

src/Ast/PhpDoc/ImplementsTagValueNode.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ class ImplementsTagValueNode implements PhpDocTagValueNode
1111

1212
use NodeAttributes;
1313

14-
/** @var GenericTypeNode */
15-
public $type;
14+
public GenericTypeNode $type;
1615

1716
/** @var string (may be empty) */
18-
public $description;
17+
public string $description;
1918

2019
public function __construct(GenericTypeNode $type, string $description)
2120
{

src/Ast/PhpDoc/InvalidTagValueNode.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class InvalidTagValueNode implements PhpDocTagValueNode
1717
use NodeAttributes;
1818

1919
/** @var string (may be empty) */
20-
public $value;
20+
public string $value;
2121

2222
/** @var mixed[] */
23-
private $exceptionArgs;
23+
private array $exceptionArgs;
2424

2525
public function __construct(string $value, ParserException $exception)
2626
{

src/Ast/PhpDoc/MethodTagValueNode.php

+6-9
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,20 @@ class MethodTagValueNode implements PhpDocTagValueNode
1212

1313
use NodeAttributes;
1414

15-
/** @var bool */
16-
public $isStatic;
15+
public bool $isStatic;
1716

18-
/** @var TypeNode|null */
19-
public $returnType;
17+
public ?TypeNode $returnType = null;
2018

21-
/** @var string */
22-
public $methodName;
19+
public string $methodName;
2320

2421
/** @var TemplateTagValueNode[] */
25-
public $templateTypes;
22+
public array $templateTypes;
2623

2724
/** @var MethodTagValueParameterNode[] */
28-
public $parameters;
25+
public array $parameters;
2926

3027
/** @var string (may be empty) */
31-
public $description;
28+
public string $description;
3229

3330
/**
3431
* @param MethodTagValueParameterNode[] $parameters

0 commit comments

Comments
 (0)