This PR was merged into the 3.2-dev branch.
Discussion
----------
[DI] Allow injecting ENV parameters at runtime using %env(MY_ENV_VAR)%
| Q | A
| ------------- | ---
| Branch? | master
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #10138, #7555, #16403, #18155
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/6918
This is an alternative approach to #18155 for injecting env vars into container configurations.
With this PR, anywhere parameters are allowed, one can use `%env(ENV_VAR)%` to inject a dynamic env var. Additionally, if one sets a value to such parameters in e.g. the `parameter.yml` file (`env(ENV_VAR): foo`), this value will be used as a default value when the env var is not defined. If no default value is specified, an `EnvVarNotFoundException` will be thrown at runtime.
Unlike previous attempts that also used parameters (#16403), the implementation is compatible with DI extensions: before being dumped, env vars are resolved to uniquely identifiable string placeholders that can get through DI extensions manipulations. When dumped, these unique placeholders are replaced by dynamic calls to a getEnv method..
ping @magnusnordlander @dzuelke @fabpot
Commits
-------
bac2132 [DI] Allow injecting ENV parameters at runtime using %env(MY_ENV_VAR)% syntax
* 3.1:
added a comment about a workaround
[Finder] no PHP warning on empty directory iteration
[HttpKernel] Fixed the nullable support for php 7.1 and below
fixed CS
[Form] Fix typo in doc comment
Fix version constraint
[Config] Handle open_basedir restrictions in FileLocator
Fixed bad merge
[DoctrineBridge][PropertyInfo] Treat Doctrine decimal type as string
[bugfix] [Console] Set `Input::$interactive` to `false` when command is executed with `--quiet` as verbosity level
Use JSON_UNESCAPED_SLASHES for lint commands output
Fixed collapsed ChoiceType options attributes
[FrameworkBundle] Remove cache clearer default value in config
Consider the umask setting when dumping a file.
Fixed the nullable support for php 7.1 and below
Make ReflectionExtractor compatible with ReflectionType changes in PHP 7.1
This PR was squashed before being merged into the 3.2-dev branch (closes#19197).
Discussion
----------
[Serializer][FrameworkBundle] Add a CSV encoder
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | todo
Usage:
```php
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
$serializer = new Serializer(array(new ObjectNormalizer()), array(new CsvEncoder()));
// or $serializer = $container->get('serializer'); when using the full stack framework
$serializer->encode($something, 'csv');
$serializer->decode(<<<'CSV'
id,name
1,Kévin
CSV
, 'csv');
```
CSV files must contain a header line with property names as keys.
ping @clementtalleu @Simperfit @gorghoa
Commits
-------
e71f5be [Serializer][FrameworkBundle] Add a CSV encoder
This PR was squashed before being merged into the 3.2-dev branch (closes#19257).
Discussion
----------
[Validator][Choice] Make strict the default option for choice validation
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #18973
| License | MIT
| Doc PR | -
This is just the WIP as there are two options.
1. Just change default which would only possible to introduce in 4.x or in 3.2 if this BC break is considered as acceptable
2. Add a new option e.g. `strictComparison` which defaults to true in 4.x and deprecate the usage of the strict option for 3.2.
3. Just deprecate strict = false and remove the option but I would be against that as we remove flexibility which might be wanted.
As per discussion I went ahead with option 3. We can then still decide if we want to remove the option entirely or eventually reenable setting strict to false in a later release.
Commits
-------
177c513 [Validator][Choice] Make strict the default option for choice validation
This PR was squashed before being merged into the 3.2-dev branch (closes#19326).
Discussion
----------
[Serializer][FrameworkBundle] Add a YAML encoder
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | todo
Add YAML support to the Serializer.
Commits
-------
9366a7d [Serializer][FrameworkBundle] Add a YAML encoder
This PR was merged into the 3.2-dev branch.
Discussion
----------
[PropertyInfo] Extract the logic converting a php doc to a Type
| Q | A
| ------------- | ---
| Branch? | "master"
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This PR creates a new trait `PhpDocTypeHelperTrait` extracting some logic of the `PhpDocExtractor`.
I would like to detect the return type of some methods but this is not easily doable as I have to transform the doc types to a ``Type`` instance.
Is this ok for you ?
Commits
-------
d6e93d8 [PropertyInfo] Extract the logic converting a php doc to a Type in PhpDocTypeHelperTrait
This PR was merged into the 3.2-dev branch.
Discussion
----------
[master][console] Allow multiple options to be set.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| License | MIT
This PR add the possibility to set multiple options on a formatted string output.
Example:
```php
$output->writeln('<fg=green;options=bold,underscore>Test</>');
```
Secondly it makes the behavior on invalid values consistent.
```php
// current
$output->writeln('<fg=lime;>Test</>'); // throws exception
$output->writeln('<options=italic;>Test</>'); // silent ignore
// new
$output->writeln('<fg=lime;>Test</>'); // throws exception
$output->writeln('<options=italic;>Test</>'); // throws exception
```
All other changes are about making the code more strict or other SCA/CS fixes.
Commits
-------
1430138 Allow multiple options to be set.
This PR was squashed before being merged into the 3.2-dev branch (closes#19584).
Discussion
----------
[DependencyInjection] Improve ParameterNotFoundException when accessing a nested parameter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | n/a
A common problem under beginners is to think that the dot notation is used to access nested arrays saved in parameters (*common here means someone asks help for this problem at least once a week on IRC*). Adding a little extra detail to the exception message and a working alternative should help pointing these people in the right direction before spending time debugging this.
It's quite late in the night over here, so the wording of the exception message probably isn't great. I'm happy to accept better suggestions 😃
Commits
-------
df70f06 [DependencyInjection] Improve ParameterNotFoundException when accessing a nested parameter
This PR was merged into the 3.2-dev branch.
Discussion
----------
[FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | -
| Fixed tickets | -
| License | MIT
| Doc PR | -
Following the cache warmer for annotations PR (https://github.com/symfony/symfony/pull/18533), this PR introduces a cache warmer for YAML and XML Validator configuration.
Based on the PhpArrayAdapter, it uses the naming conventions (`Resources/config/validation`) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.
The benefit of this PR are the same than the ones of the annotations PR:
- validation configuration can be warmed up offline
- on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances)
- on PHP 7 again, we are not sensitive to APCu memory fragmentation
- last but not least, global performance is slightly better (I get 30us per class gain in Blackfire)
This PR also deprecates the framework.validator.cache key in favor of the cache pool introduced in https://github.com/symfony/symfony/pull/18544.
Commits
-------
6bdaf0b [FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter
This PR was merged into the 3.2-dev branch.
Discussion
----------
[FrameworkBundle] add support for prioritizing form type extension tags
| Q | A
| ------------- | ---
| Branch? | "master"
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #19735
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/6958
This PR proposes to add support for `priority` on `form.type_extension` dependecyinjection tags to enable sorting/prioritizing form type extensions.
Issue was mentioned here: https://github.com/symfony/symfony/issues/19735
Commits
-------
a3db5f0 [FrameworkBundle] add support for prioritizing form type extension tags
This PR was squashed before being merged into the 2.7 branch (closes#19636).
Discussion
----------
[Finder] no PHP warning on empty directory iteration
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | Since RecursiveDirectoryIterator::SKIP_DOTS is set as flag, opendir gets a warning if an empty directory is reached
Commits
-------
695e341 [Finder] no PHP warning on empty directory iteration
This PR was merged into the 3.2-dev branch.
Discussion
----------
[FrameworkBundle] Introduce a cache warmer for Serializer based on PhpArrayAdapter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Following the cache warmer for annotations (#18533) and for the validator (#19485), this PR introduces a cache warmer for the Serializer YAML and XML metadata configuration (mainly groups).
Based on the PhpArrayAdapter, it uses the naming conventions (Resources/config/serialization) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.
The benefit of this PR are the same than the ones of the previous PR:
- serialization metadata cache can be warmed up offline
- on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances)
- on PHP 7 again, we are not sensitive to APCu memory fragmentation
last but not least, global performance is slightly better (I get 30us per class gain in Blackfire)
As previous work on the Serializer cache system introduced issues (see 96e418a14f), it would be interesting to pay careful attention to the backward compatibility during the review (ping @Ener-Getick).
Commits
-------
810f469 [FrameworkBundle] Introduce a cache warmer for Serializer based on PhpArrayAdapter
This PR was merged into the 3.2-dev branch.
Discussion
----------
[HttpFoundation] Deprecate extending some methods
| Q | A
| ------------- | ---
| Branch? | "master"
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/19727
| License | MIT
| Doc PR |
It's really hard to change methods signature because of bc. I'm proposing to deprecate extending some getters/setters of `Response` because of this (and because extending them is not really useful).
If you like this approach it could be used in other places to simplify bc in 4.0.
Edit: This causes issues (warnings always triggered) when mocking `Response` entirely but does it matter as people should only mock needed methods?
Commits
-------
c0a26bc [HttpFoundation] Deprecate extending some methods
This PR was squashed before being merged into the 3.2-dev branch (closes#19795).
Discussion
----------
Replace %count% with a given number out of the box
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | no
| License | MIT
| Doc PR | no
We already have this feature for [transchoice](https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php#L98) Twig filter, but why only for it? It will be consistent to have this for translator in general. We already have a `$number` parameter in `transChoice()` which we could easily use for that.
Before
```php
$this->get('translator')
->transChoice('1 apple|%count% apples', 7, [
'%count%' => 7,
]);
```
After:
```php
$this->get('translator')
->transChoice('1 apple|%count% apples', 7);
```
Commits
-------
4c1a65d Replace %count% with a given number out of the box
This PR was squashed before being merged into the 3.1 branch (closes#19784).
Discussion
----------
[HttpKernel] Fixed the nullable support for php 7.1 and below
| Q | A
| ------------- | ---
| Branch? | 3.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #19771
| License | MIT
| Doc PR | ~
This PR gives support for for the new php 7.1 and will only work in beta3 or higher. I've had to backport the support to 3.1 because I consider this a bug that it won't work, even though 3.1 won't be supported for much longer. ~~The deprecation I've added in the `ArgumentMetadata` should not be triggered as all framework cases create it with the argument. Just for developers who for some reason implemented this manually, I've added the deprecation.~~
~~*If needed, I can re-open this against 3.2 and leave 3.1 "broken"*~~
On 7.1 lower than beta3 this will happen but shouldn't affect any higher versions (I hope).
```
There was 1 failure:
1) Symfony\Component\HttpKernel\Tests\ControllerMetadata\ArgumentMetadataFactoryTest::testNullableTypesSignature
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
0 => Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata Object (...)
1 => Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata Object (
'name' => 'bar'
- 'type' => 'stdClass'
+ 'type' => 'Symfony\Component\HttpKernel\Tests\Fixtures\Controller\stdClass'
'isVariadic' => false
'hasDefaultValue' => false
'defaultValue' => null
'isNullable' => true
)
2 => Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata Object (...)
)
/home/ivanderberg/projects/symfony/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php:123
```
Commits
-------
4a1ab6d [HttpKernel] Fixed the nullable support for php 7.1 and below
* 2.8:
[Form] Fix typo in doc comment
[Config] Handle open_basedir restrictions in FileLocator
[bugfix] [Console] Set `Input::$interactive` to `false` when command is executed with `--quiet` as verbosity level
Use JSON_UNESCAPED_SLASHES for lint commands output
Fixed collapsed ChoiceType options attributes
Fixed the nullable support for php 7.1 and below
* 2.7:
[Form] Fix typo in doc comment
[Config] Handle open_basedir restrictions in FileLocator
[bugfix] [Console] Set `Input::$interactive` to `false` when command is executed with `--quiet` as verbosity level
Use JSON_UNESCAPED_SLASHES for lint commands output
Fixed collapsed ChoiceType options attributes
Fixed the nullable support for php 7.1 and below
This PR was merged into the 2.7 branch.
Discussion
----------
[bugfix] [Console] Set `Input::$interactive` to `false` when command is executed with `--quiet` as verbosity level
|Q |A |
|--- |--- |
|Branch |2.7 |
|Bug fix? |yes |
|New feature? |no |
|BC breaks? |yes |
|Deprecations?|no |
|Tests pass? |yes |
|Fixed tickets|#19899|
|License |MIT |
|Doc PR |n/a |
Closes#19899.
Commits
-------
4214311 [bugfix] [Console] Set `Input::$interactive` to `false` when command is executed with `--quiet` as verbosity level
This PR was merged into the 3.2-dev branch.
Discussion
----------
[FrameworkBundle] Add %debug.file_link_format% with remapping for IDE links
| Q | A
| ------------- | ---
| Branch? | master
| New feature? | yes
| Tests pass? | yes
| Fixed tickets | #14340
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/6944
`templating.helper.code.file_link_format` is a parameter that requires templating to be defined, but holds a concept that is used beyond templating borders.
Let's make it a general parameter that can be injected easily when required.
Commits
-------
1c4ca8c [FrameworkBundle] Add %debug.file_link_format% with remapping for IDE links
This PR was merged into the 3.2-dev branch.
Discussion
----------
[FrameworkBundle] Add cache:pool:clear command
| Q | A
| ------------- | ---
| Branch? | master
| New feature? | yes
| Tests pass? | yes
| License | MIT
Useful when deploying apps to get better control of cache pool clearing.
Commits
-------
37c5b18 [FrameworkBundle] Add cache:pool:clear command
This PR was merged into the 3.2-dev branch.
Discussion
----------
[FrameworkBundle] Add CachePoolClearerPass for weak cache pool refs in cache clearers
| Q | A
| ------------- | ---
| Branch? | master
| New feature? | yes
| Tests pass? | yes
| License | MIT
On 3.1, when a cache pool is private and not injected anywhere, it is still added to its clearer service.
The `CachePoolClearerPass` fixes this by referencing pools in clearers only after the removing passes.
Commits
-------
c4b9f7d [FrameworkBundle] Add CachePoolClearerPass for weak cache pool refs in cache clearers
This PR was merged into the 2.7 branch.
Discussion
----------
Fixed the nullable support for php 7.1 and below (2.7, 2.8, 3.0)
| Q | A
| ------------- | ---
| Branch? | 2.7, 2.8, 3.0
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/19784#issuecomment-243852825
| License | MIT
| Doc PR | ~
Fixes the nullable support for 2.7, 2.8 and 3.0, can probably be partially merged into 3.1 but not 100% sure.
/ping @fabpot
Commits
-------
9c48756 Fixed the nullable support for php 7.1 and below
This PR was merged into the 3.2-dev branch.
Discussion
----------
[DI] Add corresponding service id in some exception messages
| Q | A
| ------------- | ---
| Branch? | master
| New feature? | yes
| Tests pass? | yes
| License | MIT
This already helped me figure out where was my mistake :)
Commits
-------
d739f8d [DI] Add corresponding service id in some exception messages
* 2.8:
Fix version constraint
Fixed bad merge
[DoctrineBridge][PropertyInfo] Treat Doctrine decimal type as string
Make ReflectionExtractor compatible with ReflectionType changes in PHP 7.1
This PR was merged into the 2.8 branch.
Discussion
----------
[PropertyInfo] Make ReflectionExtractor compatible with ReflectionType changes in PHP 7.1
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/19677#issuecomment-244671828
| License | MIT
| Doc PR | N/A
Commits
-------
4a041e9 Make ReflectionExtractor compatible with ReflectionType changes in PHP 7.1