Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit d00a20a

Browse files
committed
Add extra type guard in AcceptsMockTypes
1 parent 5ac896a commit d00a20a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Type/AcceptsMockTypes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpParser\Node\Arg;
88
use PhpParser\Node\Expr\Array_;
9+
use PhpParser\Node\Expr\ArrayItem;
910
use PhpParser\Node\Expr\ClassConstFetch;
1011
use PhpParser\Node\Name;
1112
use PHPStan\Analyser\Scope;
@@ -39,6 +40,10 @@ private function getClassListFromMockTypesArg(
3940
$classes = [];
4041

4142
foreach ($argValue->items as $item) {
43+
if (!$item instanceof ArrayItem) {
44+
continue;
45+
}
46+
4247
$itemValue = $item->value;
4348

4449
if (!$itemValue instanceof ClassConstFetch) {

0 commit comments

Comments
 (0)