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
219
219
$ param ->setType ((string ) $ from ->getType ());
220
220
}
221
221
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
+ }
225
231
$ param ->setNullable ($ param ->isNullable () && $ param ->getDefaultValue () !== null );
226
232
}
227
233
$ 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
85
85
86
86
public static function tagName (string $ name , string $ type = PhpNamespace::NAME_NORMAL ): string
87
87
{
88
- return "/*( $ type*/ $ name " ;
88
+ return isset (self ::KEYWORDS [strtolower ($ name )])
89
+ ? $ name
90
+ : "/*( $ type*/ $ name " ;
89
91
}
90
92
91
93
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class Class2 extends Class1 implements Interface2
55
55
}
56
56
57
57
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)
59
59
{
60
60
}
61
61
You can’t perform that action at this time.
0 commit comments