From 72854231c7d216451060102e84839aa41b3e17f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Thu, 13 May 2021 09:16:51 +0200 Subject: [PATCH] Bump doctrine/coding-standard 8.x -> 9.x --- CacheWarmer/DoctrineMetadataCacheWarmer.php | 4 +- Command/DoctrineCommand.php | 4 +- Command/ImportMappingDoctrineCommand.php | 4 +- .../Proxy/CollectionRegionDoctrineCommand.php | 4 +- .../EntityRegionCacheDoctrineCommand.php | 4 +- .../Proxy/QueryRegionCacheDoctrineCommand.php | 4 +- ConnectionFactory.php | 11 ++--- DataCollector/DoctrineDataCollector.php | 41 +++++-------------- Dbal/BlacklistSchemaAssetFilter.php | 12 ++---- Dbal/RegexSchemaAssetFilter.php | 4 +- Dbal/SchemaAssetsFilterManager.php | 8 +--- .../Compiler/EntityListenerPass.php | 4 +- DependencyInjection/Configuration.php | 4 +- DependencyInjection/DoctrineExtension.php | 4 +- Mapping/ClassMetadataCollection.php | 24 +++-------- Mapping/ContainerEntityListenerResolver.php | 12 ++---- Mapping/DisconnectedMetadataFactory.php | 8 +--- Repository/ContainerRepositoryFactory.php | 4 +- Repository/ServiceEntityRepository.php | 1 - Tests/Builder/BundleConfigurationBuilder.php | 16 ++------ Tests/Command/CreateDatabaseDoctrineTest.php | 12 ++---- Tests/Command/DropDatabaseDoctrineTest.php | 8 ++-- .../ImportMappingDoctrineCommandTest.php | 8 +--- .../Command/Proxy/InfoDoctrineCommandTest.php | 4 +- .../DoctrineDataCollectorTest.php | 4 +- .../AbstractDoctrineExtensionTest.php | 21 +++------- .../DependencyInjection/ConfigurationTest.php | 4 +- .../DoctrineExtensionTest.php | 28 ++++--------- .../Entity/TestCustomIdGeneratorEntity.php | 4 +- .../Entity/TestCustomClassRepoEntity.php | 4 +- .../Entity/TestCustomServiceRepoEntity.php | 4 +- .../Entity/TestDefaultRepoEntity.php | 4 +- .../Fixtures/DbalTestKernel.php | 8 +--- .../Fixtures/TestKernel.php | 4 +- Tests/DependencyInjection/XMLSchemaTest.php | 8 +--- .../ContainerRepositoryFactoryTest.php | 8 +--- Tests/Twig/DoctrineExtensionTest.php | 12 ++---- Tests/UrlOverrideTest.php | 4 +- composer.json | 2 +- phpcs.xml.dist | 3 -- 40 files changed, 85 insertions(+), 246 deletions(-) diff --git a/CacheWarmer/DoctrineMetadataCacheWarmer.php b/CacheWarmer/DoctrineMetadataCacheWarmer.php index 67c93c3e6..140bdac91 100644 --- a/CacheWarmer/DoctrineMetadataCacheWarmer.php +++ b/CacheWarmer/DoctrineMetadataCacheWarmer.php @@ -36,9 +36,7 @@ public function isOptional(): bool return false; } - /** - * @param string $cacheDir - */ + /** @param string $cacheDir */ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter): bool { // cache already warmed up, no needs to do it again diff --git a/Command/DoctrineCommand.php b/Command/DoctrineCommand.php index 8ab9c5a29..44b98a122 100644 --- a/Command/DoctrineCommand.php +++ b/Command/DoctrineCommand.php @@ -88,9 +88,7 @@ protected function getDoctrineConnection($name) return $this->getDoctrine()->getConnection($name); } - /** - * @return ManagerRegistry - */ + /** @return ManagerRegistry */ protected function getDoctrine() { return $this->doctrine; diff --git a/Command/ImportMappingDoctrineCommand.php b/Command/ImportMappingDoctrineCommand.php index 5ba506d6d..fcf8c8e09 100644 --- a/Command/ImportMappingDoctrineCommand.php +++ b/Command/ImportMappingDoctrineCommand.php @@ -33,9 +33,7 @@ class ImportMappingDoctrineCommand extends DoctrineCommand /** @var string[] */ private $bundles; - /** - * @param string[] $bundles - */ + /** @param string[] $bundles */ public function __construct(ManagerRegistry $doctrine, array $bundles) { parent::__construct($doctrine); diff --git a/Command/Proxy/CollectionRegionDoctrineCommand.php b/Command/Proxy/CollectionRegionDoctrineCommand.php index 5bd0a16eb..0f66b19e4 100644 --- a/Command/Proxy/CollectionRegionDoctrineCommand.php +++ b/Command/Proxy/CollectionRegionDoctrineCommand.php @@ -29,9 +29,7 @@ protected function configure() $this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command'); } - /** - * @return int - */ + /** @return int */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/Command/Proxy/EntityRegionCacheDoctrineCommand.php b/Command/Proxy/EntityRegionCacheDoctrineCommand.php index 0e04e3842..dfb8d8fb9 100644 --- a/Command/Proxy/EntityRegionCacheDoctrineCommand.php +++ b/Command/Proxy/EntityRegionCacheDoctrineCommand.php @@ -29,9 +29,7 @@ protected function configure() $this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command'); } - /** - * @return int - */ + /** @return int */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/Command/Proxy/QueryRegionCacheDoctrineCommand.php b/Command/Proxy/QueryRegionCacheDoctrineCommand.php index 016c8fa4a..ada63a1e4 100644 --- a/Command/Proxy/QueryRegionCacheDoctrineCommand.php +++ b/Command/Proxy/QueryRegionCacheDoctrineCommand.php @@ -29,9 +29,7 @@ protected function configure() $this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command'); } - /** - * @return int - */ + /** @return int */ protected function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); diff --git a/ConnectionFactory.php b/ConnectionFactory.php index 715fc8fe0..803da3149 100644 --- a/ConnectionFactory.php +++ b/ConnectionFactory.php @@ -19,9 +19,7 @@ use const PHP_EOL; -/** - * @psalm-import-type Params from DriverManager - */ +/** @psalm-import-type Params from DriverManager */ class ConnectionFactory { /** @var mixed[][] */ @@ -30,9 +28,7 @@ class ConnectionFactory /** @var bool */ private $initialized = false; - /** - * @param mixed[][] $typesConfig - */ + /** @param mixed[][] $typesConfig */ public function __construct(array $typesConfig) { $this->typesConfig = $typesConfig; @@ -43,10 +39,9 @@ public function __construct(array $typesConfig) * * @param mixed[] $params * @param array $mappingTypes + * @psalm-param Params $params * * @return Connection - * - * @psalm-param Params $params */ public function createConnection(array $params, ?Configuration $config = null, ?EventManager $eventManager = null, array $mappingTypes = []) { diff --git a/DataCollector/DoctrineDataCollector.php b/DataCollector/DoctrineDataCollector.php index 122096580..cca34d4b5 100644 --- a/DataCollector/DoctrineDataCollector.php +++ b/DataCollector/DoctrineDataCollector.php @@ -2,6 +2,7 @@ namespace Doctrine\Bundle\DoctrineBundle\DataCollector; +use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Cache\CacheConfiguration; use Doctrine\ORM\Cache\Logging\CacheLoggerChain; use Doctrine\ORM\Cache\Logging\StatisticsCacheLogger; @@ -29,7 +30,7 @@ * sql: string, * params: ?array, * runnable: bool, - * types: ?array, + * types: ?array, * } * @psalm-type DataType = array{ * caches: array{ @@ -180,49 +181,37 @@ public function collect(Request $request, Response $response, ?Throwable $except $this->groupedQueries = null; } - /** - * @return array> - */ + /** @return array> */ public function getEntities() { return $this->data['entities']; } - /** - * @return array>> - */ + /** @return array>> */ public function getMappingErrors() { return $this->data['errors']; } - /** - * @return int - */ + /** @return int */ public function getCacheHitsCount() { return $this->data['caches']['counts']['hits']; } - /** - * @return int - */ + /** @return int */ public function getCachePutsCount() { return $this->data['caches']['counts']['puts']; } - /** - * @return int - */ + /** @return int */ public function getCacheMissesCount() { return $this->data['caches']['counts']['misses']; } - /** - * @return bool - */ + /** @return bool */ public function getCacheEnabled() { return $this->data['caches']['enabled']; @@ -230,7 +219,6 @@ public function getCacheEnabled() /** * @return array> - * * @psalm-return array<"puts"|"hits"|"misses", array> */ public function getCacheRegions() @@ -238,17 +226,13 @@ public function getCacheRegions() return $this->data['caches']['regions']; } - /** - * @return array - */ + /** @return array */ public function getCacheCounts() { return $this->data['caches']['counts']; } - /** - * @return int - */ + /** @return int */ public function getInvalidEntityCount() { if ($this->invalidEntityCount === null) { @@ -260,7 +244,6 @@ public function getInvalidEntityCount() /** * @return string[][] - * * @psalm-return array> */ public function getGroupedQueries() @@ -316,9 +299,7 @@ private function executionTimePercentage(int $executionTimeMS, int $totalExecuti return $executionTimeMS / $totalExecutionTimeMS * 100; } - /** - * @return int - */ + /** @return int */ public function getGroupedQueryCount() { $count = 0; diff --git a/Dbal/BlacklistSchemaAssetFilter.php b/Dbal/BlacklistSchemaAssetFilter.php index e2b2d145a..7d5b7f744 100644 --- a/Dbal/BlacklistSchemaAssetFilter.php +++ b/Dbal/BlacklistSchemaAssetFilter.php @@ -6,25 +6,19 @@ use function in_array; -/** - * @deprecated Implement your own include/exclude mechanism - */ +/** @deprecated Implement your own include/exclude mechanism */ class BlacklistSchemaAssetFilter { /** @var string[] */ private $blacklist; - /** - * @param string[] $blacklist - */ + /** @param string[] $blacklist */ public function __construct(array $blacklist) { $this->blacklist = $blacklist; } - /** - * @param string|AbstractAsset $assetName - */ + /** @param string|AbstractAsset $assetName */ public function __invoke($assetName): bool { if ($assetName instanceof AbstractAsset) { diff --git a/Dbal/RegexSchemaAssetFilter.php b/Dbal/RegexSchemaAssetFilter.php index 384126540..186403d99 100644 --- a/Dbal/RegexSchemaAssetFilter.php +++ b/Dbal/RegexSchemaAssetFilter.php @@ -16,9 +16,7 @@ public function __construct(string $filterExpression) $this->filterExpression = $filterExpression; } - /** - * @param string|AbstractAsset $assetName - */ + /** @param string|AbstractAsset $assetName */ public function __invoke($assetName): bool { if ($assetName instanceof AbstractAsset) { diff --git a/Dbal/SchemaAssetsFilterManager.php b/Dbal/SchemaAssetsFilterManager.php index 2003113e9..ecb7648a7 100644 --- a/Dbal/SchemaAssetsFilterManager.php +++ b/Dbal/SchemaAssetsFilterManager.php @@ -12,17 +12,13 @@ class SchemaAssetsFilterManager /** @var callable[] */ private $schemaAssetFilters; - /** - * @param callable[] $schemaAssetFilters - */ + /** @param callable[] $schemaAssetFilters */ public function __construct(array $schemaAssetFilters) { $this->schemaAssetFilters = $schemaAssetFilters; } - /** - * @param string|AbstractAsset $assetName - */ + /** @param string|AbstractAsset $assetName */ public function __invoke($assetName): bool { foreach ($this->schemaAssetFilters as $schemaAssetFilter) { diff --git a/DependencyInjection/Compiler/EntityListenerPass.php b/DependencyInjection/Compiler/EntityListenerPass.php index 863129f9f..45bd829f5 100644 --- a/DependencyInjection/Compiler/EntityListenerPass.php +++ b/DependencyInjection/Compiler/EntityListenerPass.php @@ -94,9 +94,7 @@ public function process(ContainerBuilder $container) } } - /** - * @param array{entity: class-string, event: string} $attributes - */ + /** @param array{entity: class-string, event: string} $attributes */ private function attachToListener(ContainerBuilder $container, string $name, string $class, array $attributes): void { $listenerId = sprintf('doctrine.orm.%s_listeners.attach_entity_listeners', $name); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 1f4c7cb63..5ca7228bc 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -39,9 +39,7 @@ class Configuration implements ConfigurationInterface /** @var bool */ private $debug; - /** - * @param bool $debug Whether to use the debug mode - */ + /** @param bool $debug Whether to use the debug mode */ public function __construct(bool $debug) { $this->debug = $debug; diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index e090ace9a..740d09cfa 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -518,9 +518,7 @@ protected function ormLoad(array $config, ContainerBuilder $container) $container->registerForAutoconfiguration(AbstractIdGenerator::class) ->addTag(IdGeneratorPass::ID_GENERATOR_TAG); - /** - * @see DoctrineBundle::boot() - */ + /** @see DoctrineBundle::boot() */ $container->getDefinition($defaultEntityManagerDefinitionId) ->addTag('container.preload', [ 'class' => Autoloader::class, diff --git a/Mapping/ClassMetadataCollection.php b/Mapping/ClassMetadataCollection.php index c65b47fc5..068d861e8 100644 --- a/Mapping/ClassMetadataCollection.php +++ b/Mapping/ClassMetadataCollection.php @@ -15,49 +15,37 @@ class ClassMetadataCollection /** @var ClassMetadata[] */ private $metadata; - /** - * @param ClassMetadata[] $metadata - */ + /** @param ClassMetadata[] $metadata */ public function __construct(array $metadata) { $this->metadata = $metadata; } - /** - * @return ClassMetadata[] - */ + /** @return ClassMetadata[] */ public function getMetadata() { return $this->metadata; } - /** - * @param string $path - */ + /** @param string $path */ public function setPath($path) { $this->path = $path; } - /** - * @return string - */ + /** @return string */ public function getPath() { return $this->path; } - /** - * @param string $namespace - */ + /** @param string $namespace */ public function setNamespace($namespace) { $this->namespace = $namespace; } - /** - * @return string - */ + /** @return string */ public function getNamespace() { return $this->namespace; diff --git a/Mapping/ContainerEntityListenerResolver.php b/Mapping/ContainerEntityListenerResolver.php index 1ce5136fd..fd9dde57b 100644 --- a/Mapping/ContainerEntityListenerResolver.php +++ b/Mapping/ContainerEntityListenerResolver.php @@ -12,9 +12,7 @@ use function sprintf; use function trim; -/** - * @final - */ +/** @final */ class ContainerEntityListenerResolver implements EntityListenerServiceResolver { /** @var ContainerInterface */ @@ -26,9 +24,7 @@ class ContainerEntityListenerResolver implements EntityListenerServiceResolver /** @var string[] Map to store registered service ids */ private $serviceIds = []; - /** - * @param ContainerInterface $container a service locator for listeners - */ + /** @param ContainerInterface $container a service locator for listeners */ public function __construct(ContainerInterface $container) { $this->container = $container; @@ -90,9 +86,7 @@ public function resolve($className) return $this->instances[$className]; } - /** - * @return object - */ + /** @return object */ private function resolveService(string $serviceId) { if (! $this->container->has($serviceId)) { diff --git a/Mapping/DisconnectedMetadataFactory.php b/Mapping/DisconnectedMetadataFactory.php index 50c5ed27f..ac9603558 100644 --- a/Mapping/DisconnectedMetadataFactory.php +++ b/Mapping/DisconnectedMetadataFactory.php @@ -28,9 +28,7 @@ class DisconnectedMetadataFactory /** @var ManagerRegistry */ private $registry; - /** - * @param ManagerRegistry $registry A ManagerRegistry instance - */ + /** @param ManagerRegistry $registry A ManagerRegistry instance */ public function __construct(ManagerRegistry $registry) { $this->registry = $registry; @@ -178,9 +176,7 @@ private function getMetadataForClass(string $entity): ClassMetadataCollection return new ClassMetadataCollection([]); } - /** - * @return ClassMetadata[] - */ + /** @return ClassMetadata[] */ private function getAllMetadata(): array { $metadata = []; diff --git a/Repository/ContainerRepositoryFactory.php b/Repository/ContainerRepositoryFactory.php index 7c66184f2..1907c5384 100644 --- a/Repository/ContainerRepositoryFactory.php +++ b/Repository/ContainerRepositoryFactory.php @@ -26,9 +26,7 @@ final class ContainerRepositoryFactory implements RepositoryFactory /** @var ContainerInterface */ private $container; - /** - * @param ContainerInterface $container A service locator containing the repositories - */ + /** @param ContainerInterface $container A service locator containing the repositories */ public function __construct(ContainerInterface $container) { $this->container = $container; diff --git a/Repository/ServiceEntityRepository.php b/Repository/ServiceEntityRepository.php index 46857e6f6..877d447f1 100644 --- a/Repository/ServiceEntityRepository.php +++ b/Repository/ServiceEntityRepository.php @@ -29,7 +29,6 @@ class ServiceEntityRepository extends EntityRepository implements ServiceEntityR { /** * @param string $entityClass The class name of the entity this repository manages - * * @psalm-param class-string $entityClass */ public function __construct(ManagerRegistry $registry, string $entityClass) diff --git a/Tests/Builder/BundleConfigurationBuilder.php b/Tests/Builder/BundleConfigurationBuilder.php index cdc52f255..c9c388d17 100644 --- a/Tests/Builder/BundleConfigurationBuilder.php +++ b/Tests/Builder/BundleConfigurationBuilder.php @@ -60,9 +60,7 @@ public function addBaseSecondLevelCache(): self return $this; } - /** - * @param array $config - */ + /** @param array $config */ public function addConnection(array $config): self { $this->configuration['dbal'] = $config; @@ -70,9 +68,7 @@ public function addConnection(array $config): self return $this; } - /** - * @param array $config - */ + /** @param array $config */ public function addEntityManager(array $config): self { $this->configuration['orm'] = $config; @@ -80,9 +76,7 @@ public function addEntityManager(array $config): self return $this; } - /** - * @param array $config - */ + /** @param array $config */ public function addSecondLevelCache(array $config, string $manager = 'default'): self { $this->configuration['orm']['entity_managers'][$manager]['second_level_cache'] = $config; @@ -90,9 +84,7 @@ public function addSecondLevelCache(array $config, string $manager = 'default'): return $this; } - /** - * @return array - */ + /** @return array */ public function build(): array { return $this->configuration; diff --git a/Tests/Command/CreateDatabaseDoctrineTest.php b/Tests/Command/CreateDatabaseDoctrineTest.php index 51d699b36..6d76e5295 100644 --- a/Tests/Command/CreateDatabaseDoctrineTest.php +++ b/Tests/Command/CreateDatabaseDoctrineTest.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\DriverManager; use Doctrine\Persistence\ManagerRegistry; use Generator; use PHPUnit\Framework\MockObject\MockObject; @@ -16,9 +17,7 @@ use function sys_get_temp_dir; use function unlink; -/** - * @psalm-import-type Params from \Doctrine\DBAL\DriverManager - */ +/** @psalm-import-type Params from DriverManager */ class CreateDatabaseDoctrineTest extends TestCase { public function tearDown(): void @@ -55,9 +54,7 @@ public function testExecute(): void ); } - /** - * @dataProvider provideShardOption - */ + /** @dataProvider provideShardOption */ public function testExecuteWithShardAlias(string $shardOption): void { $connectionName = 'default'; @@ -116,10 +113,9 @@ public function provideShardOption(): Generator /** * @param mixed[]|null $params Connection parameters + * @psalm-param Params $params * * @return MockObject&Container - * - * @psalm-param Params $params */ private function getMockContainer(string $connectionName, ?array $params = null): MockObject { diff --git a/Tests/Command/DropDatabaseDoctrineTest.php b/Tests/Command/DropDatabaseDoctrineTest.php index d906dcd5f..cee8c84af 100644 --- a/Tests/Command/DropDatabaseDoctrineTest.php +++ b/Tests/Command/DropDatabaseDoctrineTest.php @@ -5,6 +5,7 @@ use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand; use Doctrine\DBAL\Connection; use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Exception; use Doctrine\Persistence\ManagerRegistry; use Generator; @@ -19,9 +20,7 @@ use function sprintf; use function sys_get_temp_dir; -/** - * @psalm-import-type Params from \Doctrine\DBAL\DriverManager - */ +/** @psalm-import-type Params from DriverManager */ class DropDatabaseDoctrineTest extends TestCase { /** @@ -142,10 +141,9 @@ public function provideIncompatibleDriverOptions(): Generator /** * @param list $params Connection parameters + * @psalm-param Params $params * * @return MockObject&Container - * - * @psalm-param Params $params */ private function getMockContainer(string $connectionName, array $params): MockObject { diff --git a/Tests/Command/ImportMappingDoctrineCommandTest.php b/Tests/Command/ImportMappingDoctrineCommandTest.php index 14c27d013..99f693af4 100644 --- a/Tests/Command/ImportMappingDoctrineCommandTest.php +++ b/Tests/Command/ImportMappingDoctrineCommandTest.php @@ -15,9 +15,7 @@ use function interface_exists; use function sys_get_temp_dir; -/** - * @group legacy - */ +/** @group legacy */ class ImportMappingDoctrineCommandTest extends TestCase { /** @var TestKernel|null */ @@ -38,9 +36,7 @@ public static function setUpBeforeClass(): void protected function setup(): void { $this->kernel = new class () extends TestKernel { - /** - * @return iterable - */ + /** @return iterable */ public function registerBundles(): iterable { yield from parent::registerBundles(); diff --git a/Tests/Command/Proxy/InfoDoctrineCommandTest.php b/Tests/Command/Proxy/InfoDoctrineCommandTest.php index 5cb69e1ae..c0db5e497 100644 --- a/Tests/Command/Proxy/InfoDoctrineCommandTest.php +++ b/Tests/Command/Proxy/InfoDoctrineCommandTest.php @@ -39,9 +39,7 @@ public function testExecute(): void ); } - /** - * @return MockObject&Kernel - */ + /** @return MockObject&Kernel */ private function setupKernelMocks(): MockObject { $configuration = new Configuration(); diff --git a/Tests/DataCollector/DoctrineDataCollectorTest.php b/Tests/DataCollector/DoctrineDataCollectorTest.php index d9aa20aa5..8307d624d 100644 --- a/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -125,9 +125,7 @@ private function createEntityMetadata(string $entityFQCN): ClassMetadataInfo return $metadata; } - /** - * @param array $managers - */ + /** @param array $managers */ private function createCollector(array $managers, bool $shouldValidateSchema = true): DoctrineDataCollector { $registry = $this->getMockBuilder(ManagerRegistry::class)->getMock(); diff --git a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index e211aa4a4..0f075f0b4 100644 --- a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Connections\MasterSlaveConnection; use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection; +use Doctrine\DBAL\DriverManager; use Doctrine\ORM\EntityManagerInterface; use Generator; use InvalidArgumentException; @@ -39,9 +40,7 @@ use const DIRECTORY_SEPARATOR; -/** - * @psalm-import-type Params from \Doctrine\DBAL\DriverManager - */ +/** @psalm-import-type Params from DriverManager */ abstract class AbstractDoctrineExtensionTest extends TestCase { abstract protected function loadFromFile(ContainerBuilder $container, string $file): void; @@ -1237,9 +1236,7 @@ public function testDisableSchemaValidation(): void $this->assertFalse($collectorDefinition->getArguments()[1]); } - /** - * @param list $bundles - */ + /** @param list $bundles */ private function loadContainer( string $fixture, array $bundles = ['YamlBundle'], @@ -1259,9 +1256,7 @@ private function loadContainer( return $container; } - /** - * @param list $bundles - */ + /** @param list $bundles */ private function getContainer(array $bundles): ContainerBuilder { $map = []; @@ -1297,9 +1292,7 @@ private function assertDICDefinitionClass(Definition $definition, string $expect $this->assertEquals($expectedClass, $definition->getClass(), 'Expected Class of the DIC Container Service Definition is wrong.'); } - /** - * @param list $args - */ + /** @param list $args */ private function assertDICConstructorArguments(Definition $definition, array $args): void { $this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '" . $definition->getClass() . "' don't match."); @@ -1307,7 +1300,6 @@ private function assertDICConstructorArguments(Definition $definition, array $ar /** * @param list $params - * * @psalm-param Params $params */ private function assertDICDefinitionMethodCallAt( @@ -1336,7 +1328,6 @@ private function assertDICDefinitionMethodCallAt( * Assertion for the DI Container, check if the given definition contains a method call with the given parameters. * * @param list $params - * * @psalm-param Params $params */ private function assertDICDefinitionMethodCallOnce( @@ -1370,7 +1361,6 @@ private function assertDICDefinitionMethodCallOnce( /** * @param list $params - * * @psalm-param Params $params */ private function assertDICDefinitionMethodCallCount( @@ -1404,7 +1394,6 @@ private function assertDICDefinitionMethodCallCount( * Assertion for the DI Container, check if the given definition does not contain a method call with the given parameters. * * @param list $params - * * @psalm-param Params $params */ private function assertDICDefinitionNoMethodCall( diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 50ee92053..19ecd7528 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -20,9 +20,7 @@ class ConfigurationTest extends TestCase */ protected $preserveGlobalState = false; - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testGetConfigTreeBuilderDoNotUseDoctrineCommon(): void { $configuration = new Configuration(true); diff --git a/Tests/DependencyInjection/DoctrineExtensionTest.php b/Tests/DependencyInjection/DoctrineExtensionTest.php index ab6b527c1..ae028e2b9 100644 --- a/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -203,9 +203,7 @@ public function testOrmRequiresDbal(): void $extension->load([['orm' => ['auto_mapping' => true]]], $this->getContainer()); } - /** - * @return mixed[][][][] - */ + /** @return mixed[][][][] */ public function getAutomappingConfigurations(): array { return [ @@ -863,9 +861,7 @@ public function testMessengerIntegration(): void } } - /** - * @group legacy - */ + /** @group legacy */ public function testInvalidCacheConfiguration(): void { if (! interface_exists(EntityManagerInterface::class)) { @@ -923,9 +919,7 @@ public function testLegacyCacheConfiguration(string $expectedAliasName, string $ $this->testCacheConfiguration($expectedAliasName, $expectedAliasTarget, $cacheName, $cacheConfig); } - /** - * @return array> - */ + /** @return array> */ public static function legacyCacheConfigurationProvider(): array { return [ @@ -950,9 +944,7 @@ public static function legacyCacheConfigurationProvider(): array ]; } - /** - * @return array> - */ + /** @return array> */ public static function cacheConfigurationProvider(): array { return [ @@ -1033,9 +1025,7 @@ public function testShardManager(): void $this->assertEquals($managerClass, $bazManagerDef->getClass()); } - /** - * @param list $bundles - */ + /** @param list $bundles */ private function getContainer(array $bundles = ['YamlBundle'], string $vendor = ''): ContainerBuilder { $map = []; @@ -1061,17 +1051,13 @@ private function getContainer(array $bundles = ['YamlBundle'], string $vendor = return $container; } - /** - * @param list $args - */ + /** @param list $args */ private function assertDICConstructorArguments(Definition $definition, array $args): void { $this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '" . $definition->getClass() . "' don't match."); } - /** - * @param list $params - */ + /** @param list $params */ private function assertDICDefinitionMethodCallAt(int $pos, Definition $definition, string $methodName, ?array $params = null): void { $calls = $definition->getMethodCalls(); diff --git a/Tests/DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity/TestCustomIdGeneratorEntity.php b/Tests/DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity/TestCustomIdGeneratorEntity.php index 5ae47550b..488fd9d65 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity/TestCustomIdGeneratorEntity.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity/TestCustomIdGeneratorEntity.php @@ -4,9 +4,7 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ +/** @ORM\Entity */ class TestCustomIdGeneratorEntity { /** diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomClassRepoEntity.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomClassRepoEntity.php index 50dfd2e02..d23f7d459 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomClassRepoEntity.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomClassRepoEntity.php @@ -4,9 +4,7 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass="Fixtures\Bundles\RepositoryServiceBundle\Repository\TestCustomClassRepoRepository") - */ +/** @ORM\Entity(repositoryClass="Fixtures\Bundles\RepositoryServiceBundle\Repository\TestCustomClassRepoRepository") */ class TestCustomClassRepoEntity { /** diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomServiceRepoEntity.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomServiceRepoEntity.php index c2cc926f1..25b9a82a4 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomServiceRepoEntity.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestCustomServiceRepoEntity.php @@ -4,9 +4,7 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass="Fixtures\Bundles\RepositoryServiceBundle\Repository\TestCustomServiceRepoRepository") - */ +/** @ORM\Entity(repositoryClass="Fixtures\Bundles\RepositoryServiceBundle\Repository\TestCustomServiceRepoRepository") */ class TestCustomServiceRepoEntity { /** diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestDefaultRepoEntity.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestDefaultRepoEntity.php index f50341786..2583acd03 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestDefaultRepoEntity.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Entity/TestDefaultRepoEntity.php @@ -4,9 +4,7 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ +/** @ORM\Entity */ class TestDefaultRepoEntity { /** diff --git a/Tests/DependencyInjection/Fixtures/DbalTestKernel.php b/Tests/DependencyInjection/Fixtures/DbalTestKernel.php index cdbc027cf..04f738292 100644 --- a/Tests/DependencyInjection/Fixtures/DbalTestKernel.php +++ b/Tests/DependencyInjection/Fixtures/DbalTestKernel.php @@ -23,9 +23,7 @@ class DbalTestKernel extends Kernel /** @var string|null */ private $projectDir; - /** - * @param array $dbalConfig - */ + /** @param array $dbalConfig */ public function __construct(array $dbalConfig = ['driver' => 'pdo_sqlite']) { $this->dbalConfig = $dbalConfig; @@ -33,9 +31,7 @@ public function __construct(array $dbalConfig = ['driver' => 'pdo_sqlite']) parent::__construct('test', true); } - /** - * @return iterable - */ + /** @return iterable */ public function registerBundles(): iterable { return [ diff --git a/Tests/DependencyInjection/Fixtures/TestKernel.php b/Tests/DependencyInjection/Fixtures/TestKernel.php index 581212188..8215e1799 100644 --- a/Tests/DependencyInjection/Fixtures/TestKernel.php +++ b/Tests/DependencyInjection/Fixtures/TestKernel.php @@ -24,9 +24,7 @@ public function __construct() parent::__construct('test', true); } - /** - * @return iterable - */ + /** @return iterable */ public function registerBundles(): iterable { return [ diff --git a/Tests/DependencyInjection/XMLSchemaTest.php b/Tests/DependencyInjection/XMLSchemaTest.php index 249dcd8a9..a04f77579 100644 --- a/Tests/DependencyInjection/XMLSchemaTest.php +++ b/Tests/DependencyInjection/XMLSchemaTest.php @@ -10,9 +10,7 @@ class XMLSchemaTest extends TestCase { - /** - * @return list - */ + /** @return list */ public static function dataValidateSchemaFiles(): array { $schemaFiles = []; @@ -28,9 +26,7 @@ public static function dataValidateSchemaFiles(): array return $schemaFiles; } - /** - * @dataProvider dataValidateSchemaFiles - */ + /** @dataProvider dataValidateSchemaFiles */ public function testValidateSchema(string $file): void { $found = false; diff --git a/Tests/Repository/ContainerRepositoryFactoryTest.php b/Tests/Repository/ContainerRepositoryFactoryTest.php index 5dcb3dbc1..28dbd3c11 100644 --- a/Tests/Repository/ContainerRepositoryFactoryTest.php +++ b/Tests/Repository/ContainerRepositoryFactoryTest.php @@ -126,9 +126,7 @@ public function testCustomRepositoryIsNotAValidClass(): void $factory->getRepository($em, 'Foo\CoolEntity'); } - /** - * @param array $services - */ + /** @param array $services */ private function createContainer(array $services): ContainerInterface { $container = $this->getMockBuilder(ContainerInterface::class)->getMock(); @@ -146,9 +144,7 @@ private function createContainer(array $services): ContainerInterface return $container; } - /** - * @param array $entityRepositoryClasses - */ + /** @param array $entityRepositoryClasses */ private function createEntityManager(array $entityRepositoryClasses): EntityManagerInterface { $classMetadatas = []; diff --git a/Tests/Twig/DoctrineExtensionTest.php b/Tests/Twig/DoctrineExtensionTest.php index a454e6c1e..a8b38756d 100644 --- a/Tests/Twig/DoctrineExtensionTest.php +++ b/Tests/Twig/DoctrineExtensionTest.php @@ -103,9 +103,7 @@ public function testEscapeBooleanParameter(): void $this->assertEquals('1', DoctrineExtension::escapeFunction(true)); } - /** - * @group legacy - */ + /** @group legacy */ public function testItHighlightsSqlQueriesUsingCssClasses(): void { $extension = new DoctrineExtension(); @@ -119,9 +117,7 @@ public function testItHighlightsSqlQueriesUsingCssClasses(): void ); } - /** - * @group legacy - */ + /** @group legacy */ public function testItDoesNotOutputDuplicatePreTags(): void { $extension = new DoctrineExtension(); @@ -135,9 +131,7 @@ public function testItDoesNotOutputDuplicatePreTags(): void ); } - /** - * @group legacy - */ + /** @group legacy */ public function testItUsesCssOnTheDivTag(): void { $extension = new DoctrineExtension(); diff --git a/Tests/UrlOverrideTest.php b/Tests/UrlOverrideTest.php index 623946019..384254bdc 100644 --- a/Tests/UrlOverrideTest.php +++ b/Tests/UrlOverrideTest.php @@ -28,9 +28,7 @@ public function testConnectionConfiguration(array $config, array $expectedParams ); } - /** - * @return array>> - */ + /** @return array>> */ public function connectionDataProvider(): array { return [ diff --git a/composer.json b/composer.json index fb87cb255..b2812d4ba 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "symfony/service-contracts": "^1.1.1|^2.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9.0", "doctrine/orm": "^2.6", "friendsofphp/proxy-manager-lts": "^1.0", "phpunit/phpunit": "^7.5 || ^8.0 || ^9.3", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index df5d4141d..85bc70261 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -28,7 +28,4 @@ Tests/* - - Tests/DependencyInjection/Fixtures/* -