* 3.4:
[DI] Dont resolve envs in service ids
Add tests proving it can load annotated files
[WebProfilerBundle] Reset letter-spacing in toolbar
Prefer overflow-wrap to word-break
remove more kernel.root_dir parameter refs
[*Bundle] Replace some kernel.root_dir by kernel.project_dir
removed some phpdocs
[Routing] Fix "config-file-relative" annotation loader resources
Make search in debug:container command case-insensitive
`resolveEnvPlaceholders` will return a mixed value
Update translation commands to work with default paths
[FrameworkBundle] Fix AssetsInstallCommand
* 3.3:
[DI] Dont resolve envs in service ids
Add tests proving it can load annotated files
[WebProfilerBundle] Reset letter-spacing in toolbar
Prefer overflow-wrap to word-break
[Routing] Fix "config-file-relative" annotation loader resources
Make search in debug:container command case-insensitive
`resolveEnvPlaceholders` will return a mixed value
* 3.4: (26 commits)
[Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit
[Console] Fix disabling lazy commands
[DI] Remove scalar typehint in class used in test case
Remove the `server:log` command if monolog is not loaded
[SecurityBundle] Fix syntax error in test
[Console] Remove remaining dead code
Throw on service:method factory notation in PHP-based DI configuration
Test that named arguments are prioritized over typehinted
bumped Symfony version to 3.3.14
bumped Symfony version to 2.8.32
bumped Symfony version to 2.7.39
Prove that change is working with tests
updated VERSION for 3.3.13
updated CHANGELOG for 3.3.13
updated VERSION for 2.8.31
updated CHANGELOG for 2.8.31
updated VERSION for 2.7.38
updated CHANGELOG for 2.7.38
Replace array|\Traversable by iterable
[DI] Fix by-type args injection
...
* 3.4:
[HttpFoundation] refactoring: calculate when need
[Serializer] Fix extra attributes when no group specified
[Intl] Make intl-data tests pass and save language aliases again
[FrameworkBundle][Config] fix: do not add resource checkers for debug=false
[DI] Fix "almost-circular" dependencies handling
[Console] Fix CommandTester::setInputs() docblock
Only enabling validation if it is present
Fix displaying errors for bootstrap 4
[Serializer] readd default argument value
Fix reference dump for deprecated nodes
[PhpUnitBridge] Fixed fatal error in CoverageListener when something goes wrong in Test::setUpBeforeClass
[HttpKernel] Let the storage manage the session starts
[VarDumper] fix trailling comma when dumping an exception
[Validator] Fix TraceableValidator is reset on data collector instantiation
Remove useless docblocks
[FrameworkBundle] Fix docblocks
[PropertyInfo] Remove useless docblocks
* 3.4:
[DI] Turn services and aliases private by default, with BC layer
[WebProfiler] Fix z-index for pinned AJAX block
Require v3.4+ of the var-dumper component
* 3.4:
Do not display short exception trace for built-in console exceptions
Deprecated the web_profiler.position option
[DI] rename ResolveDefinitionTemplatesPass to ResolveChildDefinitionsPass
Throw a meaningful exception when an undefined user provider is used inside a firewall
[DI] Allow processing env vars
* 3.4:
Improved the design of the redirection method in the web toolbar
Mark SemaphoreStore::isSupported() as internal
[DI] Add ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE
[FrameworkBundle] Fix form conflict rule
[Security] add impersonator_user to "User was reloaded" log message
[DI] Add upgrade note about case insenstive params
add (pdo|chain) cache (adapter|simple) prune method
Update NoSuchPropertyException message for writeProperty
[Routing] added the possibility to define a prefix for all routes of a controller
[DI] Don't track merged configs when the extension doesn't expose it
[Cache] Use namespace versioning for backends that dont support clearing by keys
[VarDumper] add force-collapse/expand + use it for traces
* 3.4:
[Console] Add protected static $defaultName to set the default name of a Command
removed sf2 references
[Console] Allow commands to provide a default name for compile time registration
[DI] Case sensitive parameter names
This PR was merged into the 3.4 branch.
Discussion
----------
[DI] Case sensitive parameter names
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #23809
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
@GuilhemN took your patch.. but i use the same deprecation messages as for case sensitive service id's, i found it more clear. Also comparing to $origName to keep the diff smaller
Commits
-------
8a1d16839e [DI] Case sensitive parameter names
* 3.4:
[Webprofiler] Added blocks that allows extension of the profiler page.
[Dotenv] Get env using $_SERVER to work with fastcgi_param and workaround thread safety issues
[Dotenv][WebServerBundle] Override previously loaded variables
Create an interface for TranslationWriter
[Translation] Adding the ability do dump <notes> in xliff2.0
[DI] Use GlobResource for non-tracked directories
[DI] Fix resolving env vars when compiling a ContainerBuilder
[SecurityBundle] resolve class name parameter inside AddSecurityVotersPass
[FrameworkBundle] Add soft conflict rule of "cache:clear" + HttpKernel 3.4
[WebProfilerBundle] Re add missing link to the controller
* 3.4:
[VarDumper] Fix tests with phpredis 3.1.3
[Routing] Use "controller" keyword for configuring routes controllers
[VarDumper] Fix interval caster with PT3600S-like spec
[DI] Fix reading env vars from fastcgi params
[HttpKernel] Remove old container files
Allow phpdocumentor/reflection-docblock 4.
[VarDumper] play nice with open_basedir when looking for composer.json
* 3.2:
[Security] Fix wrong term in UserProviderInterface
[HttpFoundation] Set meta refresh time to 0 in RedirectResponse content
disable inlining deprecated services
[Cache] add constructor docblocks for clarity
[Security] validate empty passwords again
[DI] Remove irrelevant comment from container
[TwigBridge] cleaner implementation of the TwigRenderer
* 2.8:
[Security] Fix wrong term in UserProviderInterface
[HttpFoundation] Set meta refresh time to 0 in RedirectResponse content
disable inlining deprecated services
[Security] validate empty passwords again
[DI] Remove irrelevant comment from container
[TwigBridge] cleaner implementation of the TwigRenderer
Also, not allowing arguments or method calls for autoconfigure. This is a safety
mechanism, since we don't have merging logic. It will allow us to add this in the
future if we want to.
The reason is that parent-child definitions are a different mechanism for "inheritance"
than instanceofConditionas and defaults... creating some edge cases when trying to
figure out which settings "win". For example:
Suppose a child and parent definitions are defined in different YAML files. The
child receives public: false from its _defaults, and the parent receives public: true
from its _defaults. Should the final child definition be public: true (so the parent
overrides the child, even though it only came from _defaults) or public: false (where
the child wins... even though it was only set from its _defaults). Or, if the parent
is explicitly set to public: true, should that override the public: false of the
child (which it got from its _defaults)? On one hand, the parent is being explicitly
set. On the other hand, the child is explicitly in a file settings _defaults public
to false. There's no correct answer.
There are also problems with instanceof. The importance goes:
defaults < instanceof < service definition
But how does parent-child relationships fit into that? If a child has public: false
from an _instanceof, but the parent explicitly sets public: true, which wins? Should
we assume the parent definition wins because it's explicitly set? Or would the
_instanceof win, because that's being explicitly applied to the child definition's
class by an _instanceof that lives in the same file as that class (whereas the parent
definition may live in a different file).
Because of this, @nicolas-grekas and I (we also talked a bit to Fabien) decided that
the complexity was growing too much. The solution is to not allow any of these
new feature to be used by ChildDefinition objects. In other words, when you want some
sort of "inheritance" for your service, you should *either* giving your service a
parent *or* using defaults and instanceof. And instead of silently not applying
defaults and instanceof to child definitions, I think it's better to scream that it's
not supported.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DX] [DI] Throw more helpful error when shortcutting global classes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? |no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22146
| License | MIT
As discussed in #22146 the error message received when trying to use a class in the global
namespace as a service without defined class is confusing. Helpful information was added
pointing out this current limitation.
Commits
-------
b9e7b4fd61 [DependencyInjection] Throw helpful error when shortcutting global classes
As discussed in #22146 the error message received when trying to use a class in the global
namespace as a service without defined class is confusing. Helpful information was added
pointing out this current limitation.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] make the service container builder register its own self referencing definition
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Commits
-------
9c97496b5f [DependencyInjection] make the service container builder register the definition of its related service container service (and aliases) in order to make compiler passes be able to reference the special service_container service.
* 3.2:
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
Further refactorings to PHPUnit namespaces
resolve parameters in definition classes
* 2.8:
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
Further refactorings to PHPUnit namespaces
resolve parameters in definition classes
* 3.2:
Fix typo in process error message
Update to PHPUnit namespaces
Minor typo fix messsagesData -> messagesData
remove translation data collector when not usable
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Config][DI] Add ComposerResource to track the runtime engine + deps
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
So that the container is invalidated whenever a new PHP runtime is used, a PHP-extension is added, or vendors are changed.
Commits
-------
a960c761d1 [Config][DI] Add ComposerResource to track runtime + vendors
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] ContainerBuilder::compile() can optionally resolve env vars in parameter bag
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #21420
| License | MIT
| Doc PR | -
Here is a new feature allowing one to do `$container->compile(true)` and get the env vars resolved using the current env.
Commits
-------
a3fd512271 [DI] ContainerBuilder::compile() can optionally resolve env vars in parameter bag
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI][Config] Add & use ReflectionClassResource
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #21079
| License | MIT
| Doc PR | -
With new changes comming to 3.3, we need a more generic reflection tracking logic than the one already managed by the autowiring subsystem.
This PR adds a new ReflectionClassResource in the Config component, and a new ContainerBuilder::getReflectionClass() method in the DI one (for fetching+tracking reflection-related info).
ReflectionClassResource tracks changes to any public or protected properties/method.
PR updated and ready, best viewed [ignoring whitespaces](https://github.com/symfony/symfony/pull/21419/files?w=1).
changelog:
* added `ReflectionClassResource` class
* added second `$exists` constructor argument to `ClassExistenceResource` - with a special mode that prevents fatal errors from happening when some parent class is broken (logic generalized from AutowiringPass)
* made `ClassExistenceResource` also work with interfaces and traits
* added `ContainerBuilder::getReflectionClass()` for retrieving and tracking reflection class info
* deprecated `ContainerBuilder::getClassResource()`, use `ContainerBuilder::getReflectionClass()` or `ContainerBuilder::addObjectResource()` instead
Commits
-------
37e44939ef [DI][Config] Add & use ReflectionClassResource
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Allow to count on lazy collection arguments
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21450#issuecomment-275931764
| License | MIT
| Doc PR | todo (with https://github.com/symfony/symfony-docs/issues/7336)
When using the new iterator feature of the DI component to lazy load collection, we always know the number of arguments in the collection (only the invalidBehavior set to `IGNORE_ON_INVALID_REFERENCE` may change this number). So we are able to generate and use a `RewindableGenerator` implementing `\Countable` by computing this value ahead.
So, in a service accepting `array|iterable`, like in the `GuardAuthenticationListener` (see #21450):
```php
class GuardAuthenticationListener implements ListenerInterface
{
private $guardAuthenticators;
/**
* @param iterable|GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider
* @param LoggerInterface $logger A LoggerInterface instance
*/
public function __construct($guardAuthenticators, LoggerInterface $logger = null)
{
// ...
}
public function handle(GetResponseEvent $event)
{
if (null !== $this->logger) {
$context = array()
if (is_array($this->guardAuthenticators) || $this->guardAuthenticators instanceof \Countable) {
$context['authenticators'] = count($this->guardAuthenticators);
}
$this->logger->debug('Checking for guard authentication credentials.', $context);
}
// ...
}
}
```
we still keep the ability to call count without loosing the lazy load benefits.
Commits
-------
f23e460 [DI] Allow to count on lazy collection arguments
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Add getter injection
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20657
| License | MIT
| Doc PR | symfony/symfony-docs#7300
Getter overriding by the container will allow a new kind of dependency injection which enables easier laziness and more immutable classes, by not requiring any corresponding setter. See linked issue for more.
This is WIP:
- [x] wire the concept
- [x] dump anonymous classes with PhpDumper
- [x] generate at runtime in ContainerBuilder::createService
- [x] tests
- [x] make it work on PHP 5
Commits
-------
cb498580d1 [DI] Add getter injection
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Make ContainerBuilder::resolveEnvPlaceholders() able to inline the values of referenced env vars.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Being able to resolve environment variables at compile time as a replacement for `SYMFONY__` special env vars, unlocking their deprecation (see #20100).
Commits
-------
713b081 [DI] Make ContainerBuilder::resolveEnvPlaceholders() able to inline the values of referenced env vars.
The DefinitionDecorator class does not deal with decorated services. It
reflects a parent-child-relationship between definitions instead. To
avoid confusion, this commit deprecates the existing DefinitionDecorator
class and introduces a new ChildDefinition class as replacement.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] Added a shortcut method for autowired definitions
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | todo
This is a simple proposal to make adding autowired definitions to the `ContainerBuilder` a little easier. Registering autowired services in PHP code was quite verbose at the moment, while the whole point of autowiring is quick service registration.
**Before**
```php
$container->register('app.twig_extension', AppExtension::class)
->setAutowired(true)
->addTag('twig.extension')
;
```
**After**
```php
$container->autowire('app.twig_extension', AppExtension::class)
->addTag('twig.extension')
;
```
With https://github.com/symfony/symfony/pull/20264, this will be even nicer:
```php
$container->autowire(AppExtension::class)
->addTag('twig.extension')
;
```
Commits
-------
6ef4ce8 Added a shortcut method for autowired definitions
* 3.1:
[Routing] Fail properly when a route parameter name cannot be used as a PCRE subpattern name
[FrameworkBundle] Improve performance of ControllerNameParser
Update documentation link to the component
[HttpFoundation] Add links to RFC-7231
[DI] Initialize properties before method calls
Tag missing internals
[WebProfilerBundle] Dont use request attributes in RouterController
Fix complete config tests
* 2.8:
[Routing] Fail properly when a route parameter name cannot be used as a PCRE subpattern name
[FrameworkBundle] Improve performance of ControllerNameParser
Update documentation link to the component
[HttpFoundation] Add links to RFC-7231
[DI] Initialize properties before method calls
Tag missing internals
[WebProfilerBundle] Dont use request attributes in RouterController
Fix complete config tests
* 2.7:
[Routing] Fail properly when a route parameter name cannot be used as a PCRE subpattern name
[FrameworkBundle] Improve performance of ControllerNameParser
Update documentation link to the component
[HttpFoundation] Add links to RFC-7231
[DI] Initialize properties before method calls
Tag missing internals
[WebProfilerBundle] Dont use request attributes in RouterController
Fix complete config tests
This PR was squashed before being merged into the 2.7 branch (closes#20566).
Discussion
----------
[DI] Initialize properties before method calls
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes-ish
| New feature? | no
| BC breaks? | not sure
| Deprecations? | no
| Tests pass? | not yet (only dumps seem to fail)
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License | MIT
| Doc PR | reference to the documentation PR, if any
Given
```yml
services:
handler:
class: AppBundle\Handler
properties:
debug: '%kernel.debug%'
calls:
- [handle]
```
I totally expected `Handler::$debug` to be set before `Handler::handle` is called. It was not.. and it's really annoying :)
Commits
-------
0af433b [DI] Initialize properties before method calls
* 3.1:
[DI] Fixed custom services definition BC break introduced in ec7e70fb…
[Process] Fix kill process on reached timeout using getIterator()
[DI] Aliases should preserve the aliased invalid behavior
This PR was squashed before being merged into the 2.7 branch (closes#20609).
Discussion
----------
[DI] Fixed custom services definition BC break introduced in ec7e70fb…
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no, fixes previous BC
| Deprecations? | no
| Tests pass? | yes (verified on Win only)
| Fixed tickets | #20608
| License | MIT
| Doc PR | -
Commits
-------
7a5e11e [DI] Fixed custom services definition BC break introduced in ec7e70fb…