From 0e5dea3dc24198456440044c26e6721840e5e4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 10 Nov 2024 22:26:41 +0100 Subject: [PATCH] Remove deprecated methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luís Cobucci --- src/Builder.php | 16 ---------------- src/ContainerBuilder.php | 25 ------------------------- test/ContainerBuilderTest.php | 13 ------------- 3 files changed, 54 deletions(-) diff --git a/src/Builder.php b/src/Builder.php index 0393805b..32128143 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -15,13 +15,6 @@ interface Builder { public const DEFAULT_PRIORITY = 0; - /** - * Changes the generator to handle the files - * - * @deprecated This is deprecated in favour of using the correct naming constructor. - */ - public function setGenerator(Generator $generator): Builder; - /** * Add a file to be loaded */ @@ -58,15 +51,6 @@ public function addPackage(string $className, array $constructArguments = []): B */ public function setProfileName(string $profileName): Builder; - /** - * Mark the container to be used as development mode - * - * @deprecated this method will be removed in favour of a more explicit name. - * - * @see enableDebugging - */ - public function useDevelopmentMode(): Builder; - /** * Configure the container to track file updates */ diff --git a/src/ContainerBuilder.php b/src/ContainerBuilder.php index 9aa752e9..e6a425fd 100644 --- a/src/ContainerBuilder.php +++ b/src/ContainerBuilder.php @@ -25,19 +25,6 @@ public function __construct( $this->setDefaultConfiguration(); } - /** - * @deprecated Use the named constructor according to the generator - * - * @see ContainerBuilder::xml() - * @see ContainerBuilder::yaml() - * @see ContainerBuilder::php() - * @see ContainerBuilder::delegating() - */ - public static function default(string $configurationFile, string $namespace): self - { - return self::xml($configurationFile, $namespace); - } - /** @param class-string $builderClass */ public static function xml( string $configurationFile, @@ -100,13 +87,6 @@ private function setDefaultConfiguration(): void $this->config->addPass($this->parameterBag); } - public function setGenerator(Generator $generator): Builder - { - $this->generator = $generator; - - return $this; - } - public function addFile(string $file): Builder { $this->config->addFile($file); @@ -151,11 +131,6 @@ public function setProfileName(string $profileName): Builder return $this; } - public function useDevelopmentMode(): Builder - { - return $this->enableDebugging(); - } - public function enableDebugging(): Builder { $this->parameterBag->set('app.devmode', true); diff --git a/test/ContainerBuilderTest.php b/test/ContainerBuilderTest.php index d61f4bb7..19900330 100644 --- a/test/ContainerBuilderTest.php +++ b/test/ContainerBuilderTest.php @@ -59,7 +59,6 @@ public function namedConstructorsShouldSimplifyTheObjectCreation( /** @return iterable}> */ public static function supportedFormats(): iterable { - yield 'default' => ['default', new Generators\Xml(__FILE__)]; yield 'xml' => ['xml', new Generators\Xml(__FILE__)]; yield 'yaml' => ['yaml', new Generators\Yaml(__FILE__)]; yield 'php' => ['php', new Generators\Php(__FILE__)]; @@ -99,18 +98,6 @@ public function constructShouldReceiveTheDependenciesAsArguments(): void self::assertFalse($this->parameterBag->get('app.devmode')); } - #[PHPUnit\Test] - public function setGeneratorShouldChangeTheAttributeAndReturnSelf(): void - { - $builder = new ContainerBuilder($this->config, $this->generator, $this->parameterBag); - $generator = $this->createMock(Generator::class); - $expected = new ContainerBuilder($this->config, $generator, $this->parameterBag); - - // @phpstan-ignore-next-line method is deprecated and will be removed in the next major version - self::assertSame($builder, $builder->setGenerator($generator)); - self::assertEquals($expected, $builder); - } - #[PHPUnit\Test] public function addFileShouldAppendANewFileOnTheListAndReturnSelf(): void {