Skip to content

Commit 61736dd

Browse files
committed
AC-2841:Fixed static test failure
1 parent d528ca7 commit 61736dd

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

lib/internal/Magento/Framework/GetReflectionMethodReturnTypeValueTrait.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
trait GetReflectionMethodReturnTypeValueTrait
1414
{
1515
/**
16-
* Returns return type
16+
* Get return type
1717
*
1818
* @param \ReflectionMethod $method
1919
* @return string|null
@@ -24,15 +24,7 @@ private function getReturnTypeValue(\ReflectionMethod $method): ?string
2424
$returnType = $method->getReturnType();
2525
if ($returnType) {
2626
if ($returnType instanceof \ReflectionUnionType || $returnType instanceof \ReflectionIntersectionType) {
27-
$returnTypeValue = [];
28-
foreach ($method->getReturnType()->getTypes() as $type) {
29-
$returnTypeValue[] = $type->getName();
30-
}
31-
32-
return implode(
33-
$returnType instanceof \ReflectionUnionType ? '|' : '&',
34-
$returnTypeValue
35-
);
27+
return $this->getReturnTypeValues($returnType, $method);
3628
}
3729

3830
$className = $method->getDeclaringClass()->getName();
@@ -44,4 +36,24 @@ private function getReturnTypeValue(\ReflectionMethod $method): ?string
4436

4537
return $returnTypeValue;
4638
}
39+
40+
/**
41+
* @param \ReflectionIntersectionType|\ReflectionUnionType $returnType
42+
* @param \ReflectionMethod $method
43+
* @return string|null
44+
*/
45+
private function getReturnTypeValues(
46+
\ReflectionIntersectionType|\ReflectionUnionType $returnType,
47+
\ReflectionMethod $method
48+
): ?string {
49+
$returnTypeValue = [];
50+
foreach ($method->getReturnType()->getTypes() as $type) {
51+
$returnTypeValue[] = $type->getName();
52+
}
53+
54+
return implode(
55+
$returnType instanceof \ReflectionUnionType ? '|' : '&',
56+
$returnTypeValue
57+
);
58+
}
4759
}

0 commit comments

Comments
 (0)