File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -120,9 +120,9 @@ public function __toString()
120
120
. "; \n" ;
121
121
}
122
122
123
- $ namespace = $ this ->namespace ?: new PhpNamespace ;
123
+ $ namespace = $ this ->namespace ;
124
124
$ mapper = function (array $ arr ) use ($ namespace ) {
125
- return array_map (array ($ namespace , 'unresolveName ' ), $ arr );
125
+ return $ namespace ? array_map (array ($ namespace , 'unresolveName ' ), $ arr ) : $ arr ;
126
126
};
127
127
128
128
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 = array ();
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