19
19
use phpDocumentor \Reflection \TypeResolver ;
20
20
use phpDocumentor \Reflection \Types \Context as TypeContext ;
21
21
use Webmozart \Assert \Assert ;
22
- use function preg_split ;
23
22
24
23
/**
25
24
* Reflection class for a {@}return tag in a Docblock.
26
25
*/
27
26
final class Return_ extends TagWithType implements Factory \StaticMethod
28
27
{
29
- public function __construct (Type $ type , Description $ description = null )
28
+ public function __construct (Type $ type , ? Description $ description = null )
30
29
{
31
- $ this ->name = 'return ' ;
32
- $ this ->type = $ type ;
30
+ $ this ->name = 'return ' ;
31
+ $ this ->type = $ type ;
33
32
$ this ->description = $ description ;
34
33
}
35
34
@@ -45,16 +44,16 @@ public static function create(
45
44
Assert::notNull ($ typeResolver );
46
45
Assert::notNull ($ descriptionFactory );
47
46
48
- list ( $ type , $ description) = self ::extractTypeFromBody ($ body );
47
+ [ $ type , $ description] = self ::extractTypeFromBody ($ body );
49
48
50
- $ type = $ typeResolver ->resolve ($ type , $ context );
49
+ $ type = $ typeResolver ->resolve ($ type , $ context );
51
50
$ description = $ descriptionFactory ->create ($ description , $ context );
52
51
53
52
return new static ($ type , $ description );
54
53
}
55
54
56
- public function __toString () : string
55
+ public function __toString () : string
57
56
{
58
- return $ this ->type . ' ' . (string ) $ this ->description ;
57
+ return ( $ this ->type ?: ' mixed ' ) . ' ' . (string ) $ this ->description ;
59
58
}
60
59
}
0 commit comments