Skip to content

Commit 253f881

Browse files
committed
#25656: Removes the exception being thrown for methods returning null
1 parent 99a1a98 commit 253f881

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -383,20 +383,6 @@ public function testGetReturnTypeNullAtFirstPos()
383383
self::assertEquals($expected, $this->typeProcessor->getGetterReturnType($methodReflection));
384384
}
385385

386-
/**
387-
* Checks a case when method return annotation has a null-type at first position,
388-
* and no other valid return type.
389-
*
390-
* @expectedException \InvalidArgumentException
391-
* @expectedExceptionMessage No valid return type for Magento\Framework\Reflection\Test\Unit\Fixture\TSample::getOnlyNull() specified. Verify the return type and try again.
392-
*/
393-
public function testGetReturnTypeNullAtFirstPosNoValidType()
394-
{
395-
$classReflection = new ClassReflection(TSample::class);
396-
$methodReflection = $classReflection->getMethod('getOnlyNull');
397-
$this->typeProcessor->getGetterReturnType($methodReflection);
398-
}
399-
400386
/**
401387
* Simple and complex data provider
402388
*

lib/internal/Magento/Framework/Reflection/TypeProcessor.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,7 @@ public function getGetterReturnType($methodReflection)
293293
break;
294294
}
295295
}
296-
if (!$returnType) {
297-
throw new \InvalidArgumentException(
298-
sprintf(
299-
'No valid return type for %s::%s() specified. Verify the return type and try again.',
300-
$methodReflection->getDeclaringClass()->getName(),
301-
$methodReflection->getName()
302-
)
303-
);
304-
}
296+
305297
$nullable = in_array('null', $types);
306298

307299
return [

0 commit comments

Comments
 (0)