Skip to content

Commit

Permalink
Use annotation to ignore phpstan rule (#512)
Browse files Browse the repository at this point in the history
* Use annotation to ignore phpstan rule

* Replace assert by comment
  • Loading branch information
jderusse authored Apr 30, 2020
1 parent b205d07 commit 6f3faeb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Test/ResultMockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,11 @@ private static function addUndefinedProperties(\ReflectionClass $reflectionClass
}

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

/** @psalm-suppress PossiblyNullReference */
switch ($getter->getReturnType()->getName()) {
switch ($type->getName()) {
case 'int':
$propertyValue = 0;

Expand Down

0 comments on commit 6f3faeb

Please sign in to comment.