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)
151151 return '' ;
152152 }
153153
154+ if ($ this ->shouldBeAbsolute ($ type )){
155+ return self ::OPERATOR_NAMESPACE . $ type ;
156+ }
157+
154158 if ($ this ->isTypeAnArray ($ type )) {
155159 return $ this ->expand (substr ($ type , 0 , -2 )) . self ::OPERATOR_ARRAY ;
156160 }
@@ -218,4 +222,16 @@ protected function isRelativeType($type)
218222 return ($ type [0 ] !== self ::OPERATOR_NAMESPACE )
219223 || $ this ->isTypeAKeyword ($ type );
220224 }
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+ }
221237}
You can’t perform that action at this time.
0 commit comments