File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ public function __toString()
121
121
}
122
122
123
123
$ mapper = function (array $ arr ) {
124
- return array_map ([ $ this ->namespace ?: new PhpNamespace , 'unresolveName ' ], $ arr );
124
+ return $ this ->namespace ? array_map ([ $ this -> namespace , 'unresolveName ' ], $ arr ) : $ arr ;
125
125
};
126
126
127
127
return Strings::normalize (
Original file line number Diff line number Diff line change @@ -103,12 +103,11 @@ public function __construct($name = NULL)
103
103
*/
104
104
public function __toString ()
105
105
{
106
- $ namespace = $ this ->namespace ?: new PhpNamespace ;
107
106
$ parameters = [];
108
107
foreach ($ this ->parameters as $ param ) {
109
108
$ variadic = $ this ->variadic && $ param === end ($ this ->parameters );
110
-
111
- $ parameters [] = ($ param -> getTypeHint () ? $ namespace ->unresolveName ($ param -> getTypeHint () ) . ' ' : '' )
109
+ $ hint = $ param -> getTypeHint ();
110
+ $ parameters [] = ($ hint ? ( $ this -> namespace ? $ this -> namespace ->unresolveName ($ hint ) : $ hint ) . ' ' : '' )
112
111
. ($ param ->isReference () ? '& ' : '' )
113
112
. ($ variadic ? '... ' : '' )
114
113
. '$ ' . $ param ->getName ()
@@ -129,7 +128,7 @@ public function __toString()
129
128
. ' ' . $ this ->name
130
129
. '( ' . implode (', ' , $ parameters ) . ') '
131
130
. ($ this ->uses ? ' use ( ' . implode (', ' , $ uses ) . ') ' : '' )
132
- . ($ this ->returnType ? ': ' . $ namespace-> unresolveName ($ this ->returnType ) : '' )
131
+ . ($ this ->returnType ? ': ' . ( $ this -> namespace ? $ this -> namespace -> unresolveName ($ this -> returnType ) : $ this ->returnType ) : '' )
133
132
. ($ this ->abstract || $ this ->body === FALSE ? '; '
134
133
: ($ this ->name ? "\n" : ' ' ) . "{ \n" . Nette \Utils \Strings::indent (ltrim (rtrim ($ this ->body ) . "\n" ), 1 ) . '} ' );
135
134
}
Original file line number Diff line number Diff line change 1
- class Example extends ParentClass implements One, Two
1
+ class Example extends \ ParentClass implements One, \ Two
2
2
{
3
3
use Three;
4
- use Four;
4
+ use \ Four;
5
5
6
6
7
7
public function one(): One
8
8
{
9
9
}
10
10
11
11
12
- public function two(One $one, Two $two): Two
12
+ public function two(One $one, \ Two $two): \ Two
13
13
{
14
14
}
15
15
You can’t perform that action at this time.
0 commit comments