Skip to content

Commit 9fd693b

Browse files
Replace the fluent PHP config format by the array-shape one
1 parent ecc48a8 commit 9fd693b

File tree

116 files changed

+7349
-5683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+7349
-5683
lines changed

bundles/configuration.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ as integration of other related components:
2323
.. code-block:: php
2424
2525
// config/packages/framework.php
26-
use Symfony\Config\FrameworkConfig;
26+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
2727
28-
return static function (FrameworkConfig $framework): void {
29-
$framework->form()->enabled(true);
30-
};
28+
return App::config([
29+
'framework' => [
30+
'form' => true,
31+
],
32+
]);
3133
3234
There are two different ways of creating friendly configuration for a bundle:
3335

@@ -148,13 +150,16 @@ can add some configuration that looks like this:
148150
.. code-block:: php
149151
150152
// config/packages/acme_social.php
151-
use Symfony\Config\AcmeSocialConfig;
152-
153-
return static function (AcmeSocialConfig $acmeSocial): void {
154-
$acmeSocial->twitter()
155-
->clientId(123)
156-
->clientSecret('your_secret');
157-
};
153+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
154+
155+
return App::config([
156+
'acme_social' => [
157+
'twitter' => [
158+
'client_id' => 123,
159+
'client_secret' => 'your_secret',
160+
],
161+
],
162+
]);
158163
159164
The basic idea is that instead of having the user override individual
160165
parameters, you let the user configure just a few, specifically created,

bundles/prepend_extension.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,16 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to
113113
// config/packages/acme_something.php
114114
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
115115
116-
return static function (ContainerConfigurator $container): void {
117-
$container->extension('acme_something', [
118-
// ...
116+
return App::config([
117+
'acme_something' => [
119118
'use_acme_goodbye' => false,
120119
'entity_manager_name' => 'non_default',
121-
]);
122-
$container->extension('acme_other', [
120+
],
121+
'acme_other' => [
123122
// ...
124123
'use_acme_goodbye' => false,
125-
]);
126-
};
124+
],
125+
]);
127126
128127
Prepending Extension in the Bundle Class
129128
----------------------------------------

0 commit comments

Comments
 (0)