Commit Graph

44146 Commits

Author SHA1 Message Date
HypeMC
17479e2bb5 Minor code cleanup 2021-04-28 09:57:32 +02:00
Oskar Stark
01602ef842 bug #40956 [Config] [ConfigBuilder] Set FQCN as properties type instead of class name (MatTheCat)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Config] [ConfigBuilder] Set FQCN as properties type instead of class name

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40921
| License       | MIT
| Doc PR        | N/A

Commits
-------

e9aa1c5771 [Config] [ConfigBuilder] Set FQCN as properties type instead of class name
2021-04-28 09:41:38 +02:00
MatTheCat
e9aa1c5771 [Config] [ConfigBuilder] Set FQCN as properties type instead of class name 2021-04-28 09:41:32 +02:00
Oskar Stark
34be4a5120 [Translation] [Loco] Remove SCHEME const 2021-04-28 08:48:47 +02:00
Tobias Schultze
29e5bde6c0 [Messenger] fix manual amqp setup when autosetup disabled 2021-04-28 00:28:04 +02:00
Jeremiasz Major
10be072b2b
[HttpFoundation] Fixes for PHP 8.1 deprecations 2021-04-27 18:57:06 +02:00
Oskar Stark
e6af3c2572 [Translation] [Loco] Simplify namespace 2021-04-27 17:24:37 +02:00
David Maicher
72493c6acf
[Mime] DataPart: remove confusing fix-me comment 2021-04-27 16:58:50 +02:00
Oskar Stark
c78358fac8 minor #40944 [Translation] Use proven DSN class from Notifier and rename package (OskarStark)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Translation] Use proven DSN class from Notifier and rename package

| 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       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | ---

This class is already in use, no need to introduce it as experimental

cc `@welcoMattic`

Commits
-------

a7979c44de [Translation] Use proven DSN class from Notifier
2021-04-27 16:39:13 +02:00
Alexander M. Turek
5506f2a115 bug #40950 [Config] Remove double semicolons from autogenerated config classes (HypeMC)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Config] Remove double semicolons from autogenerated config classes

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | N/A

In some cases, the autogenerated config classes contain double semicolons:

![image](https://user-images.githubusercontent.com/2445045/116090262-f4b03200-a6a3-11eb-9cdd-135e9dbac084.png)

Commits
-------

c7163b32c2 [Config] Remove double semicolons from autogenerated config classes
2021-04-27 14:08:31 +02:00
HypeMC
c7163b32c2 [Config] Remove double semicolons from autogenerated config classes 2021-04-27 14:08:11 +02:00
Oskar Stark
a7979c44de [Translation] Use proven DSN class from Notifier
This class is already in use, no need to introduce it as experimental
2021-04-27 11:00:44 +02:00
Alexander M. Turek
88abb39b92 bug #40903 [Config] Builder: Remove typehints and allow for EnvConfigurator (Nyholm)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Config] Builder: Remove typehints and allow for EnvConfigurator

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes -- maybe
| New feature?  | no -- maybe =)
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

