Skip to content

Commit 49fc85b

Browse files
committed
traverse accepts null
1 parent 88121a9 commit 49fc85b

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

‎.github/workflows/docblock_check.yaml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ jobs:
3838
-
3939
name: Instrument sources
4040
run: |
41-
honestype instrument src
42-
honestype instrument rules
41+
honestype instrument src rules tests
4342
4443
# Load the helper for every PHP process, including any parallel test
4544
# workers which do not inherit a -d auto_prepend_file flag.

‎rules/Php70/Rector/List_/EmptyListRector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getNodeTypes(): array
5151
/**
5252
* @param List_ $node
5353
*/
54-
public function refactor(Node $node): ?Node
54+
public function refactor(Node $node): ?List_
5555
{
5656
foreach ($node->items as $item) {
5757
if ($item instanceof ArrayItem) {

‎src/PhpParser/NodeTraverser/RectorNodeTraverser.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,11 @@ private function traverseNode(Node $node): void
198198
}
199199

200200
/**
201-
* @param Node[] $nodes
201+
* @param array<Node|null> $nodes The null can be in case of empty list(, , )
202202
* @return Node[]
203203
*/
204204
private function traverseArray(array $nodes): array
205205
{
206-
Assert::allIsInstanceOf($nodes, Node::class);
207-
208206
$doNodes = [];
209207
foreach ($nodes as $i => $node) {
210208
if (! $node instanceof Node) {

0 commit comments

Comments
 (0)