1919use phpDocumentor \Reflection \TypeResolver ;
2020use phpDocumentor \Reflection \Types \Context as TypeContext ;
2121use Webmozart \Assert \Assert ;
22- use function preg_split ;
2322
2423/**
2524 * Reflection class for a {@}return tag in a Docblock.
2625 */
2726final class Return_ extends TagWithType implements Factory \StaticMethod
2827{
29- public function __construct (Type $ type , Description $ description = null )
28+ public function __construct (Type $ type , ? Description $ description = null )
3029 {
31- $ this ->name = 'return ' ;
32- $ this ->type = $ type ;
30+ $ this ->name = 'return ' ;
31+ $ this ->type = $ type ;
3332 $ this ->description = $ description ;
3433 }
3534
@@ -45,16 +44,16 @@ public static function create(
4544 Assert::notNull ($ typeResolver );
4645 Assert::notNull ($ descriptionFactory );
4746
48- list ( $ type , $ description) = self ::extractTypeFromBody ($ body );
47+ [ $ type , $ description] = self ::extractTypeFromBody ($ body );
4948
50- $ type = $ typeResolver ->resolve ($ type , $ context );
49+ $ type = $ typeResolver ->resolve ($ type , $ context );
5150 $ description = $ descriptionFactory ->create ($ description , $ context );
5251
5352 return new static ($ type , $ description );
5453 }
5554
56- public function __toString () : string
55+ public function __toString () : string
5756 {
58- return $ this ->type . ' ' . (string ) $ this ->description ;
57+ return ( $ this ->type ?: ' mixed ' ) . ' ' . (string ) $ this ->description ;
5958 }
6059}
0 commit comments