When [writing documentation](https://github.com/symfony/symfony-docs/pull/15269#discussion_r617887301) we found that we don't really support environment variables in the leaves. Ie, we expect a boolean but you provide `"%env(ENABLE_FOO)%"`

This PR will also introduce `ParamConfigurator` to allow parameters to be passed as config.

The changes to the generated code:

```diff
    /**
+    * `@param` bool|ParamConfigurator $value
     * `@default` false
     * `@return` $this
     */
-   public function enabled(bool $value): self
+   public function enabled($value): self
    {
        $this->enabled = $value;

        return $this;
    }
```

Commits
-------

59b79d35a7 [Config] Builder: Remove typehints and allow for EnvConfigurator
2021-04-26 18:58:52 +02:00
Javier Eguiluz
1e4c7d9c5d [FrameworkBundle] Make debug:event-dispatcher search case insensitive 2021-04-26 16:11:51 +02:00
Fabien Potencier
896f4a6eb6 minor #40915 [PasswordHasher] fix copy paste typos from UserPasswordEncoderInterface (mhujer)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[PasswordHasher] fix copy paste typos from UserPasswordEncoderInterface

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

Fix typos introduced when extracting the PasswordHasher component from `UserPasswordEncoderInterface` abeb8e4ca9/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoderInterface.php (L36)

Discovered in 5.3.0BETA1.

Commits
-------

dfc3584fb7 [PasswordHasher] fix copy paste typos from UserPasswordEncoderInterface
2021-04-25 08:41:31 +02:00
Nyholm
59b79d35a7
[Config] Builder: Remove typehints and allow for EnvConfigurator 2021-04-24 19:19:31 +02:00
Alexander M. Turek
84a514c4b1 Merge branch '5.2' into 5.x
* 5.2:
  [DependencyInjection] Add missing bool type in procesValue()
  [CI] Make sure to restore default locale
2021-04-24 16:39:57 +02:00
Alexander M. Turek
ef17a59096 Merge branch '4.4' into 5.2
* 4.4:
  [CI] Make sure to restore default locale
2021-04-24 16:39:13 +02:00
Tomas Votruba
e0f8fe837d [DependencyInjection] Add missing bool type in procesValue() 2021-04-24 16:32:26 +02:00
Nyholm
a5afe47ccf [CI] Make sure to restore default locale 2021-04-23 23:06:14 +02:00
Nyholm
d51f7f6a75
[Translation] [CI] Specify terminal width 2021-04-23 19:49:15 +02:00
Alexander M. Turek
a9d582d681 Merge branch '5.2' into 5.x
* 5.2:
  make fabbot happy
  use correct spelling when accessing the SMTP php.ini value
  Fix issue 40507: Tabs as separators between tokens
  [Cache] phpredis: Added full TLS support for RedisCluster
  [DependencyInjection][AliasDeprecatedPublicServicesPass] Noop when the service is private
2021-04-23 18:57:12 +02:00
Alexander M. Turek
546f3b61ed Merge branch '4.4' into 5.2
* 4.4:
  make fabbot happy
  Fix issue 40507: Tabs as separators between tokens
  [Cache] phpredis: Added full TLS support for RedisCluster
2021-04-23 18:56:33 +02:00
Christian Flothmann
6d7d3fb520 expose references detected in inline notation structures 2021-04-23 14:09:37 +02:00
Christian Flothmann
6c7abd1380 minor #40924 [Yaml] make fabbot happy (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Yaml] make fabbot happy

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

9826c05928 make fabbot happy
2021-04-23 14:08:29 +02:00
Christian Flothmann
9826c05928 make fabbot happy 2021-04-23 13:57:46 +02:00
Christian Flothmann
b6f8ed69ec use correct spelling when accessing the SMTP php.ini value 2021-04-23 13:25:09 +02:00
Christian Flothmann
df6b1ebf78 bug #40514 [Yaml] Allow tabs as separators between tokens (bertramakers)
This PR was merged into the 4.4 branch.

Discussion
----------

[Yaml] Allow tabs as separators between tokens

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40507
| License       | MIT
| Doc PR        | None

As described in #40507, the Yaml spec allows tabs as whitespace characters between tokens. However, the Yaml parser crashes on this as it only expects spaces after the colon. https://yaml.org/spec/1.2/spec.html#id2778241

While I'm not a huge fan of it personally, it's an issue when a different linter tells us that a given YAML file with content that we have little control over has valid syntax in an unrelated check, and then our app crashes because it cannot be parsed after all.

Commits
-------

9a130ae93e Fix issue 40507: Tabs as separators between tokens
2021-04-23 09:45:19 +02:00
Bert Ramakers
9a130ae93e Fix issue 40507: Tabs as separators between tokens 2021-04-23 09:44:00 +02:00
Jack Thomas
a1e0408d08 [Cache] phpredis: Added full TLS support for RedisCluster 2021-04-23 09:09:57 +02:00
Martin Hujer
dfc3584fb7 [PasswordHasher] fix copy paste typos from UserPasswordEncoderInterface 2021-04-22 22:56:35 +02:00
Alexander M. Turek
f58285d8e7 [Translation] The tests for the Loco bridge require symfony/config 2021-04-22 19:08:11 +02:00
Alexander M. Turek
e01499d0b8 [Translation] Move ProviderFactoryTestCase out of the Tests namespace 2021-04-22 14:58:24 +02:00
Nicolas Grekas
ba2a354597 minor #40911 [Translation] Move ProviderTestCase out of the Tests namespace (derrabus)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Translation] Move ProviderTestCase out of the Tests namespace

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Because the `Tests` namespace is stripped from our distribution packages, the new Loco translation bridge cannot use the abstract `ProviderTestCase` class. This PR suggests to move it into a dedicated `Test` namespace to make it reusable for the Loco bridge and potential future bridges.

Commits
-------

c1ec38fdb8 [Translation] Move ProviderTestCase out of the Tests namespace
2021-04-22 14:44:35 +02:00
Alexander M. Turek
c1ec38fdb8 [Translation] Move ProviderTestCase out of the Tests namespace 2021-04-22 14:42:41 +02:00
Alexander M. Turek
7b8aa215df [FrameworkBundle] Bump symfony/translation 2021-04-22 13:26:24 +02:00
Nicolas Grekas
8361713367 minor #40897 [Config] Improve exception messages when extension could not be found (Nyholm)
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
2021-04-21 14:21:44 +02:00
Nyholm
187562f385
[Config] Improve exception messages 2021-04-21 12:45:36 +02:00
Mathieu Santostefano
6e55fa84b7
Added Translation Providers
Co-authored-by: Olivier Dolbeau <github@a.bbnt.me>
2021-04-21 11:10:56 +02:00
Nicolas Grekas
be384cf221 minor #40875 [FrameworkBundle] Deprecate creating public workflow services (fancyweb)
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
2021-04-21 11:09:22 +02:00
Nicolas Grekas
71c6c42399 bug #40877 [Config] Make sure one can build cache on Windows and then run in (Docker) Linux (Nyholm)
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
2021-04-21 11:08:36 +02:00
Nicolas Grekas
f82c11883f bug #40878 [Config] Use plural name on array values (Nyholm)
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
2021-04-21 11:07:41 +02:00
Nyholm
f564a7a11a [Config] Use plural name on array values 2021-04-21 11:07:16 +02:00
Jérémy Derussé
0d6666aac2
Inline lua scripts used by semaphore 2021-04-20 22:05:20 +02:00
Thomas Calvet
79cbf005da [FrameworkBundle] Deprecate creating public workflow services 2021-04-20 13:17:41 +02:00
Fabien Potencier
1ed5e0ca46 minor #40848 [DependencyInjection] Improve autowiring errors when named autowiring aliases exist (nicolas-grekas)
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
2021-04-20 07:29:23 +02:00
Alexander M. Turek
a02f062149 [DependencyInjection] Add conflict rules for incompatible ext-psr versions 2021-04-19 22:21:11 +02:00
Nyholm
555c7dda48
[Config] Make sure one can build cache on Windows and then run in (Docker) Linux 2021-04-19 20:33:48 +02:00
Thomas Calvet
00048a9c73 [DependencyInjection][AliasDeprecatedPublicServicesPass] Noop when the service is private 2021-04-19 18:07:35 +02:00
Alexander M. Turek
527b885fc6 Merge branch '5.2' into 5.x
* 5.2:
  [VarDumper] Add PHP 8.1 enums tests
2021-04-19 16:14:47 +02:00
Alexander M. Turek
bf6e98c220 Merge branch '4.4' into 5.2
* 4.4:
  [VarDumper] Add PHP 8.1 enums tests
  [Console] : added phpdocs to InputOption constants
2021-04-19 16:07:32 +02:00
Maxim Dovydenok
9a2a02710a [VarDumper] Add PHP 8.1 enums tests
VarDumper component already supports PHP 8.1 enums, but didn't have tests
2021-04-19 16:36:17 +03:00
Nyholm
59211ce286
feature #40800 [DependencyInjection] Add #[Target] to tell how a dependency is used and hint named autowiring aliases (nicolas-grekas)
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
2021-04-19 15:08:09 +02:00
Nicolas Grekas
cc76eab795 [DependencyInjection] Add #[Target] to tell how a dependency is used and hint named autowiring aliases 2021-04-19 14:53:54 +02:00
Nyholm
0fd8413f49
bug #40859 [Config] Support extensions without configuration in ConfigBuilder warmup (wouterj)
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
2021-04-19 12:22:41 +02:00
Wouter de Jong
0a6f5e50b7 [Config] Support extensions without configuration 2021-04-18 19:45:52 +02:00
Oskar Stark
f9ad1cd91f bug #40852 [Notifier] Add missing entries in scheme to package map (jschaedl)
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
2021-04-18 19:44:12 +02:00
Yonel Ceruto
29d41b1970 Add prototype definition support for nested options 2021-04-18 09:39:20 -04:00
Nicolas Grekas
88eb0b57c1 [DependencyInjection] Improve autowiring errors when named autowiring aliases exist 2021-04-18 10:37:39 +02:00
Fabien Potencier
926f87ff51 Bump Symfony version to 5.3.0 2021-04-18 08:45:08 +02:00
Fabien Potencier
450f45ae70 Update VERSION for 5.3.0-BETA1 2021-04-18 08:39:48 +02:00
Jan Schädlich
8cf605062b Add missing entries in scheme to package map 2021-04-18 07:25:16 +01:00
Fabien Potencier
13f9ee533b Fix tests 2021-04-18 08:18:12 +02:00
Fabien Potencier
f67d11c84d minor #40845 [Notifier] Notifier add test for adding transport factories to framework extension (jschaedl, fabpot)
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
2021-04-18 07:55:29 +02:00
Jan Schädlich
3118c9088a Make sure we will not forget to add notifier transport factories to FrameworkExtension anymore 2021-04-18 07:55:19 +02:00
Fabien Potencier
1a87c72c1f feature #40838 [SecurityBundle] Deprecate public services to private (fancyweb)
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
2021-04-18 07:46:24 +02:00
Thomas Calvet
56be86aa7d [SecurityBundle] Deprecate public services to private 2021-04-18 07:46:12 +02:00
Jan Schädlich
213ef7f39f Fix wrong class name usage 2021-04-17 23:05:24 +01:00
Oskar Stark
3fd41ce110 minor #40844 [FrameworkBundle] Add basic tests for the notifier framework bundle integration (jschaedl)
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
2021-04-17 20:14:09 +02:00
Nicolas Grekas
f3428928cf bug #40846 Fix typo (fabpot)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Fix typo

| 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       | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

791313b6a7 Fix typo
2021-04-17 19:13:30 +02:00
Nicolas Grekas
4cac9cf829 feature #40782 [DependencyInjection] Add #[When(env: 'foo')] to skip autoregistering a class when the env doesn't match (nicolas-grekas)
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
2021-04-17 19:07:09 +02:00
Jan Schädlich
47088eb53a Add basic notifier tests 2021-04-17 17:51:43 +01:00
Fabien Potencier
791313b6a7 Fix typo 2021-04-17 18:36:24 +02:00
Jan Schädlich
a83c9fe79a [FrameworkBundle] Add missing notifier transport factories to framework extension 2021-04-17 17:36:35 +02:00
Wouter de Jong
0eebd9e5f3 feature #40840 [Security] Add passport to AuthenticationTokenCreatedEvent (scheb)
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
2021-04-16 21:36:14 +02:00
Christian Scheb
74196e0750 Add passport to AuthenticationTokenCreatedEvent 2021-04-16 21:36:04 +02:00
Fabien Potencier
beeb3045e1 [Console] Add missing phpdocs to InputOption constants 2021-04-16 19:36:28 +02:00
Fabien Potencier
c4ea8a35fc Merge branch '5.2' into 5.x
* 5.2:
  [Console] : added phpdocs to InputOption constants
2021-04-16 19:35:46 +02:00
Fabien Potencier
e633845cf9 Merge branch '4.4' into 5.2
* 4.4:
  [Console] : added phpdocs to InputOption constants
2021-04-16 19:35:15 +02:00
Markus Staab
9f124f6278 [Console] : added phpdocs to InputOption constants 2021-04-16 19:32:19 +02:00
Nicolas Grekas
d7e059c05c Merge branch '5.2' into 5.x
* 5.2:
  [DoctrineBridge] Allow bundles to define a driver type "attribute"
  fix test SocketStreamTest for Windows
  Fix issue with RequestMatcher when attribute is a closure
  [PropertyInfo] Use the right context for methods defined in traits
2021-04-16 19:25:45 +02:00
Nicolas Grekas
9fe3cce0ca Merge branch '4.4' into 5.2
* 4.4:
  [DoctrineBridge] Allow bundles to define a driver type "attribute"
  fix test SocketStreamTest for Windows
  Fix issue with RequestMatcher when attribute is a closure
  [PropertyInfo] Use the right context for methods defined in traits
2021-04-16 19:25:34 +02:00
Nicolas Grekas
02fea49b7e Merge branch '5.2' into 5.x
* 5.2:
  [FrameworkBundle] Fix array controller link in debug:router
2021-04-16 19:22:18 +02:00
Nicolas Grekas
449c60f9aa bug #40802 [FrameworkBundle] Fix array controller link in debug:router (fancyweb)
This PR was merged into the 5.2 branch.

Discussion
----------

[FrameworkBundle] Fix array controller link in debug:router

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

`debug:router` is broken when you add a route in the Kernel (see https://symfony.com/doc/current/configuration/micro_kernel_trait.html) because `kernel` is not a class and triggers a `\ReflectionException`. The code in the exception handling always expect `$controller` to be a string.

Commits
-------

be964bdfa6 [FrameworkBundle] Fix array controller link in debug:router
2021-04-16 19:21:25 +02:00
Nicolas Grekas
32cce9f7b6 minor #40836 [Mailer] Fix SocketStreamTest for windows (a1812)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Fix SocketStreamTest for windows

| Q             | A
| ------------- | ---
| Branch?       |  4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? |no
| Tickets       | -
| License       | MIT
| Doc PR        | -

**How to reproduce**
PHP 8.0.3
PHPUnit 9.5.4

c:\php\php ./phpunit --bootstrap ./vendor/autoload.php --configuration ./phpunit.xml.dist --filter "/(SocketStreamTest::testSocketErrorNoConnection)( .*)?$/" --test-suffix SocketStreamTest.php ./src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream --testdox

Failed asserting that exception message 'Connection could not be established with host "ssl://localhost:9999": stream_socket_client(): Unable to connect to ssl://localhost:9999 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond)' matches '/Connection refused|unable to connect/'.

Commits
-------

a46fce402c fix test SocketStreamTest for Windows
2021-04-16 19:19:58 +02:00
Nicolas Grekas
549c097251 feature #40799 [FrameworkBundle] Add AbstractController::handleForm() helper (dunglas)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] Add AbstractController::handleForm() helper

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/15217

Some libraries such as Turbo require to strictly follow the HTTP specification (and especially to use proper status codes) to deal with forms.

In https://github.com/symfony/symfony/pull/39843, I introduced a new `renderForm()` helper for this purpose. But I'm not very satisfied by it. The current approach has several problems:

1. It calls `$form->isValid()` two times, which may hurt performance
2. It sets the proper status code in case of validation error (422), but not for the redirection when the entity is created or updated (306). The user must do this manually (and so be aware of these HTTP subtleties).
3. It hides the verbosity of the Form component a bit, but I'm a sure that we can reduce it more

This PR proposes an alternative helper, `handleForm()`, which handles automatically 80% of the use cases, provide an extension point for the other 20%, and can also serve as a quick example for users to handle form in a custom way (by control-clicking on the function to see the code and copy/paste/adapt it).

* if the form is not submitted, the Twig template passed in $view is rendered and a 200 HTTP status code is set
* if the form is submitted but invalid, the Twig template passed in $view is rendered and 422 HTTP status code is set
* if the form is submitted and valid, the entity is saved (only if it is managed by Doctrine ORM), a 306 HTTP status code is set and the Location HTTP header is set to the value of $redirectUrl

Before (standard case):

```php
    #[Route('/{id}/edit', name: 'conference_edit', methods: ['GET', 'POST'])]
    public function edit(Request $request, Conference $conference): Response
    {
        $form = $this->createForm(ConferenceType::class, $conference);
        $form->handleRequest($request);

        $submitted = $form->isSubmitted();
        $valid = $submitted && $form->isValid();

        if ($valid) {
            $this->getDoctrine()->getManager()->flush();

            return $this->redirectToRoute('conference_index', [], Response::HTTP_SEE_OTHER);
        }

        $response = $this->render('conference/edit.html.twig', [
            'conference' => $conference,
            'form' => $form->createView(),
        ]);
        if ($submitted && !$valid) {
            $response->setStatusCode(Response::HTTP_UNPROCESSABLE_ENTITY);
        }

        return $response;
    }
```

With the new helper:

```php
    #[Route('/{id}/edit', name: 'conference_edit', methods: ['GET', 'POST'])]
    public function edit(Request $request, Conference $conference): Response
    {
        $form = $this->createForm(ConferenceType::class, $conference);
        return $this->handleForm(
            $request,
            $form,
            view: 'conference/edit.html.twig',
            redirectUrl: $this->generateUrl('conference_index')
        );
    }
```

Before (more advanced use case):

```php
    #[Route('/{id}/edit', name: 'conference_edit', methods: ['GET', 'POST'])]
    public function edit(Request $request, Conference $conference, HubInterface $hub): Response
    {
        $form = $this->createForm(ConferenceType::class, $conference);
        $form->handleRequest($request);

        $submitted = $form->isSubmitted();
        $valid = $submitted && $form->isValid();

        if ($valid) {
            $this->getDoctrine()->getManager()->flush();

            $hub->publish(
                new Update(
                    'conference:'.$conference->getId(),
                    $this->renderView('conference/edit.stream.html.twig', ['conference' => $conference])
                )
            );

            return $this->redirectToRoute('conference_index', [], Response::HTTP_SEE_OTHER);
        }

        $response = $this->render('conference/edit.html.twig', [
            'conference' => $conference,
            'form' => $form->createView(),
        ]);
        if ($submitted && !$valid) {
            $response->setStatusCode(Response::HTTP_UNPROCESSABLE_ENTITY);
        }

        return $response;
    }
```

With the new helper (more advanced case):

```php
    #[Route('/{id}/edit', name: 'conference_edit', methods: ['GET', 'POST'])]
    public function edit(Request $request, Conference $conference, HubInterface $hub): Response
    {
        $form = $this->createForm(ConferenceType::class, $conference);
        $response = $this->handleForm(
            $request,
            $form,
            view: 'conference/edit.html.twig',
            redirectUrl: $this->generateUrl('conference_index')
        );

        if ($response->isRedirection()) {
            $hub->publish(
                new Update(
                    'conference:' . $conference->getId(),
                    $this->renderView('conference/edit.stream.html.twig', ['conference' => $conference])
                )
            );
        }

        return $response;
    }
```

This also works without named parameters. I also considered passing a callback to be executed on success, but I'm happier with the current solution.

WDYT?

TODO:

* [x] update tests

Commits
-------

5228546066 [FrameworkBundle] Add AbstractController::handleForm() helper
2021-04-16 18:31:06 +02:00
Kévin Dunglas
5228546066 [FrameworkBundle] Add AbstractController::handleForm() helper 2021-04-16 18:30:58 +02:00
Nyholm
3a021a7fc4
bug #40793 [DoctrineBridge] Add support for a driver type "attribute" (beberlei)
This PR was merged into the 4.4 branch.

Discussion
----------

[DoctrineBridge] Add support for a driver type "attribute"

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| License       | MIT

Without this change its not possible to use attributes for mapping when they get released in ORM 2.9 over the next days. Otherwise we would need to copy three methods from the `AbstractDoctrineExtension` into the Bundle. See the DoctrineBundle PR that makes the full changes: https://github.com/doctrine/DoctrineBundle/pull/1322

Commits
-------

cecaa7815a [DoctrineBridge] Allow bundles to define a driver type "attribute"
2021-04-16 16:09:41 +02:00
Benjamin Eberlei
cecaa7815a [DoctrineBridge] Allow bundles to define a driver type "attribute" 2021-04-16 15:04:32 +02:00
Roman Martinuk
a46fce402c fix test SocketStreamTest for Windows 2021-04-16 15:10:02 +03:00
Kamil Kubicki
636dfc6b18 [Notifier] Microsoft Teams: JSON structure error fix for simple message
Code caused following error - 'Unable to post the Microsoft Teams message: ... Summary or Text is required. '. The structure of the message should contain the 'text' attribute instead of 'title'.
2021-04-16 09:28:03 +02:00
Nyholm
d5e8d6ed88
bug #40807 RequestMatcher issue when _controller is a closure (Plopix)
This PR was merged into the 4.4 branch.

Discussion
----------

RequestMatcher issue when `_controller` is a closure

| Q             | A
| ------------- | ---
| Branch?       |  4.4
| Bug fix?      |  yes
| New feature?  | no
| Deprecations? |  no
| License       | MIT

## Description

If the `matches` method of `RequestMatcher` is used on an attribute which is a closure it crashes.

##  How did we get it

On a project that is using FOS HTTP Cache, we have this configuration

```yaml
fos_http_cache:
    cache_control:
        rules:
     -
                match:
                    attributes: { _controller: ^App\\Controller\\.*::.* }
                headers:
                    overwrite: true
                    cache_control: { public: true, private: false, must_revalidate: true, s_maxage: 3600 }
```

Everything works fine unless you are reaching a controller that is a closure.
You get a
```TypeError: preg_match(): Argument #2 ($subject) must be of type string, Closure given``` which is to me logical.

## Proposed solution

Just testing the type of attribute value and return false before crashing `preg_match`

This PR adds a quick unit test to enforce this.

Commits
-------

66491238e3 Fix issue with RequestMatcher when attribute is a closure
2021-04-15 21:04:28 +02:00
Morel Sébastien
66491238e3
Fix issue with RequestMatcher when attribute is a closure 2021-04-15 08:06:12 -07:00
Oskar Stark
1ca10f5c57 feature #40646 [Notifier] Add MessageBird notifier bridge (StaffNowa)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Notifier] Add MessageBird notifier bridge

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT
| Doc PR        | symfony/symfony-docs#15180
| Recipe PR   | symfony/recipes/pull/922

MessageBird notifier https://developers.messagebird.com/docs/conversations/send-messages-curl/

Commits
-------

761817ed81 [Notifier] Add MessageBird notifier bridge
2021-04-15 16:52:16 +02:00
Vasilij Dusko | CREATION
761817ed81 [Notifier] Add MessageBird notifier bridge 2021-04-15 16:52:10 +02:00
Thomas Calvet
be964bdfa6 [FrameworkBundle] Fix array controller link in debug:router 2021-04-15 13:20:37 +02:00
Nicolas Grekas
59c75bad7b [DI] add #[When(env: 'foo')] to skip autoregistering a class when the env doesn't match 2021-04-15 13:06:26 +02:00
Nicolas Grekas
236e61b620 bug #40811 [PropertyInfo] Use the right context for methods defined in traits (colinodell)
This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyInfo] Use the right context for methods defined in traits

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34191
| License       | MIT
| Doc PR        |

Pull request #40175 only partially fixed #34191 - it solved the problem for properties used in traits but it did not address the same issue with methods.

I have therefore applied the same style of fix and confirmed it works properly with tests.

Commits
-------

c7e9493c5b [PropertyInfo] Use the right context for methods defined in traits
2021-04-14 19:13:01 +02:00
Nicolas Grekas
501c3104c7 minor #40790 [Intl] Switch from json to php resources (jderusse)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Intl] Switch from json to php resources

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #23545
| License       | MIT
| Doc PR        | -

take over #34214

Commits
-------

24bfc3bedd [Intl] Switch from json to php resources
2021-04-14 17:40:24 +02:00
Nicolas Grekas
f14b1bfffa bug #40801 [Routing] Fix supporting string "methods" and "schemes" on the Route annotation (fancyweb)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Routing] Fix supporting string "methods" and "schemes" on the Route annotation

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/40796
| License       | MIT
| Doc PR        | -

Commits
-------

b5f61c31e5 [Routing] Fix supporting string "methods" and "schemes" on the Route annotation
2021-04-14 17:38:59 +02:00