File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/Barryvdh/Reflection/DocBlock/Type Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ protected function expand($type)
151
151
return '' ;
152
152
}
153
153
154
+ if ($ this ->shouldBeAbsolute ($ type )){
155
+ return self ::OPERATOR_NAMESPACE . $ type ;
156
+ }
157
+
154
158
if ($ this ->isTypeAnArray ($ type )) {
155
159
return $ this ->expand (substr ($ type , 0 , -2 )) . self ::OPERATOR_ARRAY ;
156
160
}
@@ -218,4 +222,16 @@ protected function isRelativeType($type)
218
222
return ($ type [0 ] !== self ::OPERATOR_NAMESPACE )
219
223
|| $ this ->isTypeAKeyword ($ type );
220
224
}
225
+
226
+ /**
227
+ * Detects if the type should actually be absolute, by checking if it exists.
228
+ *
229
+ * @param string $type A relative or absolute type as defined in the
230
+ * phpDocumentor documentation.
231
+ *
232
+ * @return bool
233
+ */
234
+ protected function shouldBeAbsolute ($ type ){
235
+ return class_exists ($ type );
236
+ }
221
237
}
You can’t perform that action at this time.
0 commit comments