Skip to content

Commit aa0d706

Browse files
authored
Merge pull request overblog#723 from overblog/murtukov-patch-1
Fix bug
2 parents 4f8e257 + 7707f8b commit aa0d706

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Config/Parser/AnnotationParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,11 +734,11 @@ private static function getDescriptionConfiguration(array $annotations, bool $wi
734734
private static function getArgs(array $args = null, \ReflectionMethod $method = null): array
735735
{
736736
$config = [];
737-
if ($args && !empty($args)) {
737+
if (!empty($args)) {
738738
foreach ($args as $arg) {
739739
$config[$arg->name] = ['type' => $arg->type]
740-
+ ($arg->description ? ['description' => $arg->description] : [])
741-
+ ($arg->default ? ['defaultValue' => $arg->default] : []);
740+
+ (null !== $arg->description ? ['description' => $arg->description] : [])
741+
+ (null !== $arg->default ? ['defaultValue' => $arg->default] : []);
742742
}
743743
} elseif ($method) {
744744
$config = self::guessArgs($method);

tests/Config/Parser/AnnotationParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function testTypes(): void
117117
'currentMaster' => ['type' => 'Sith', 'resolve' => "@=service('master_resolver').getMaster(value)"],
118118
'victims' => [
119119
'type' => '[Character]',
120-
'args' => ['jediOnly' => ['type' => 'Boolean', 'description' => 'Only Jedi victims']],
120+
'args' => ['jediOnly' => ['type' => 'Boolean', 'description' => 'Only Jedi victims', 'defaultValue' => false]],
121121
'resolve' => '@=call(value.getVictims, arguments({jediOnly: "Boolean"}, args))',
122122
],
123123
],

0 commit comments

Comments
 (0)