Skip to content

Commit

Permalink
#25656: Removes the exception being thrown for methods returning null
Browse files Browse the repository at this point in the history
  • Loading branch information
theCapypara committed Nov 29, 2019
1 parent 99a1a98 commit 253f881
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,20 +383,6 @@ public function testGetReturnTypeNullAtFirstPos()
self::assertEquals($expected, $this->typeProcessor->getGetterReturnType($methodReflection));
}

/**
* Checks a case when method return annotation has a null-type at first position,
* and no other valid return type.
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage No valid return type for Magento\Framework\Reflection\Test\Unit\Fixture\TSample::getOnlyNull() specified. Verify the return type and try again.
*/
public function testGetReturnTypeNullAtFirstPosNoValidType()
{
$classReflection = new ClassReflection(TSample::class);
$methodReflection = $classReflection->getMethod('getOnlyNull');
$this->typeProcessor->getGetterReturnType($methodReflection);
}

/**
* Simple and complex data provider
*
Expand Down
10 changes: 1 addition & 9 deletions lib/internal/Magento/Framework/Reflection/TypeProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,7 @@ public function getGetterReturnType($methodReflection)
break;
}
}
if (!$returnType) {
throw new \InvalidArgumentException(
sprintf(
'No valid return type for %s::%s() specified. Verify the return type and try again.',
$methodReflection->getDeclaringClass()->getName(),
$methodReflection->getName()
)
);
}

$nullable = in_array('null', $types);

return [
Expand Down

0 comments on commit 253f881

Please sign in to comment.