From d9de74fe02d0ee2755109f22c2f605751eb48153 Mon Sep 17 00:00:00 2001 From: Jan Tvrdik Date: Sun, 20 Dec 2020 16:05:23 +0100 Subject: [PATCH] MigrationsExtension: replace deprecated setClass() with setType() --- src/Bridges/NetteDI/MigrationsExtension.php | 22 ++++++++++----------- tests/matrix/nette-di/nette-2.4-php-7.1.sh | 2 +- tests/matrix/nette-di/nette-2.4-php-7.2.sh | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Bridges/NetteDI/MigrationsExtension.php b/src/Bridges/NetteDI/MigrationsExtension.php index c837f07..004916c 100644 --- a/src/Bridges/NetteDI/MigrationsExtension.php +++ b/src/Bridges/NetteDI/MigrationsExtension.php @@ -173,7 +173,7 @@ private function getDbalDefinition($dbal) if ($factory) { return $this->getContainerBuilder() ->addDefinition($this->prefix('dbal')) - ->setClass(Nextras\Migrations\IDbal::class) + ->setType(Nextras\Migrations\IDbal::class) ->setFactory($factory); } elseif ($dbal === null) { @@ -218,7 +218,7 @@ private function getDriverDefinition($driver, $dbal) if ($factory) { return $this->getContainerBuilder() ->addDefinition($this->prefix('driver')) - ->setClass(Nextras\Migrations\IDriver::class) + ->setType(Nextras\Migrations\IDriver::class) ->setFactory($factory); } elseif ($driver === null) { @@ -260,7 +260,7 @@ private function getPrinterDefinition($printer) if ($factory) { return $this->getContainerBuilder() ->addDefinition($this->prefix('printer')) - ->setClass(Nextras\Migrations\IPrinter::class) + ->setType(Nextras\Migrations\IPrinter::class) ->setFactory($factory); } elseif ($printer === null) { @@ -358,7 +358,7 @@ private function createGroupDefinitions(array $groups): array $groupDefinitions[] = $builder->addDefinition($this->prefix("group.$serviceName")) ->addTag(self::TAG_GROUP, ['for' => [$this->name]]) ->setAutowired(false) - ->setClass(Nextras\Migrations\Entities\Group::class) + ->setType(Nextras\Migrations\Entities\Group::class) ->addSetup('$name', [$groupName]) ->addSetup('$enabled', [$enabled]) ->addSetup('$directory', [$directory]) @@ -382,12 +382,12 @@ private function createExtensionHandlerDefinitions($driver, array $phpParams): a $sqlHandler = $builder->addDefinition($this->prefix('extensionHandler.sql')) ->addTag(self::TAG_EXTENSION_HANDLER, ['for' => [$this->name], 'extension' => 'sql']) ->setAutowired(false) - ->setClass(Nextras\Migrations\Extensions\SqlHandler::class) + ->setType(Nextras\Migrations\Extensions\SqlHandler::class) ->setArguments([$driver]); $phpHandler = $builder->addDefinition($this->prefix('extensionHandler.php')) ->addTag(self::TAG_EXTENSION_HANDLER, ['for' => [$this->name], 'extension' => 'php']) - ->setClass(Nextras\Migrations\Extensions\PhpHandler::class) + ->setType(Nextras\Migrations\Extensions\PhpHandler::class) ->setAutowired(false) ->setArguments([$phpParams]); @@ -399,7 +399,7 @@ private function createConfigurationDefinition(): ServiceDefinition { return $this->getContainerBuilder() ->addDefinition($this->prefix('configuration')) - ->setClass(Nextras\Migrations\IConfiguration::class) + ->setType(Nextras\Migrations\IConfiguration::class) ->setFactory(Nextras\Migrations\Configurations\Configuration::class); } @@ -410,7 +410,7 @@ private function createDoctrineStructureDiffGeneratorDefinition(?string $ignored return $builder->addDefinition($this->prefix('diffGenerator.structures')) ->setAutowired(false) - ->setClass(Nextras\Migrations\IDiffGenerator::class) + ->setType(Nextras\Migrations\IDiffGenerator::class) ->setFactory(Nextras\Migrations\Bridges\DoctrineOrm\StructureDiffGenerator::class) ->setArguments(['@Doctrine\ORM\EntityManagerInterface', $ignoredQueriesFile]); } @@ -427,17 +427,17 @@ private function createSymfonyCommandDefinitions($driver, $configuration, $print $builder->addExcludedClasses([Nextras\Migrations\Bridges\SymfonyConsole\BaseCommand::class]); $builder->addDefinition($this->prefix('continueCommand')) - ->setClass(Nextras\Migrations\Bridges\SymfonyConsole\ContinueCommand::class) + ->setType(Nextras\Migrations\Bridges\SymfonyConsole\ContinueCommand::class) ->setArguments([$driver, $configuration, $printer]) ->addTag('kdyby.console.command'); $builder->addDefinition($this->prefix('createCommand')) - ->setClass(Nextras\Migrations\Bridges\SymfonyConsole\CreateCommand::class) + ->setType(Nextras\Migrations\Bridges\SymfonyConsole\CreateCommand::class) ->setArguments([$driver, $configuration, $printer]) ->addTag('kdyby.console.command'); $builder->addDefinition($this->prefix('resetCommand')) - ->setClass(Nextras\Migrations\Bridges\SymfonyConsole\ResetCommand::class) + ->setType(Nextras\Migrations\Bridges\SymfonyConsole\ResetCommand::class) ->setArguments([$driver, $configuration, $printer]) ->addTag('kdyby.console.command'); } diff --git a/tests/matrix/nette-di/nette-2.4-php-7.1.sh b/tests/matrix/nette-di/nette-2.4-php-7.1.sh index 4b0efa5..0c427ec 100644 --- a/tests/matrix/nette-di/nette-2.4-php-7.1.sh +++ b/tests/matrix/nette-di/nette-2.4-php-7.1.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash PHP_VERSION_MIN="70100" PHP_VERSION_MAX="70199" -COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/di:~2.4.1" +COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/di:~2.4.10" COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/utils:~2.4.0" COMPOSER_REQUIRE="$COMPOSER_REQUIRE dibi/dibi:~4.0" COMPOSER_REQUIRE="$COMPOSER_REQUIRE doctrine/dbal:~2.5" diff --git a/tests/matrix/nette-di/nette-2.4-php-7.2.sh b/tests/matrix/nette-di/nette-2.4-php-7.2.sh index b9f9c3e..16d1cfd 100644 --- a/tests/matrix/nette-di/nette-2.4-php-7.2.sh +++ b/tests/matrix/nette-di/nette-2.4-php-7.2.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash PHP_VERSION_MIN="70200" PHP_VERSION_MAX="70299" -COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/di:~2.4.7" +COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/di:~2.4.10" COMPOSER_REQUIRE="$COMPOSER_REQUIRE nette/utils:~2.4.5" COMPOSER_REQUIRE="$COMPOSER_REQUIRE dibi/dibi:~4.0" COMPOSER_REQUIRE="$COMPOSER_REQUIRE doctrine/dbal:~2.5"