This PR was merged into the 5.3-dev branch.
Discussion
----------
[Config] Improve exception messages when extension could not be found
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
The error message we currently get if we are using some `AcmeSocialConifg` (bundle is not installed) is currently not perfect. Here are the suggested changes
```diff
In FileLoader.php line 174:
- Could not resolve argument "Symfony\Config\AcmeSocialConfig acmeSocial" for
+ Could not resolve argument "Symfony\Config\AcmeSocialConfig $acmeSocial" for
"app/config/packages/acme_social.php" in app/config/packages/acme_social.php
(which is loaded in resource "app/config/p ackages/acme_social.php").
In PhpFileLoader.php line 124:
- Could not resolve argument "Symfony\Config\AcmeSocialConfig acmeSocial" for
+ Could not resolve argument "Symfony\Config\AcmeSocialConfig $acmeSocial" for
"app/config/packages/acme_social.php".
In PhpFileLoader.php line 167:
There is no extension able to load the configuration for "Symfony\Config\AcmeSocialConfig".
- Looked for namespace "Symfony\Config\AcmeSocialConfig", found "framework",
+ Looked for namespace "acme_social", found "framework",
"sensio_framework_extra","twig", "web_profiler", "monolog ", "debug", "maker", "doctrine",
"doctrine_migrations", "security", "twig_extra", "mercure", "webpack_encore".
```
Commits
-------
187562f385 [Config] Improve exception messages
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Translation] Adding Translation Providers
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#36543
| License | MIT
| Doc PR | todo
> Follow up of https://github.com/symfony/symfony/pull/37462
This PR refers to the early opened RFC #36543 about adding third party translation SaaS into Symfony.
I worked in collaboration with `@odolbeau` on this first draft.
We have implemented only Loco Provider for now, to validate the main workflow of the feature.
~~We are not very sure about some naming convention, such as Remote Storage, it might be renamed in Transport, to correspond to the naming of third party services in Mailer and Notifier Components.~~ We use Provider name.
This PR brings 2 new commands in Translation component: `translation:push` and `translation:pull`
It adds also new configuration entry:
```yaml
framework:
default_locale: fr
translator:
default_path: '%kernel.project_dir%/translations'
enabled_locales: '%locales%'
fallbacks:
- en
- it
providers:
loco:
dsn: '%env(LOCO_DSN)%'
domains: ['messages']
locales: '%locales%'
```
## To do
- [x] Implement Provider into Translation component
- [x] Plug it into FrameworkBundle
- [x] Implement pull and push commands
- [x] Implement Loco adapter
- [x] Tests
- [ ] Documentation
- [x] Update CHANGELOG.md files in FrameworkBundle and Translation Component
Docs:
Adapt language settings in Lokalise to be sure that Symfony locales match with Lokalise languages
![language-setting-lokalise](https://user-images.githubusercontent.com/773875/102089496-997c5200-3e1c-11eb-8bff-bd2f9a5fe100.png)
Todo:
- [x] Implement POEditor Provider (⚠️ there is a trick to do in POEditor Dashboard in order to make XLF export works, it will have to be documented explicitly in the symfony/symfony-docs PR)
- [x] Implement Lokalise Provider
- [x] Implement Crowdin Provider
These 3 providers are implemented separately. They are not fully tested yet, it is planned to make it done by the end of April 2021.
Commits
-------
6e55fa84b7 Added Translation Providers
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] Deprecate creating public workflow services
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | -
AFAIK, workflow services don't need to be public. friendly ping to @lyrixx as a reviewer.
Commits
-------
79cbf005da [FrameworkBundle] Deprecate creating public workflow services
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Config] Make sure one can build cache on Windows and then run in (Docker) Linux
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
The generated ConfigBuilders should use the `\DirectorySeparator` constant. The resulting string will look like this:
```php
<?php
namespace Symfony\Config;
require_once __DIR__.\DIRECTORY_SEPARATOR.'Twig'.\DIRECTORY_SEPARATOR.'GlobalConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Twig'.\DIRECTORY_SEPARATOR.'DateConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Twig'.\DIRECTORY_SEPARATOR.'NumberFormatConfig.php';
/**
* This class is automatically generated to help creating config.
*
* @experimental in 5.3
*/
class TwigConfig implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
private $formThemes;
```
Commits
-------
555c7dda48 [Config] Make sure one can build cache on Windows and then run in (Docker) Linux
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Config] Use plural name on array values
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | Related: https://github.com/symfony/symfony-docs/pull/15264
If we have a PrototypedArrayNode and the prototype is does not have a key (`->useAttributeAsKey('name')`). Then we know for sure that the value should be an array.
See this example from `$framework->assets()`
```diff
/**
+ * @param list<mixed>
* @return $this
*/
- public function baseUrl($value): self
+ public function baseUrls(array $value): self
{
$this->baseUrls = $value;
return $this;
}
```
Commits
-------
f564a7a11a [Config] Use plural name on array values
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Semaphore] Inline lua scripts used by semaphore
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#40820
| License | MIT
| Doc PR | -
Having Redis scripts in separate files might helps IDE and syntax highlight, but has also several drawbacks:
- I/O performance => file is read every time a semaphore is attempted to be acquired
- Readability: Needs to search and open a second file to understand what the method do
- Inconsistent with the rest of the codebase: ie. SQL queries are not store in separate file
Commits
-------
0d6666aac2 Inline lua scripts used by semaphore
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Improve autowiring errors when named autowiring aliases exist
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Before:
`Cannot autowire service "App\Controller\HelloController": argument "$workflow" of method "__construct()" references interface "Symfony\Component\Workflow\WorkflowInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "state_machine.pull_request", "state_machine.comment".`
After:
`Cannot autowire service "App\Controller\HelloController": argument "$workflow" of method "__construct()" references interface "Symfony\Component\Workflow\WorkflowInterface" but no such service exists. Available autowiring aliases for this interface are: "$pullRequestStateMachine", "$commentStateMachine".`
/cc `@lyrixx` `@weaverryan`
Commits
-------
88eb0b57c1 [DependencyInjection] Improve autowiring errors when named autowiring aliases exist
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add conflict rules for incompatible ext-psr versions
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
This PR adds conflict rules for outdated versions of the PECL extension `psr` which are known to cause compatibility issues with DependencyInjection 5.3 and ServiceContracts 2.4.
Commits
-------
a02f062149 [DependencyInjection] Add conflict rules for incompatible ext-psr versions
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add `#[Target]` to tell how a dependency is used and hint named autowiring aliases
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Right now, when one wants to target a specific service in a list of candidates, we rely on the name of the argument in addition to the type-hint, eg:
`function foo(WorkflowInterface $reviewStateMachine)`
The deal is that by giving the argument a name that matches the target use case of the required dependency, we make autowiring more useful.
But sometimes, being able to de-correlate the name of the argument and the purpose is desired.
This PR introduces a new `#[Target]` attribute on PHP8 that allows doing so. The previous example could be written as such thanks to it:
`function foo(#[Target('review.state_machine')] WorkflowInterface $workflow)`
That's all folks :)
Commits
-------
cc76eab795 [DependencyInjection] Add `#[Target]` to tell how a dependency is used and hint named autowiring aliases
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Config] Support extensions without configuration in ConfigBuilder warmup
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
`ConfigurationExtensionInterface::getConfiguration()` is nullable.
As a real use-case: A small internal bundle in my company just uses `array_merge` to manage a very limited set of configuration. We don't have these fancy Configuration classes.
Commits
-------
0a6f5e50b7 [Config] Support extensions without configuration
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Notifier] Add missing entries in scheme to package map
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | - <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Never break backward compatibility (see https://symfony.com/bc).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against branch 5.x.
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
-->
Commits
-------
8cf605062b Add missing entries in scheme to package map
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Notifier] Notifier add test for adding transport factories to framework extension
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | <!-- required for new features -->
Follow up of https://github.com/symfony/symfony/pull/40843 and https://github.com/symfony/symfony/pull/40844
Needs to be rebased after both were merged.
See changes: ddf61c2dae
Commits
-------
3118c9088a Make sure we will not forget to add notifier transport factories to FrameworkExtension anymore
This PR was merged into the 5.3-dev branch.
Discussion
----------
[SecurityBundle] Deprecate public services to private
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | -
Follow up of https://github.com/symfony/symfony/pull/36691 on the SecurityBundle
Commits
-------
56be86aa7d [SecurityBundle] Deprecate public services to private
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle][Notifier] Fix wrong class name usage
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | - <!-- required for new features -->
I got the following error message a new symfony installation while trying to require fake-sms and fake-chat:
```
symfony new --version=next --dir=new
cd new
composer req notifier
composer req symfony/fake-chat-notifier
```
```
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ContainerBuilder.php line 994:
!!
!! You have requested a non-existent service "notifier.transport_factory.fakechat".
!!
!!
!!
Script `@auto`-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
```
Commits
-------
213ef7f39f Fix wrong class name usage
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] Add basic tests for the notifier framework bundle integration
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | <!-- required for new features -->
This PR adds basic tests for the notifier framework bundle integration:
- [x] Adjust the symfony-1.0.xsd and define the notifier type
- [x] Add general notifier configuration tests in FrameworkExtensionTest
Commits
-------
47088eb53a Add basic notifier tests
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add `#[When(env: 'foo')]` to skip autoregistering a class when the env doesn't match
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This is a follow up of #40214, in order to conditionally auto-register classes.
By adding a `#[When(env: prod)]` annotation on a class, one can tell that a class should be skipped when the current env doesn't match the one declared in the attribute.
This saves from writing similar conditional configuration by using the per-env `services_prod.yaml` convention (+corresponding exclusion from `services.yaml`), or some logic in the Kernel.
Commits
-------
59c75bad7b [DI] add `#[When(env: 'foo')]` to skip autoregistering a class when the env doesn't match
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] Add missing notifier transport factories to framework extension
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | <!-- required for new features -->
Tests on https://github.com/symfony/symfony/pull/39353 were failing (https://travis-ci.com/github/symfony/symfony/jobs/499236540) because of missing entries in the `$classToServices` array. They are now added and the list is ordered alphabetically.
Missing entries:
- LightSmsTransportFactory
- SmsBiurasTransportFactory
- MessageBirdTransport
Commits
-------
a83c9fe79a [FrameworkBundle] Add missing notifier transport factories to framework extension
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Security] Add passport to AuthenticationTokenCreatedEvent
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| License | MIT
This is a follow-up to my previous PR #37359, which added `AuthenticationTokenCreatedEvent` to the new authenticator-based security system to inspect the security token before it becomes effective to the security system. It **adds the passport** that was used to generate that token to the event, so that it can be inspected as well.
Reasoning:
1) It makes the event more aligned with other security events (which are also providing the passport)
2) I see valid use-cases when you'd want to look into the passport/badges to decide if you'd want to make modifications to the security token. @seldaek mentioned to me in scheb/2fa#74 that he'd like to have the ability to add a badge from his custom authenticator class, which then influences 2fa being triggered or not. Having the passport in the event would make that a straight forward task.
I would like to add this to Symfony 5.3, since @wouterj plans to stabilize the authenticator security system for that release, so I believe this is worth adding it now rather than later. The constructor change could be considered a BC break, but since authenticator system is experimental, I believe it's fair to make that change now before declaring it "stable".
Commits
-------
74196e0750 Add passport to AuthenticationTokenCreatedEvent