File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
tests/PhpGenerator/expected Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ private function addTraitToClass(ClassLike $class, Node\Stmt\TraitUse $node): vo
299
299
}
300
300
301
301
foreach ($ node ->adaptations as $ item ) {
302
- $ trait ->addResolution (trim ($ this ->toPhp ( $ item ), '; ' ));
302
+ $ trait ->addResolution (rtrim ($ this ->getReformattedContents ([ $ item], 0 ), '; ' ));
303
303
}
304
304
305
305
$ this ->addCommentAndAttributes ($ trait , $ node );
Original file line number Diff line number Diff line change @@ -147,11 +147,12 @@ public function printClass(
147
147
$ traits = [];
148
148
if ($ class instanceof ClassType || $ class instanceof TraitType || $ class instanceof EnumType) {
149
149
foreach ($ class ->getTraits () as $ trait ) {
150
- $ resolutions = $ trait ->getResolutions ();
150
+ $ resolutions = implode ("; \n" , $ trait ->getResolutions ());
151
+ $ resolutions = Helpers::simplifyTaggedNames ($ resolutions , $ this ->namespace );
151
152
$ traits [] = $ this ->printDocComment ($ trait )
152
153
. 'use ' . $ resolver ($ trait ->getName ())
153
154
. ($ resolutions
154
- ? " { \n" . $ this ->indentation . implode ( " ; \n" . $ this -> indentation , $ resolutions ) . "; \n} \n"
155
+ ? " { \n" . $ this ->indent ( $ resolutions ) . "; \n} \n"
155
156
: "; \n" );
156
157
}
157
158
}
Original file line number Diff line number Diff line change @@ -101,8 +101,8 @@ class Class5
101
101
{
102
102
use Trait1;
103
103
use Trait1b {
104
- \ Trait1b::f1 insteadof \ Trait1;
104
+ Trait1b::f1 insteadof Trait1;
105
105
// not yet supported
106
- \ Trait1b::f1 as private;
106
+ Trait1b::f1 as private;
107
107
}
108
108
}
You can’t perform that action at this time.
0 commit comments