Skip to content

Commit 730f41f

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

File tree

114 files changed

+6501
-5525
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

+6501
-5525
lines changed

bundles/configuration.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ 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 new FrameworkConfig([
29+
'form' => true,
30+
]);
3131
3232
There are two different ways of creating friendly configuration for a bundle:
3333

@@ -148,13 +148,14 @@ can add some configuration that looks like this:
148148
.. code-block:: php
149149
150150
// config/packages/acme_social.php
151-
use Symfony\Config\AcmeSocialConfig;
151+
namespace Symfony\Config;
152152
153-
return static function (AcmeSocialConfig $acmeSocial): void {
154-
$acmeSocial->twitter()
155-
->clientId(123)
156-
->clientSecret('your_secret');
157-
};
153+
return new AcmeSocialConfig([
154+
'twitter' => [
155+
'client_id' => 123,
156+
'client_secret' => 'your_secret',
157+
],
158+
]);
158159
159160
The basic idea is that instead of having the user override individual
160161
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)