This PR was merged into the 5.3-dev branch.
Discussion
----------
[Console] Add `ConsoleCommand` attribute for declaring commands on PHP 8
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Builds on #39851
On PHP8, this PR will allow using an attribute instead of the public static properties for the name and the description.
```php
#[ConsoleCommand(
name: 'app:my-command',
description: '🌈',
hidden: true,
aliases: ['🌈'],
)]
class MyCommand extends Command
{
}
```
Commits
-------
0cbc9cc672 [Console] Add `ConsoleCommand` attribute for declaring commands on PHP 8
* 5.2:
Stop using deprecated ArrayCache from Doctrine
[EventDispatcher] fix registering subscribers twice on edge-case
[Intl] fix Locale::getFallback() throwing exception on long $locale
This PR was merged into the 4.4 branch.
Discussion
----------
Stop using deprecated ArrayCache from Doctrine
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Follows https://github.com/doctrine/cache/pull/355
Commits
-------
15f021f825 Stop using deprecated ArrayCache from Doctrine
This PR was merged into the 5.3-dev branch.
Discussion
----------
[PropertyInfo] fix direct deprecation
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Commits
-------
7966517976 [PropertyInfo] fix direct deprecation
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Autoconfigurable attributes
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | TODO
Alternative to #39776. Please have a look at that PR as well to see the full discussion.
With this PR, I propose to introduce a way to autoconfigure services by using PHP Attributes. The feature is enabled on all autoconfigured service definitions. The heart of this feature is a new way to register autoconfiguration rules:
```php
$container->registerAttributeForAutoconfiguration(
MyAttribute::class,
static function (ChildDefinition $definition, MyAttribute $attribute, \ReflectionClass $reflector): void {
$definition->addTag('my_tag', ['some_property' => $attribute->someProperty]);
}
);
```
An example for such an attribute is shipped with this PR with the `EventListener` attribute. This piece of code is a fully functional autoconfigurable event listener:
```php
use Symfony\Component\EventDispatcher\Attribute\EventListener;
use Symfony\Component\HttpKernel\Event\RequestEvent;
#[EventListener]
class MyListener
{
public function __invoke(RequestEvent $event): void
{
// …
}
}
```
What makes attributes interesting for this kind of configuration is that they can transport meta information that can be evaluated during autoconfiguration. For instance, if we wanted to change the priority of the listener, we can just pass it to the attribute.
```php
#[EventListener(priority: 42)]
```
The attribute itself is a dumb data container and is unaware of the DI component.
This PR provides applications and bundles with the necessary tools to build own attributes and autoconfiguration rules.
Commits
-------
2ab3caf080 [DependencyInjection] Autoconfigurable attributes
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Intl] fix Locale::getFallback() throwing exception on long $locale
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#39100
| License | MIT
| Doc PR |
`Locale::getFallback()` throws an exception when the `$locale` length is greater than `INTL_MAX_LOCALE_LEN` so I added a condition to check if locale_parse return null, the `Locale::getFallback()` don't call `\count` function and just return null instead.
Commits
-------
a89ced8eac [Intl] fix Locale::getFallback() throwing exception on long $locale
* 5.2:
install compatible versions of mongodb/mongodb only
fix taking error message from the correct violation
fix resolving parent/self/static type annotations
[Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
[WebLink] Escape double quotes in attributes values
[String] Check if function exists before declaring it
* 4.4:
install compatible versions of mongodb/mongodb only
fix resolving parent/self/static type annotations
[Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
[WebLink] Escape double quotes in attributes values
This PR was merged into the 4.4 branch.
Discussion
----------
install compatible versions of mongodb/mongodb only
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
3a231c2030 install compatible versions of mongodb/mongodb only
This PR was merged into the 4.4 branch.
Discussion
----------
[PropertyInfo] fix resolving self to name of the analyzed class
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37149
| License | MIT
| Doc PR |
Commits
-------
e9f2ece991 fix resolving parent/self/static type annotations
This PR was merged into the 4.4 branch.
Discussion
----------
[WebLink] Escape double quotes in attributes values
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
If the attribute value contains a double quote, the serialized value is invalid: `</foo>; rel="alternate"; title="foo " bar"`. Ideally we would use `addcslashes` but we can't because users that already pass escaped values would then be impacted.
Commits
-------
7946be2b95 [WebLink] Escape double quotes in attributes values
This PR was submitted for the 5.2 branch but it was squashed and merged into the 4.4 branch instead.
Discussion
----------
[Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix#40190 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Fixes#40190 to allow spaces in project directory name.
Commits
-------
0e421004eb [Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
This PR was squashed before being merged into the 5.2 branch.
Discussion
----------
[String] Check if function exists before declaring it
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
If you installed a command line tool like `psalm` with composer and then try to run it on a project that included the String component you will get an error like:
> Fatal error: Cannot redeclare Symfony\Component\String\u() (previously declared in /Workspace/symfony/src/Symfony/Component/String/Resources/functions.php:14) in /user/.composer/vendor/symfony/string/Resources/functions.php on line 14
That is because we are loading two installations of the string component.
Commits
-------
cc00e0eb78 [String] Check if function exists before declaring it
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add `#[Autoconfigure]` to help define autoconfiguration rules
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Being inspired by the discussion with @derrabus in #39776.
This PR allows declaring autoconfiguration rules using an attribute on classes/interfaces, eg:
`#[Autoconfigure(bind: ['$foo' => 'bar'], tags: [...], calls: [...])]`
This should typically be added on a base class/interface to tell *how* implementations of such a base type should be autoconfigured. The attribute is parsed when autoconfiguration is enabled, except when a definition has the `container.ignore_attributes` tag, which allows opting out from this behavior.
As usual, the corresponding rules are applied only to services that have autoconfiguration enabled.
In practice, this means that this enables auto-tagging of all implementations of this interface:
```php
#[Autoconfigure(tags: ['my_tag'])]
interface MyInterface {...}
```
Of course, all auto-configurable settings are handled (calls, bindings, etc.)
This PR adds another attribute: `#[AutoconfigureTag()]`.
It extends `#[Autoconfigure]` and allows for specifically defining tags to attach by autoconfiguration.
The name of the tag is optional and defaults to the name of the tagged type (typically the FQCN of an interface). This should ease with writing locators/iterators of tagged services.
```php
#[AutoconfigureTag()]
interface MyInterface {...}
```
Commits
-------
64ab6a2850 [DependencyInjection] Add `#[Autoconfigure]` to help define autoconfiguration rules
* 5.2:
Ignore indirect deprecation triggered by doctrine/orm
Symfony Armenian Translations
[Translation] Allow using dashes in locale when linting Xliff files
use the right context for properties defined in traits
* 4.4:
Ignore indirect deprecation triggered by doctrine/orm
Symfony Armenian Translations
[Translation] Allow using dashes in locale when linting Xliff files
use the right context for properties defined in traits
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Mailer] AWS SES transport Source ARN header support
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | need help (this part was never mentioned in docs)
AWS SES API has [FromEmailAddressIdentityArn](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-FromEmailAddressIdentityArn) field which is necessary for using identities verified by different AWS account.
With this PR I am adding ability to set this field via setting `X-SES-SOURCE-ARN` header.
I've added support for this API field in the same way as it was done before for `X-SES-CONFIGURATION-SET`. It was never documented, but you can use header `X-SES-CONFIGURATION-SET` to set `ConfigurationSetName` API param.
Commits
-------
d7225db7d5 [Mailer] AWS SES transport Source ARN header support