Skip to content

Commit c7c00bb

Browse files
theofidrymattstaufferbakerkretzmar
authored
Fix code for PHP8.1 (#617)
* Replace iterable with Traversable Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com> * Add new Symfony command output to test snapshot expectations Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com> * Update Composer dependencies Co-Authored-By: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com> * Fix error reported by PHPStan Co-authored-by: Matt Stauffer <matt@tighten.co> Co-authored-by: Jacob Baker-Kretzmar <18192441+bakerkretzmar@users.noreply.github.com>
2 parents 9aa7488 + e302979 commit c7c00bb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/PhpParser/NodeVisitor/NamespaceStmt/NamespaceStmtCollection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use PhpParser\Node;
2222
use PhpParser\Node\Name;
2323
use PhpParser\Node\Stmt\Namespace_;
24+
use Traversable;
25+
2426
use function count;
2527
use function end;
2628

@@ -105,7 +107,7 @@ private function getNodeNamespaceName(Node $node): ?Name
105107
return $this->getNodeNamespaceName($parentNode);
106108
}
107109

108-
public function getIterator(): iterable
110+
public function getIterator(): Traversable
109111
{
110112
return new ArrayIterator($this->nodes);
111113
}

src/PhpParser/NodeVisitor/UseStmt/UseStmtCollection.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
use PhpParser\Node\Stmt\Function_;
2929
use PhpParser\Node\Stmt\Use_;
3030
use PhpParser\Node\Stmt\UseUse;
31+
use Traversable;
32+
3133
use function array_key_exists;
3234
use function count;
3335
use function implode;
@@ -108,9 +110,9 @@ public function findStatementForNode(?Name $namespaceName, Name $node): ?Name
108110
}
109111

110112
/**
111-
* @return iterable<string, list<Use_[]>>
113+
* @return Traversable<string, list<Use_[]>>
112114
*/
113-
public function getIterator(): iterable
115+
public function getIterator(): Traversable
114116
{
115117
return new ArrayIterator($this->nodes);
116118
}

0 commit comments

Comments
 (0)