5
5
*/
6
6
namespace Magento \Webapi \Model \Soap \Config ;
7
7
8
- use Zend \Server \Reflection ;
9
- use Zend \Server \Reflection \ReflectionMethod ;
10
8
use Zend \Code \Reflection \MethodReflection ;
11
9
12
10
/**
@@ -66,8 +64,8 @@ public function __construct(\Magento\Framework\Reflection\TypeProcessor $typePro
66
64
public function reflectClassMethods ($ className , $ methods )
67
65
{
68
66
$ data = [];
69
- $ classReflection = new \Zend \Server \Reflection \ReflectionClass ( new \ ReflectionClass ( $ className) );
70
- /** @var $methodReflection ReflectionMethod */
67
+ $ classReflection = new \Zend \Code \Reflection \ClassReflection ( $ className );
68
+ /** @var \Zend\Code\Reflection\MethodReflection $methodReflection */
71
69
foreach ($ classReflection ->getMethods () as $ methodReflection ) {
72
70
$ methodName = $ methodReflection ->getName ();
73
71
if (array_key_exists ($ methodName , $ methods )) {
@@ -80,33 +78,30 @@ public function reflectClassMethods($className, $methods)
80
78
/**
81
79
* Retrieve method interface and documentation description.
82
80
*
83
- * @param ReflectionMethod $method
81
+ * @param \Zend\Code\Reflection\MethodReflection $method
84
82
* @return array
85
83
* @throws \InvalidArgumentException
86
84
*/
87
- public function extractMethodData (ReflectionMethod $ method )
85
+ public function extractMethodData (\ Zend \ Code \ Reflection \ MethodReflection $ method )
88
86
{
89
87
$ methodData = ['documentation ' => $ this ->extractMethodDescription ($ method ), 'interface ' => []];
90
- $ prototypes = $ method ->getPrototypes ();
91
- /** Take the fullest interface that also includes optional parameters. */
92
- /** @var \Zend\Server\Reflection\Prototype $prototype */
93
- $ prototype = end ($ prototypes );
94
- /** @var \Zend\Server\Reflection\ReflectionParameter $parameter */
95
- foreach ($ prototype ->getParameters () as $ parameter ) {
88
+ /** @var \Zend\Code\Reflection\ParameterReflection $parameter */
89
+ foreach ($ method ->getParameters () as $ parameter ) {
96
90
$ parameterData = [
97
- 'type ' => $ this ->_typeProcessor ->register ($ parameter -> getType ( )),
91
+ 'type ' => $ this ->_typeProcessor ->register ($ this -> _typeProcessor -> getParamType ( $ parameter )),
98
92
'required ' => !$ parameter ->isOptional (),
99
- 'documentation ' => $ parameter -> getDescription ( ),
93
+ 'documentation ' => $ this -> _typeProcessor -> getParamDescription ( $ parameter ),
100
94
];
101
95
if ($ parameter ->isOptional ()) {
102
96
$ parameterData ['default ' ] = $ parameter ->getDefaultValue ();
103
97
}
104
98
$ methodData ['interface ' ]['in ' ]['parameters ' ][$ parameter ->getName ()] = $ parameterData ;
105
99
}
106
- if ($ prototype ->getReturnType () != 'void ' && $ prototype ->getReturnType () != 'null ' ) {
100
+ $ returnType = $ this ->_typeProcessor ->getGetterReturnType ($ method );
101
+ if ($ returnType != 'void ' && $ returnType != 'null ' ) {
107
102
$ methodData ['interface ' ]['out ' ]['parameters ' ]['result ' ] = [
108
- 'type ' => $ this ->_typeProcessor ->register ($ prototype -> getReturnType () ),
109
- 'documentation ' => $ prototype -> getReturnValue ()-> getDescription () ,
103
+ 'type ' => $ this ->_typeProcessor ->register ($ returnType [ ' type ' ] ),
104
+ 'documentation ' => $ returnType [ ' description ' ] ,
110
105
'required ' => true ,
111
106
];
112
107
}
@@ -117,10 +112,10 @@ public function extractMethodData(ReflectionMethod $method)
117
112
/**
118
113
* Retrieve method full documentation description.
119
114
*
120
- * @param ReflectionMethod $method
115
+ * @param \Zend\Code\Reflection\MethodReflection $method
121
116
* @return string
122
117
*/
123
- protected function extractMethodDescription (ReflectionMethod $ method )
118
+ protected function extractMethodDescription (\ Zend \ Code \ Reflection \ MethodReflection $ method )
124
119
{
125
120
$ methodReflection = new MethodReflection (
126
121
$ method ->getDeclaringClass ()->getName (),
0 commit comments