1616/**
1717 * Extended version of the ReflectionClass
1818 *
19+ * @extends \ReflectionClass<object>
1920 * @Flow\Proxy(false)
2021 */
2122class ClassReflection extends \ReflectionClass
@@ -39,7 +40,7 @@ static function ($className) use ($classNameOrObject) {
3940 }
4041
4142 /**
42- * @var DocCommentParser Holds an instance of the doc comment parser for this class
43+ * @var ? DocCommentParser Holds an instance of the doc comment parser for this class
4344 */
4445 protected $ docCommentParser ;
4546
@@ -48,12 +49,14 @@ static function ($className) use ($classNameOrObject) {
4849 * that MethodReflection objects are returned instead of the
4950 * original ReflectionMethod instances.
5051 *
51- * @return MethodReflection Method reflection object of the constructor method
52+ * @return ? MethodReflection Method reflection object of the constructor method
5253 */
53- public function getConstructor (): MethodReflection
54+ public function getConstructor (): ? MethodReflection
5455 {
5556 $ parentConstructor = parent ::getConstructor ();
56- return (!is_object ($ parentConstructor )) ? $ parentConstructor : new MethodReflection ($ this ->getName (), $ parentConstructor ->getName ());
57+ return $ parentConstructor === null
58+ ? $ parentConstructor
59+ : new MethodReflection ($ this ->getName (), $ parentConstructor ->getName ());
5760 }
5861
5962 /**
@@ -165,7 +168,7 @@ public function isTaggedWith($tag)
165168 /**
166169 * Returns an array of tags and their values
167170 *
168- * @return array Tags and values
171+ * @return array<string,array<int,string>> Tags and values
169172 */
170173 public function getTagsValues ()
171174 {
@@ -175,7 +178,7 @@ public function getTagsValues()
175178 /**
176179 * Returns the values of the specified tag
177180 * @param string $tag
178- * @return array Values of the given tag
181+ * @return array<int,string> Values of the given tag
179182 */
180183 public function getTagValues ($ tag )
181184 {
@@ -205,7 +208,7 @@ public function newInstanceWithoutConstructor(): object
205208 {
206209 $ instance = parent ::newInstanceWithoutConstructor ();
207210
208- if (method_exists ($ instance , '__wakeup ' ) && is_callable ([ $ instance , ' __wakeup ' ]) ) {
211+ if (method_exists ($ instance , '__wakeup ' )) {
209212 $ instance ->__wakeup ();
210213 }
211214
@@ -221,8 +224,11 @@ public function newInstanceWithoutConstructor(): object
221224 protected function getDocCommentParser ()
222225 {
223226 if (!is_object ($ this ->docCommentParser )) {
224- $ this ->docCommentParser = new DocCommentParser ;
225- $ this ->docCommentParser ->parseDocComment ($ this ->getDocComment ());
227+ $ this ->docCommentParser = new DocCommentParser ();
228+ $ docComment = $ this ->getDocComment ();
229+ if ($ docComment ) {
230+ $ this ->docCommentParser ->parseDocComment ($ docComment );
231+ }
226232 }
227233 return $ this ->docCommentParser ;
228234 }
0 commit comments