Skip to content

Commit

Permalink
Merge pull request #2251 from Haehnchen/feature/AutowireLocator-attri…
Browse files Browse the repository at this point in the history
…bute

provide service references for "AutowireLocator"
  • Loading branch information
Haehnchen authored Nov 27, 2023
2 parents 70fc5dd + 644cbc3 commit 356ebcb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class ServiceContainerUtil {
public static final String TAGGED_LOCATOR_ATTRIBUTE_CLASS = "\\Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator";
public static final String DECORATOR_ATTRIBUTE_CLASS = "\\Symfony\\Component\\DependencyInjection\\Attribute\\AsDecorator";
public static final String AUTOCONFIGURE_ATTRIBUTE_CLASS = "\\Symfony\\Component\\DependencyInjection\\Attribute\\Autoconfigure";
public static final String AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS = "\\Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator";

@NotNull
public static Collection<ServiceSerializable> getServicesInFile(@NotNull PsiFile psiFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,22 @@ public void register(@NotNull GotoCompletionRegistrarParameter registrar) {
// #[Autoconfigure(['app.some_tag'])]
// #[Autoconfigure(tags: ['app.some_tag'])]
PhpElementsUtil.getFirstAttributeArrayStringPattern(ServiceContainerUtil.AUTOCONFIGURE_ATTRIBUTE_CLASS),
PhpElementsUtil.getAttributeNamedArgumentArrayStringPattern(ServiceContainerUtil.AUTOCONFIGURE_ATTRIBUTE_CLASS, "tags")
PhpElementsUtil.getAttributeNamedArgumentArrayStringPattern(ServiceContainerUtil.AUTOCONFIGURE_ATTRIBUTE_CLASS, "tags"),

// #[AutowireLocator(['app.some_tag', 'app.some_tag'])]
// #[AutowireLocator(services: ['app.some_tag'])]
PhpElementsUtil.getFirstAttributeArrayStringPattern(ServiceContainerUtil.AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS),
PhpElementsUtil.getAttributeNamedArgumentArrayStringPattern(ServiceContainerUtil.AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS, "services"),

// #[AutowireLocator('app.some_tag'])]
// #[AutowireLocator(services: 'app.some_tag')]
PhpElementsUtil.getFirstAttributeStringPattern(ServiceContainerUtil.AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS),
PhpElementsUtil.getAttributeNamedArgumentStringPattern(ServiceContainerUtil.AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS, "services"),

// #[AutowireLocator(exclude: ['app.some_tag'])]
// #[AutowireLocator(exclude: 'app.some_tag')]
PhpElementsUtil.getAttributeNamedArgumentArrayStringPattern(ServiceContainerUtil.AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS, "exclude"),
PhpElementsUtil.getAttributeNamedArgumentStringPattern(ServiceContainerUtil.AUTOWIRE_LOCATOR_ATTRIBUTE_CLASS, "exclude")
), psiElement -> {
PsiElement context = psiElement.getContext();
if (!(context instanceof StringLiteralExpression)) {
Expand Down

0 comments on commit 356ebcb

Please sign in to comment.