Skip to content

Commit f6b5ccd

Browse files
committed
Fix phpstan interpretation
1 parent 9d0561a commit f6b5ccd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/main.workflow

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ workflow "Qa workflow" {
22
on = "push"
33
resolves = [
44
"PHPStan",
5+
"Psalm",
56
"composer-require-checker",
67
"Code style check",
78
]

src/TypeResolver.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ private function resolveKeyword(string $type): Type
370370
*
371371
* @return Object_
372372
*/
373-
private function resolveTypedObject($type, Context $context = null): Object_
373+
private function resolveTypedObject(string $type, Context $context = null): Object_
374374
{
375375
return new Object_($this->fqsenResolver->resolve($type, $context));
376376
}
@@ -446,7 +446,12 @@ private function resolveCollection(\ArrayIterator $tokens, Type $classType, Cont
446446
return new Array_($valueType, $keyType);
447447
}
448448

449-
return $this->makeCollectionFromObject($classType, $valueType, $keyType);
449+
/** @psalm-suppress RedundantCondition */
450+
if ($classType instanceof Object_) {
451+
return $this->makeCollectionFromObject($classType, $valueType, $keyType);
452+
}
453+
454+
throw new \RuntimeException('Invalid $classType provided');
450455
}
451456

452457
/**

0 commit comments

Comments
 (0)