Skip to content

Commit

Permalink
Merge pull request #2253 from Haehnchen/feature/service-locator
Browse files Browse the repository at this point in the history
AutowireLocator should complete services not tags
  • Loading branch information
Haehnchen authored Nov 28, 2023
2 parents 5d2d946 + 601a131 commit 485ff9e
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,7 @@ 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"),

// #[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")
PhpElementsUtil.getAttributeNamedArgumentArrayStringPattern(ServiceContainerUtil.AUTOCONFIGURE_ATTRIBUTE_CLASS, "tags")
), psiElement -> {
PsiElement context = psiElement.getContext();
if (!(context instanceof StringLiteralExpression)) {
Expand All @@ -145,7 +130,22 @@ public void register(@NotNull GotoCompletionRegistrarParameter registrar) {
PlatformPatterns.or(
PhpElementsUtil.getAttributeNamedArgumentStringPattern(ServiceContainerUtil.AUTOWIRE_ATTRIBUTE_CLASS, "service"),
PhpElementsUtil.getAttributeNamedArgumentStringPattern(ServiceContainerUtil.DECORATOR_ATTRIBUTE_CLASS, "decorates"),
PhpElementsUtil.getFirstAttributeStringPattern(ServiceContainerUtil.DECORATOR_ATTRIBUTE_CLASS)
PhpElementsUtil.getFirstAttributeStringPattern(ServiceContainerUtil.DECORATOR_ATTRIBUTE_CLASS),

// #[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();
Expand Down

0 comments on commit 485ff9e

Please sign in to comment.