-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Standardize the name of the container configurator variable #17664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xabbuh
merged 1 commit into
symfony:5.4
from
alamirault:feature/17381-standardize-container-configurator-variable
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,8 +442,8 @@ The end user can provide values in any configuration file: | |
// config/services.php | ||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->parameters() | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->parameters() | ||
->set('acme_blog.author.email', '[email protected]') | ||
; | ||
}; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,18 +78,18 @@ shown in these three formats. | |
{ | ||
// ... | ||
|
||
private function configureContainer(ContainerConfigurator $container): void | ||
private function configureContainer(ContainerConfigurator $containerConfigurator): void | ||
{ | ||
$configDir = $this->getConfigDir(); | ||
|
||
$container->import($configDir.'/{packages}/*.{yaml,php}'); | ||
$container->import($configDir.'/{packages}/'.$this->environment.'/*.{yaml,php}'); | ||
$containerConfigurator->import($configDir.'/{packages}/*.{yaml,php}'); | ||
$containerConfigurator->import($configDir.'/{packages}/'.$this->environment.'/*.{yaml,php}'); | ||
|
||
if (is_file($configDir.'/services.yaml')) { | ||
$container->import($configDir.'/services.yaml'); | ||
$container->import($configDir.'/{services}_'.$this->environment.'.yaml'); | ||
$containerConfigurator->import($configDir.'/services.yaml'); | ||
$containerConfigurator->import($configDir.'/{services}_'.$this->environment.'.yaml'); | ||
} else { | ||
$container->import($configDir.'/{services}.php'); | ||
$containerConfigurator->import($configDir.'/{services}.php'); | ||
} | ||
} | ||
} | ||
|
@@ -163,17 +163,17 @@ configuration files, even if they use a different format: | |
// config/services.php | ||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->import('legacy_config.php'); | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->import('legacy_config.php'); | ||
|
||
// glob expressions are also supported to load multiple files | ||
$container->import('/etc/myapp/*.yaml'); | ||
$containerConfigurator->import('/etc/myapp/*.yaml'); | ||
|
||
// the third optional argument of import() is 'ignore_errors' | ||
// 'ignore_errors' set to 'not_found' silently discards errors if the loaded file doesn't exist | ||
$container->import('my_config_file.yaml', null, 'not_found'); | ||
$containerConfigurator->import('my_config_file.yaml', null, 'not_found'); | ||
// 'ignore_errors' set to true silently discards all errors (including invalid code and not found) | ||
$container->import('my_config_file.yaml', null, true); | ||
$containerConfigurator->import('my_config_file.yaml', null, true); | ||
}; | ||
|
||
// ... | ||
|
@@ -262,8 +262,8 @@ reusable configuration value. By convention, parameters are defined under the | |
|
||
use App\Entity\BlogPost; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->parameters() | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->parameters() | ||
// the parameter name is an arbitrary string (the 'app.' prefix is recommended | ||
// to better differentiate your parameters from Symfony parameters). | ||
->set('app.admin_email', '[email protected]') | ||
|
@@ -334,8 +334,8 @@ configuration file using a special syntax: wrap the parameter name in two ``%`` | |
// config/packages/some_package.php | ||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->extension('some_package', [ | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->extension('some_package', [ | ||
// any string surrounded by two % is replaced by that parameter value | ||
'email_address' => '%app.admin_email%', | ||
|
||
|
@@ -371,8 +371,8 @@ configuration file using a special syntax: wrap the parameter name in two ``%`` | |
// config/services.php | ||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->parameters() | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->parameters() | ||
->set('url_pattern', 'http://symfony.com/?foo=%%s&bar=%%d'); | ||
}; | ||
|
||
|
@@ -508,20 +508,20 @@ files directly in the ``config/packages/`` directory. | |
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symfony\Config\WebpackEncoreConfig; | ||
|
||
return static function (WebpackEncoreConfig $webpackEncore, ContainerConfigurator $container) { | ||
return static function (WebpackEncoreConfig $webpackEncore, ContainerConfigurator $containerConfigurator) { | ||
$webpackEncore | ||
->outputPath('%kernel.project_dir%/public/build') | ||
->strictMode(true) | ||
->cache(false) | ||
; | ||
|
||
// cache is enabled only in the "prod" environment | ||
if ('prod' === $container->env()) { | ||
if ('prod' === $containerConfigurator->env()) { | ||
$webpackEncore->cache(true); | ||
} | ||
|
||
// disable strict mode only in the "test" environment | ||
if ('test' === $container->env()) { | ||
if ('test' === $containerConfigurator->env()) { | ||
$webpackEncore->strictMode(false); | ||
} | ||
}; | ||
|
@@ -642,8 +642,8 @@ This example shows how you could configure the database connection using an env | |
// config/packages/doctrine.php | ||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->extension('doctrine', [ | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->extension('doctrine', [ | ||
'dbal' => [ | ||
// by convention the env var names are always uppercase | ||
'url' => env('DATABASE_URL')->resolve(), | ||
|
@@ -991,8 +991,8 @@ doesn't work for parameters: | |
|
||
use App\Service\MessageGenerator; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->parameters() | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->parameters() | ||
->set('app.contents_dir', '...'); | ||
|
||
$container->services() | ||
|
@@ -1048,8 +1048,8 @@ whenever a service/controller defines a ``$projectDir`` argument, use this: | |
|
||
use App\Controller\LuckyController; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->services() | ||
->defaults() | ||
// pass this value to any $projectDir argument for any service | ||
// that's created in this file (including controller arguments) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found some places where variables does not match,
$container
injected but$configurator
used.