File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
tests/PhpGenerator/expected Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -219,9 +219,15 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
219219 $ param ->setType ((string ) $ from ->getType ());
220220 }
221221 if ($ from ->isDefaultValueAvailable ()) {
222- $ param ->setDefaultValue ($ from ->isDefaultValueConstant ()
223- ? new Literal ($ from ->getDefaultValueConstantName ())
224- : $ from ->getDefaultValue ());
222+ if ($ from ->isDefaultValueConstant ()) {
223+ $ parts = explode (':: ' , $ from ->getDefaultValueConstantName ());
224+ if (count ($ parts ) > 1 ) {
225+ $ parts [0 ] = Helpers::tagName ($ parts [0 ]);
226+ }
227+ $ param ->setDefaultValue (new Literal (implode (':: ' , $ parts )));
228+ } else {
229+ $ param ->setDefaultValue ($ from ->getDefaultValue ());
230+ }
225231 $ param ->setNullable ($ param ->isNullable () && $ param ->getDefaultValue () !== null );
226232 }
227233 $ param ->setAttributes (self ::getAttributes ($ from ));
Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ public static function formatDocComment(string $content): string
8585
8686 public static function tagName (string $ name , string $ type = PhpNamespace::NAME_NORMAL ): string
8787 {
88- return "/*( $ type*/ $ name " ;
88+ return isset (self ::KEYWORDS [strtolower ($ name )])
89+ ? $ name
90+ : "/*( $ type*/ $ name " ;
8991 }
9092
9193
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class Class2 extends Class1 implements Interface2
5555 }
5656
5757
58- private function func4(array $a = [], Class2 $b = null, $c = Abc\ Unknown::ABC)
58+ private function func4(array $a = [], Class2 $b = null, $c = Unknown::ABC)
5959 {
6060 }
6161
You can’t perform that action at this time.
0 commit comments