Skip to content

Commit bf5e5a6

Browse files
committed
use named arguments
1 parent f584372 commit bf5e5a6

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Security/SecurityControllerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function addLoginMethod(ClassSourceManipulator $manipulator): void
3535

3636
// @legacy Refactor when annotations are no longer supported
3737
if ($this->phpCompatUtil->canUseAttributes()) {
38-
$loginMethodBuilder->addAttribute($manipulator->buildAttributeNode(Route::class, ['/login', 'name' => 'app_login']));
38+
$loginMethodBuilder->addAttribute($manipulator->buildAttributeNode(Route::class, ['path' => '/login', 'name' => 'app_login']));
3939
} else {
4040
$loginMethodBuilder->setDocComment(<<< 'EOT'
4141
/**
@@ -90,7 +90,7 @@ public function addLogoutMethod(ClassSourceManipulator $manipulator): void
9090

9191
// @legacy Refactor when annotations are no longer supported
9292
if ($this->phpCompatUtil->canUseAttributes()) {
93-
$logoutMethodBuilder->addAttribute($manipulator->buildAttributeNode(Route::class, ['/logout', 'name' => 'app_logout']));
93+
$logoutMethodBuilder->addAttribute($manipulator->buildAttributeNode(Route::class, ['path' => '/logout', 'name' => 'app_logout']));
9494
} else {
9595
$logoutMethodBuilder->setDocComment(<<< 'EOT'
9696
/**

src/Util/ClassSourceManipulator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -933,9 +933,7 @@ public function buildAttributeNode(string $attributeClass, array $options, ?stri
933933

934934
$context = $this;
935935
$nodeArguments = array_map(static function ($option, $value) use ($context) {
936-
$ident = \is_int($option) ? null : new Node\Identifier($option);
937-
938-
return new Node\Arg($context->buildNodeExprByValue($value), false, false, [], $ident);
936+
return new Node\Arg($context->buildNodeExprByValue($value), false, false, [], new Node\Identifier($option));
939937
}, array_keys($options), array_values($options));
940938

941939
$class = $attributePrefix ? sprintf('%s\\%s', $attributePrefix, Str::getShortClassName($attributeClass)) : Str::getShortClassName($attributeClass);

0 commit comments

Comments
 (0)