# Symfony Plugin Completion

**Completion** features provide context-aware suggestions for Symfony, Twig, Doctrine, services, routes, configuration, and related framework APIs.

---

## Form type class constant completion for builder

---

## Doctrine entity class constant completion

---

## Constraint message translation completion

**Feature ID:** `ConstraintMessageGotoCompletionRegistrar`  
**Date:** 2026-04-25  
**Feature Page:** [Constraint message translation completion](https://espend.de/phpstorm/plugin/symfony#constraint-message-goto-completion-registrar)  

Completes and navigates validation translation keys used in Symfony Constraint messages.

In addition to named `message:` arguments, the completion now supports array-style `'message'` keys in PHP constraint configuration.

### Code Examples

```php
# Attribute message argument:
#[Assert\NotBlank(message: 'product.name.not_blank')]
private string $name;
```

```php
# Array message key:
new Assert\NotBlank([
    'message' => 'product.name.not_blank',
]);
```

---

## Tag completion inside Attributes

---

## Service completion inside Autowire Attribute

---

## Parameter completion inside Autowire Attribute

---

## Service completion inside Autowire AsDecorator

---

## Doctrine QueryBuilder: Field completion

---

## Prioritized extends templates

---

## Incomplete Yaml named argument

---

## PHP service config argument completion

**Feature ID:** `PhpServiceConfigCompletion`  
**Date:** 2026-04-01  
**Feature Page:** [PHP service config argument completion](https://espend.de/phpstorm/plugin/symfony#php-service-config-completion)  

Completes service references for PHP array-style and fluent service definitions by looking at the configured service class constructor and setter signatures.

Navigation and completion also cover `ServicesConfigurator::alias()` targets in PHP service configuration files.

### Code Examples

```php
# Array-style service arguments:
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return [
    App\Service\Mailer::class => [
        'arguments' => [
            service('mailer.transport'),
        ],
    ],
];
```

```php
# Fluent service config and alias target:
$services->set('app.mailer', App\Service\Mailer::class)
    ->args([service('mailer.transport')]);

$services->alias('App\Contracts\MailerInterface', 'app.mailer');
```

---

## !tagged_iterator tag name

---

## Prioritized include templates

---

## Prioritized embed templates

---

## Incomplete Completion for extends tags

---

## Incomplete Completion for include tags

---

## Incomplete Completion for embed tags

---

## HTML attribute completion with "function print block"

---

## Environment variable completion for env() expressions

**Feature ID:** `EnvironmentVariableContributor`  
**Date:** 2026-03-31  
**Feature Page:** [Environment variable completion for env() expressions](https://espend.de/phpstorm/plugin/symfony#environment-variable-contributor)  

Completes environment variable names inside Symfony `env()` expressions and navigates to the matching `.env` declaration.

The contributor reuses indexed dotenv variables so PHP, YAML, and XML service configuration can reference the same variables consistently.

### Code Examples

```php
# PHP service config:
return [
    'parameters' => [
        'dsn' => env('DATABASE_URL'),
    ],
];
```

```yaml
# YAML service config:
parameters:
  dsn: '%env(DATABASE_URL)%'
```

---

## Form translation key completion

**Feature ID:** `FormTranslationCompletion`  
**Date:** 2015-12-01  
**Feature Page:** [Form translation key completion](https://espend.de/phpstorm/plugin/symfony#form-translation-completion)  

Completes and navigates translation domains and translation keys inside PHP form builders.

Supported form options include `translation_domain`, `choice_translation_domain`, `label`, `help`, `help_block`, `help_inline`, `placeholder`, and translated choice labels.

### Code Examples

```php
# Form option translations:
<?php
$builder->add('status', ChoiceType::class, [
    'translation_domain' => 'admin',
    'label' => 'product.status',
    'help' => 'product.status.help',
    'choices' => [
        'product.status.draft' => 'draft',
        'product.status.published' => 'published',
    ],
]);
```

```php
# Domain completion:
<?php
$builder->add('category', ChoiceType::class, [
    'choice_translation_domain' => 'admin',
]);
```

---

## Include and embed context key completion

**Feature ID:** `TwigIncludeEmbedContextKeyCompletion`  
**Date:** 2026-05-10  
**Feature Page:** [Include and embed context key completion](https://espend.de/phpstorm/plugin/symfony#twig-include-embed-context-key-completion)  

Completes top-level variable names inside Twig `include` and `embed` context hashes from the target template.

The same context key can navigate back to the variable usage in the included template, so forwarded values stay connected to the template that expects them.

### Code Examples

```twig
# Included template variables:
{# product/_card.html.twig #}
{{ product.name }}
{{ currentView }}
```

```twig
# Context key completion:
{% include 'product/_card.html.twig' with {
    product: product,
    currentView: 'grid'
} only %}

{% embed 'product/_card.html.twig' with { product: product } %}
    {% block body %}{{ product.name }}{% endblock %}
{% endembed %}
```

---

## Controller render parameter key completion

**Feature ID:** `ControllerRenderParameterKeyCompletion`  
**Date:** 2019-08-21  
**Feature Page:** [Controller render parameter key completion](https://espend.de/phpstorm/plugin/symfony#controller-render-parameter-key-completion)  

Completes keys in controller render parameter arrays from the variables used by the rendered Twig template.

Completion is limited to root-level template variables and also works for templates whose visible variables come from include or embed context handling.

### Code Examples

```twig
# Rendered template variables:
{# product/show.html.twig #}
{{ product.name }}
{{ breadcrumbs.items|length }}

{% include 'product/_teaser.html.twig' with { teaser: teaser } %}
```

```php
# Controller parameter keys:
return $this->render('product/show.html.twig', [
    'product' => $product,
    'breadcrumbs' => $breadcrumbs,
    'teaser' => $teaser,
]);
```

```php
# Merged context arrays:
$context = ['product' => $product];

return $this->render('product/show.html.twig', array_merge(
    $context,
    ['breadcrumbs' => $breadcrumbs],
));
```

---

## Twig method-chain type resolution

**Feature ID:** `TwigMethodChainTypeResolution`  
**Date:** 2026-05-18  
**Feature Page:** [Twig method-chain type resolution](https://espend.de/phpstorm/plugin/symfony#twig-method-chain-type-resolution)  

Improves Twig completion, navigation, and inspections across chained method calls, property shortcuts, function return types, and filter return types.

This enables suggestions on expressions like `entry.children.entries`, method-call chains, and values returned by Twig functions or filters.

### Code Examples

```twig
# For-loop path resolution:
{# @var root \App\Dto\CategoryTree #}
{% for entry in root.children.entries %}
    {{ entry.name }}
{% endfor %}
```

```twig
# Function/filter return type chains:
{{ product_for_sku(sku).manufacturer.name }}
{{ order|latest_invoice.number }}
```

---

## Complete Twig constant() references

**Feature ID:** `TwigConstantEnumResolver`  
**Date:** 2026-05-28  
**Feature Page:** [Complete Twig constant() references](https://espend.de/phpstorm/plugin/symfony#twig-constant-enum-resolver)  

Completes and resolves PHP constants in Twig `constant()` calls, including fully qualified class constants, namespaced global constants, and object-relative constants.

The same resolver is used by navigation and Find Usages, so constant references in Twig stay connected to their PHP declarations.

### Code Examples

```twig
# Class and namespaced constants:
{{ constant('App\\Enum\\Status::ACTIVE') }}
{{ constant('BugDemo\\NAMESPACED_CONST') }}
```

```twig
# Object-relative constants:
{# @var suite \BugDemo\CardSuite #}
{{ constant('CLUBS', suite) }}
```

---

