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 13
13
trait GetReflectionMethodReturnTypeValueTrait
14
14
{
15
15
/**
16
- * Returns return type
16
+ * Get return type
17
17
*
18
18
* @param \ReflectionMethod $method
19
19
* @return string|null
@@ -24,15 +24,7 @@ private function getReturnTypeValue(\ReflectionMethod $method): ?string
24
24
$ returnType = $ method ->getReturnType ();
25
25
if ($ returnType ) {
26
26
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 );
36
28
}
37
29
38
30
$ className = $ method ->getDeclaringClass ()->getName ();
@@ -44,4 +36,24 @@ private function getReturnTypeValue(\ReflectionMethod $method): ?string
44
36
45
37
return $ returnTypeValue ;
46
38
}
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
+ }
47
59
}
You can’t perform that action at this time.
0 commit comments