Skip to content

Commit 6f3faeb

Browse files
authored
Use annotation to ignore phpstan rule (#512)
* Use annotation to ignore phpstan rule * Replace assert by comment
1 parent b205d07 commit 6f3faeb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Test/ResultMockFactory.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,11 @@ private static function addUndefinedProperties(\ReflectionClass $reflectionClass
149149
}
150150

151151
$getter = $reflectionClass->getMethod('get' . $property->getName());
152-
/** @psalm-suppress PossiblyNullReference */
153-
if (!$getter->hasReturnType() || $getter->getReturnType()->allowsNull()) {
152+
if (!$getter->hasReturnType() || (!($type = $getter->getReturnType()) instanceof \ReflectionNamedType) || $type->allowsNull()) {
154153
continue;
155154
}
156155

157-
/** @psalm-suppress PossiblyNullReference */
158-
switch ($getter->getReturnType()->getName()) {
156+
switch ($type->getName()) {
159157
case 'int':
160158
$propertyValue = 0;
161159

0 commit comments

Comments
 (0)