Skip to content

Commit 776698b

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

File tree

114 files changed

+7321
-5688
lines changed

Some content is hidden

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

114 files changed

+7321
-5688
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\Config;
2727
28-
return static function (FrameworkConfig $framework): void {
29-
$framework->form()->enabled(true);
30-
};
28+
return [
29+
new FrameworkConfig([
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\Config;
154+
155+
return [
156+
new AcmeSocialConfig([
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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,19 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to
111111
.. code-block:: php
112112
113113
// config/packages/acme_something.php
114-
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
114+
namespace Symfony\Config;
115115
116-
return static function (ContainerConfigurator $container): void {
117-
$container->extension('acme_something', [
116+
return [
117+
new AcmeSomethingConfig([
118118
// ...
119119
'use_acme_goodbye' => false,
120120
'entity_manager_name' => 'non_default',
121-
]);
122-
$container->extension('acme_other', [
121+
]),
122+
new AcmeOtherConfig([
123123
// ...
124124
'use_acme_goodbye' => false,
125-
]);
126-
};
125+
]),
126+
];
127127
128128
Prepending Extension in the Bundle Class
129129
----------------------------------------

0 commit comments

Comments
 (0)