Skip to content

Commit c47fb9d

Browse files
feature #62135 [Config] Deprecate config builder generators (nicolas-grekas)
This PR was merged into the 7.4 branch. Discussion ---------- [Config] Deprecate config builder generators | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | | Issues | - | License | MIT You served us well! 👋 Commits ------- 85a9b76 [Config] Deprecate config builder generators
2 parents 2a1d924 + 85a9b76 commit c47fb9d

File tree

10 files changed

+21
-11
lines changed

10 files changed

+21
-11
lines changed

UPGRADE-7.4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Config
2323

2424
* Deprecate accessing the internal scope of the loader in PHP config files, use only its public API instead
2525
* Deprecate setting a default value to a node that is required, and vice versa
26-
* Deprecate generating fluent methods in config builders
26+
* Deprecate fluent config builders, return PHP arrays from your config instead
2727

2828
Console
2929
-------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CHANGELOG
1818
* Add support for union types with `Symfony\Component\EventDispatcher\Attribute\AsEventListener`
1919
* Add `framework.allowed_http_method_override` option
2020
* Initialize `router.request_context`'s `_locale` parameter to `%kernel.default_locale%`
21+
* Deprecate `ConfigBuilderCacheWarmer`, return PHP arrays from your config instead
2122

2223
7.3
2324
---

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
3232
*
33-
* @final since Symfony 7.1
33+
* @deprecated since Symfony 7.4
3434
*/
3535
class ConfigBuilderCacheWarmer implements CacheWarmerInterface
3636
{

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
4848
use Symfony\Component\Cache\ResettableInterface;
4949
use Symfony\Component\Clock\ClockInterface;
50+
use Symfony\Component\Config\Builder\ConfigBuilderGenerator;
5051
use Symfony\Component\Config\Definition\ConfigurationInterface;
5152
use Symfony\Component\Config\FileLocator;
5253
use Symfony\Component\Config\Loader\LoaderInterface;
@@ -297,6 +298,9 @@ public function load(array $configs, ContainerBuilder $container): void
297298
if (!class_exists(IsSignatureValidAttributeListener::class)) {
298299
$container->removeDefinition('controller.is_signature_valid_attribute_listener');
299300
}
301+
if (!class_exists(ConfigBuilderGenerator::class)) {
302+
$container->removeDefinition('config_builder.warmer');
303+
}
300304

301305
if ($this->hasConsole()) {
302306
$loader->load('console.php');

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
1313

14+
use PHPUnit\Framework\Attributes\Group;
15+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1416
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer;
1517
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
1618
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -31,7 +33,9 @@
3133
use Symfony\Component\HttpKernel\Kernel;
3234
use Symfony\Component\HttpKernel\KernelInterface;
3335

34-
class ConfigBuilderCacheWarmerTest extends TestCase
36+
#[IgnoreDeprecations]
37+
#[Group('legacy')]
38+
final class ConfigBuilderCacheWarmerTest extends TestCase
3539
{
3640
private string $varDir;
3741

src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
* Generate ConfigBuilders to help create valid config.
3131
*
3232
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
33+
*
34+
* @deprecated since Symfony 7.4
3335
*/
3436
class ConfigBuilderGenerator implements ConfigBuilderGeneratorInterface
3537
{

src/Symfony/Component/Config/Builder/ConfigBuilderGeneratorInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Generates ConfigBuilders to help create valid config.
1818
*
1919
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
20+
*
21+
* @deprecated since Symfony 7.4
2022
*/
2123
interface ConfigBuilderGeneratorInterface
2224
{

src/Symfony/Component/Config/Builder/ConfigBuilderInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* A ConfigBuilder provides helper methods to build a large complex array.
1616
*
1717
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
18+
*
19+
* @deprecated since Symfony 7.4
1820
*/
1921
interface ConfigBuilderInterface
2022
{

src/Symfony/Component/Config/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CHANGELOG
1111
* Add array-shapes to generated config builders
1212
* Deprecate accessing the internal scope of the loader in PHP config files, use only its public API instead
1313
* Deprecate setting a default value to a node that is required, and vice versa
14-
* Deprecate generating fluent methods in config builders
14+
* Deprecate fluent config builders, return PHP arrays from your config instead
1515

1616
7.3
1717
---

src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@
1111

1212
namespace Symfony\Component\Config\Tests\Builder;
1313

14-
use PHPUnit\Framework\Attributes\CoversClass;
1514
use PHPUnit\Framework\Attributes\DataProvider;
1615
use PHPUnit\Framework\Attributes\Group;
1716
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1817
use PHPUnit\Framework\TestCase;
1918
use Symfony\Component\Config\Builder\ClassBuilder;
2019
use Symfony\Component\Config\Builder\ConfigBuilderGenerator;
2120
use Symfony\Component\Config\Builder\ConfigBuilderInterface;
22-
use Symfony\Component\Config\Builder\Method;
23-
use Symfony\Component\Config\Builder\Property;
2421
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2522
use Symfony\Component\Config\Tests\Builder\Fixtures\AddToList;
2623
use Symfony\Component\Config\Tests\Builder\Fixtures\NodeInitialValues;
@@ -35,10 +32,8 @@
3532
*
3633
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
3734
*/
38-
#[CoversClass(ClassBuilder::class)]
39-
#[CoversClass(ConfigBuilderGenerator::class)]
40-
#[CoversClass(Method::class)]
41-
#[CoversClass(Property::class)]
35+
#[IgnoreDeprecations]
36+
#[Group('legacy')]
4237
class GeneratedConfigTest extends TestCase
4338
{
4439
private array $tempDir = [];

0 commit comments

Comments
 (0)