From ebd8e9b217fb76af473be606b23278a33255556e Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Fri, 24 May 2024 07:22:20 +0200 Subject: [PATCH] Improve naming of compiler pass classes --- ...pesCompilerPass.php => CarbonTypesCompilerPass.php} | 2 +- ...pesCompilerPass.php => CustomTypesCompilerPass.php} | 2 +- src/HeadsnetDoctrineToolsBundle.php | 8 ++++---- .../RegisterCarbonTypesCompilerPassTest.php | 10 +++++----- .../RegisterDoctrineTypesCompilerPassTest.php | 8 ++++---- tests/HeadsnetDoctrineToolsBundleTest.php | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) rename src/CarbonTypes/{RegisterCarbonTypesCompilerPass.php => CarbonTypesCompilerPass.php} (96%) rename src/CustomTypes/{RegisterDoctrineTypesCompilerPass.php => CustomTypesCompilerPass.php} (97%) diff --git a/src/CarbonTypes/RegisterCarbonTypesCompilerPass.php b/src/CarbonTypes/CarbonTypesCompilerPass.php similarity index 96% rename from src/CarbonTypes/RegisterCarbonTypesCompilerPass.php rename to src/CarbonTypes/CarbonTypesCompilerPass.php index b84cc6d..9f7263d 100644 --- a/src/CarbonTypes/RegisterCarbonTypesCompilerPass.php +++ b/src/CarbonTypes/CarbonTypesCompilerPass.php @@ -9,7 +9,7 @@ /** * Automatically registers the custom Doctrine types provided by the Carbon library. */ -final class RegisterCarbonTypesCompilerPass implements CompilerPassInterface +final class CarbonTypesCompilerPass implements CompilerPassInterface { private const TYPE_DEFINITION_PARAMETER = 'doctrine.dbal.connection_factory.types'; diff --git a/src/CustomTypes/RegisterDoctrineTypesCompilerPass.php b/src/CustomTypes/CustomTypesCompilerPass.php similarity index 97% rename from src/CustomTypes/RegisterDoctrineTypesCompilerPass.php rename to src/CustomTypes/CustomTypesCompilerPass.php index e564b99..f5a8a4f 100644 --- a/src/CustomTypes/RegisterDoctrineTypesCompilerPass.php +++ b/src/CustomTypes/CustomTypesCompilerPass.php @@ -15,7 +15,7 @@ * * This saves having to specify them all individually in the Doctrine configuration which is tedious. */ -final class RegisterDoctrineTypesCompilerPass implements CompilerPassInterface +final class CustomTypesCompilerPass implements CompilerPassInterface { private const TYPE_DEFINITION_PARAMETER = 'doctrine.dbal.connection_factory.types'; diff --git a/src/HeadsnetDoctrineToolsBundle.php b/src/HeadsnetDoctrineToolsBundle.php index 420b85c..965070f 100644 --- a/src/HeadsnetDoctrineToolsBundle.php +++ b/src/HeadsnetDoctrineToolsBundle.php @@ -2,8 +2,8 @@ namespace Headsnet\DoctrineToolsBundle; -use Headsnet\DoctrineToolsBundle\CarbonTypes\RegisterCarbonTypesCompilerPass; -use Headsnet\DoctrineToolsBundle\CustomTypes\RegisterDoctrineTypesCompilerPass; +use Headsnet\DoctrineToolsBundle\CarbonTypes\CarbonTypesCompilerPass; +use Headsnet\DoctrineToolsBundle\CustomTypes\CustomTypesCompilerPass; use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; @@ -54,11 +54,11 @@ public function build(ContainerBuilder $container): void parent::build($container); $container->addCompilerPass( - new RegisterDoctrineTypesCompilerPass() + new CustomTypesCompilerPass() ); $container->addCompilerPass( - new RegisterCarbonTypesCompilerPass() + new CarbonTypesCompilerPass() ); } } diff --git a/tests/CarbonTypes/RegisterCarbonTypesCompilerPassTest.php b/tests/CarbonTypes/RegisterCarbonTypesCompilerPassTest.php index 04aee43..47c1886 100644 --- a/tests/CarbonTypes/RegisterCarbonTypesCompilerPassTest.php +++ b/tests/CarbonTypes/RegisterCarbonTypesCompilerPassTest.php @@ -5,13 +5,13 @@ use Carbon\Doctrine\DateTimeImmutableType; use Carbon\Doctrine\DateTimeType; -use Headsnet\DoctrineToolsBundle\CarbonTypes\RegisterCarbonTypesCompilerPass; +use Headsnet\DoctrineToolsBundle\CarbonTypes\CarbonTypesCompilerPass; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; -#[CoversClass(RegisterCarbonTypesCompilerPass::class)] +#[CoversClass(CarbonTypesCompilerPass::class)] class RegisterCarbonTypesCompilerPassTest extends TestCase { #[Test] @@ -21,7 +21,7 @@ public function carbon_types_are_registered(): void $container->setParameter('doctrine.dbal.connection_factory.types', []); $container->setParameter('headsnet_doctrine_tools.carbon_types.enabled', true); $container->setParameter('headsnet_doctrine_tools.carbon_types.replace', true); - $sut = new RegisterCarbonTypesCompilerPass(); + $sut = new CarbonTypesCompilerPass(); $sut->process($container); @@ -44,7 +44,7 @@ public function carbon_types_are_registered_separately(): void $container->setParameter('doctrine.dbal.connection_factory.types', []); $container->setParameter('headsnet_doctrine_tools.carbon_types.enabled', true); $container->setParameter('headsnet_doctrine_tools.carbon_types.replace', false); - $sut = new RegisterCarbonTypesCompilerPass(); + $sut = new CarbonTypesCompilerPass(); $sut->process($container); @@ -66,7 +66,7 @@ public function if_disabled_then_register_nothing(): void $container = new ContainerBuilder(); $container->setParameter('doctrine.dbal.connection_factory.types', []); $container->setParameter('headsnet_doctrine_tools.carbon_types.enabled', false); - $sut = new RegisterCarbonTypesCompilerPass(); + $sut = new CarbonTypesCompilerPass(); $sut->process($container); diff --git a/tests/CustomTypes/RegisterDoctrineTypesCompilerPassTest.php b/tests/CustomTypes/RegisterDoctrineTypesCompilerPassTest.php index 9b34bce..062bbb7 100644 --- a/tests/CustomTypes/RegisterDoctrineTypesCompilerPassTest.php +++ b/tests/CustomTypes/RegisterDoctrineTypesCompilerPassTest.php @@ -4,7 +4,7 @@ namespace Headsnet\DoctrineToolsBundle\Tests\CustomTypes; use Headsnet\DoctrineToolsBundle\CustomTypes\CustomTypeNamer; -use Headsnet\DoctrineToolsBundle\CustomTypes\RegisterDoctrineTypesCompilerPass; +use Headsnet\DoctrineToolsBundle\CustomTypes\CustomTypesCompilerPass; use Headsnet\DoctrineToolsBundle\Tests\CustomTypes\Fixtures\DummyCustomType; use Headsnet\DoctrineToolsBundle\Tests\CustomTypes\Fixtures\DummyCustomTypeWithName; use PHPUnit\Framework\Attributes\CoversClass; @@ -12,7 +12,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; -#[CoversClass(RegisterDoctrineTypesCompilerPass::class)] +#[CoversClass(CustomTypesCompilerPass::class)] #[CoversClass(CustomTypeNamer::class)] class RegisterDoctrineTypesCompilerPassTest extends TestCase { @@ -24,7 +24,7 @@ public function can_find_and_register_types(): void $container->setParameter('headsnet_doctrine_tools.custom_types.scan_dirs', [ __DIR__ . '/Fixtures', ]); - $sut = new RegisterDoctrineTypesCompilerPass(); + $sut = new CustomTypesCompilerPass(); $sut->process($container); @@ -52,7 +52,7 @@ public function ignores_types_that_are_manually_registered(): void $container->setParameter('headsnet_doctrine_tools.custom_types.scan_dirs', [ __DIR__ . '/Fixtures', ]); - $sut = new RegisterDoctrineTypesCompilerPass(); + $sut = new CustomTypesCompilerPass(); $sut->process($container); diff --git a/tests/HeadsnetDoctrineToolsBundleTest.php b/tests/HeadsnetDoctrineToolsBundleTest.php index 8c4b8ff..8ae45b0 100644 --- a/tests/HeadsnetDoctrineToolsBundleTest.php +++ b/tests/HeadsnetDoctrineToolsBundleTest.php @@ -3,8 +3,8 @@ namespace Headsnet\DoctrineToolsBundle\Tests; -use Headsnet\DoctrineToolsBundle\CarbonTypes\RegisterCarbonTypesCompilerPass; -use Headsnet\DoctrineToolsBundle\CustomTypes\RegisterDoctrineTypesCompilerPass; +use Headsnet\DoctrineToolsBundle\CarbonTypes\CarbonTypesCompilerPass; +use Headsnet\DoctrineToolsBundle\CustomTypes\CustomTypesCompilerPass; use Headsnet\DoctrineToolsBundle\HeadsnetDoctrineToolsBundle; use Nyholm\BundleTest\TestKernel; use PHPUnit\Framework\Attributes\CoversClass; @@ -13,8 +13,8 @@ use Symfony\Component\HttpKernel\KernelInterface; #[CoversClass(HeadsnetDoctrineToolsBundle::class)] -#[CoversClass(RegisterCarbonTypesCompilerPass::class)] -#[CoversClass(RegisterDoctrineTypesCompilerPass::class)] +#[CoversClass(CarbonTypesCompilerPass::class)] +#[CoversClass(CustomTypesCompilerPass::class)] class HeadsnetDoctrineToolsBundleTest extends KernelTestCase { protected static function getKernelClass(): string