@@ -37,15 +37,15 @@ public function __construct()
37
37
*/
38
38
public function getPropertyType (ReflectionProperty $ property )
39
39
{
40
- $ class = $ property ->getDeclaringClass ();
41
-
42
40
// Get the content of the @var annotation
43
41
if (preg_match ('/@var\s+([^\s]+)/ ' , $ property ->getDocComment (), $ matches )) {
44
42
list (, $ type ) = $ matches ;
45
43
} else {
46
44
return null ;
47
45
}
48
46
47
+ $ class = $ property ->getDeclaringClass ();
48
+
49
49
// If the class name is not fully qualified (i.e. doesn't start with a \)
50
50
if ($ type [0 ] !== '\\' ) {
51
51
$ alias = (false === $ pos = strpos ($ type , '\\' )) ? $ type : substr ($ type , 0 , $ pos );
@@ -103,9 +103,6 @@ public function getPropertyType(ReflectionProperty $property)
103
103
*/
104
104
public function getParameterType (ReflectionParameter $ parameter )
105
105
{
106
- $ method = $ parameter ->getDeclaringFunction ();
107
- $ class = $ parameter ->getDeclaringClass ();
108
-
109
106
// Use reflection
110
107
$ parameterClass = $ parameter ->getClass ();
111
108
if ($ parameterClass !== null ) {
@@ -114,12 +111,15 @@ public function getParameterType(ReflectionParameter $parameter)
114
111
115
112
$ parameterName = $ parameter ->name ;
116
113
// Get the content of the @param annotation
114
+ $ method = $ parameter ->getDeclaringFunction ();
117
115
if (preg_match ('/@param\s+([^\s]+)\s+\$ ' . $ parameterName . '/ ' , $ method ->getDocComment (), $ matches )) {
118
116
list (, $ type ) = $ matches ;
119
117
} else {
120
118
return null ;
121
119
}
122
120
121
+ $ class = $ parameter ->getDeclaringClass ();
122
+
123
123
// If the class name is not fully qualified (i.e. doesn't start with a \)
124
124
if ($ type [0 ] !== '\\' ) {
125
125
$ alias = (false === $ pos = strpos ($ type , '\\' )) ? $ type : substr ($ type , 0 , $ pos );
0 commit comments