Skip to content

Commit 556597c

Browse files
committed
MC-33069: Stabilize Unit tests
1 parent 210264d commit 556597c

File tree

1 file changed

+15
-4
lines changed
  • lib/internal/Magento/Framework/ObjectManager/Code/Generator

1 file changed

+15
-4
lines changed

lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ protected function _getGetMethod()
246246
'parameters' => [
247247
[
248248
'name' => 'id',
249-
'type' => $parameterReflection->getType(),
249+
'type' => $this->getTypeHintText($parameterReflection->getType()),
250250
],
251251
],
252252
'body' => $body,
253-
'returnType' => $methodReflection->getReturnType(),
253+
'returnType' => $this->getTypeHintText($methodReflection->getReturnType()),
254254
'docblock' => [
255255
'shortDescription' => 'load entity',
256256
'tags' => [
@@ -722,9 +722,9 @@ private function getMethodParamAndReturnType($methodName)
722722
if (!empty($params[0])) {
723723
/** @var ParameterReflection $parameterReflection */
724724
$parameterReflection = $params[0];
725-
$result['paramType'] = $parameterReflection->getType();
725+
$result['paramType'] = $this->getTypeHintText($parameterReflection->getType());
726726
}
727-
$result['returnType'] = $methodReflection->getReturnType();
727+
$result['returnType'] = $this->getTypeHintText($methodReflection->getReturnType());
728728

729729
return $result;
730730
}
@@ -742,4 +742,15 @@ private function getClassMethods($name)
742742
}
743743
return $this->methodList;
744744
}
745+
746+
/**
747+
* Get the text of the type hint.
748+
*
749+
* @param \ReflectionType|null $type
750+
* @return string|null
751+
*/
752+
private function getTypeHintText($type)
753+
{
754+
return $type instanceof \ReflectionType ? $type->getName() : $type;
755+
}
745756
}

0 commit comments

Comments
 (0)