File tree Expand file tree Collapse file tree 1 file changed +22
-10
lines changed
lib/internal/Magento/Framework Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change 1313trait 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}
You can’t perform that action at this time.
0 commit comments