Skip to content

Commit 6aa5632

Browse files
committed
Update #[Argument] and #[Option] attributes to correct namespace during invokable command migration
1 parent 123d2c1 commit 6aa5632

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/intentions/php/CommandToInvokableIntention.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ private void migrateExecuteToInvoke(@NotNull Project project, @NotNull Method ex
363363
boolean needsOption = !configureData.options.isEmpty();
364364

365365
if (needsArgument) {
366-
PhpElementsUtil.insertUseIfNecessary(phpClass, "\\Symfony\\Component\\Console\\Input\\Attribute\\Argument");
366+
PhpElementsUtil.insertUseIfNecessary(phpClass, "\\Symfony\\Component\\Console\\Attribute\\Argument");
367367
}
368368
if (needsOption) {
369-
PhpElementsUtil.insertUseIfNecessary(phpClass, "\\Symfony\\Component\\Console\\Input\\Attribute\\Option");
369+
PhpElementsUtil.insertUseIfNecessary(phpClass, "\\Symfony\\Component\\Console\\Attribute\\Option");
370370
}
371371

372372
// Commit and unblock after adding use statements to allow further document modifications

src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/intentions/php/fixtures/classes.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ public function __construct(
2424
public bool $hidden = false
2525
) {}
2626
}
27+
28+
#[\Attribute(\Attribute::TARGET_PARAMETER)]
29+
class Argument
30+
{
31+
public function __construct(
32+
public ?string $description = null
33+
) {}
34+
}
35+
36+
#[\Attribute(\Attribute::TARGET_PARAMETER)]
37+
class Option
38+
{
39+
public function __construct(
40+
public ?string $shortcut = null,
41+
public ?string $description = null
42+
) {}
43+
}
2744
}
2845

2946
namespace Symfony\Component\Console\Input
@@ -64,26 +81,6 @@ class Application
6481
}
6582
}
6683

67-
namespace Symfony\Component\Console\Input\Attribute
68-
{
69-
#[\Attribute(\Attribute::TARGET_PARAMETER)]
70-
class Argument
71-
{
72-
public function __construct(
73-
public ?string $description = null
74-
) {}
75-
}
76-
77-
#[\Attribute(\Attribute::TARGET_PARAMETER)]
78-
class Option
79-
{
80-
public function __construct(
81-
public ?string $shortcut = null,
82-
public ?string $description = null
83-
) {}
84-
}
85-
}
86-
8784
namespace Symfony\Bundle\FrameworkBundle\Controller
8885
{
8986
class AbstractController

0 commit comments

Comments
 (0)