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
299299 }
300300
301301 foreach ($ node ->adaptations as $ item ) {
302- $ trait ->addResolution (trim ($ this ->toPhp ( $ item ), '; ' ));
302+ $ trait ->addResolution (rtrim ($ this ->getReformattedContents ([ $ item], 0 ), '; ' ));
303303 }
304304
305305 $ this ->addCommentAndAttributes ($ trait , $ node );
Original file line number Diff line number Diff line change @@ -147,11 +147,12 @@ public function printClass(
147147 $ traits = [];
148148 if ($ class instanceof ClassType || $ class instanceof TraitType || $ class instanceof EnumType) {
149149 foreach ($ class ->getTraits () as $ trait ) {
150- $ resolutions = $ trait ->getResolutions ();
150+ $ resolutions = implode ("; \n" , $ trait ->getResolutions ());
151+ $ resolutions = Helpers::simplifyTaggedNames ($ resolutions , $ this ->namespace );
151152 $ traits [] = $ this ->printDocComment ($ trait )
152153 . 'use ' . $ resolver ($ trait ->getName ())
153154 . ($ resolutions
154- ? " { \n" . $ this ->indentation . implode ( " ; \n" . $ this -> indentation , $ resolutions ) . "; \n} \n"
155+ ? " { \n" . $ this ->indent ( $ resolutions ) . "; \n} \n"
155156 : "; \n" );
156157 }
157158 }
Original file line number Diff line number Diff line change @@ -101,8 +101,8 @@ class Class5
101101{
102102 use Trait1;
103103 use Trait1b {
104- \ Trait1b::f1 insteadof \ Trait1;
104+ Trait1b::f1 insteadof Trait1;
105105 // not yet supported
106- \ Trait1b::f1 as private;
106+ Trait1b::f1 as private;
107107 }
108108}
You can’t perform that action at this time.
0 commit comments