Skip to content

Commit

Permalink
Doctrine CS 12
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Nov 6, 2023
1 parent ee7e884 commit 3cdc411
Show file tree
Hide file tree
Showing 49 changed files with 155 additions and 153 deletions.
5 changes: 2 additions & 3 deletions Command/CreateDatabaseDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ protected function configure(): void
->setDescription('Creates the configured database')
->addOption('connection', 'c', InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
->addOption('if-not-exists', null, InputOption::VALUE_NONE, 'Don\'t trigger an error, when the database already exists')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>%command.name%</info> command creates the default connections database:
<info>php %command.full_name%</info>
You can also optionally specify the name of a connection to create the database for:
<info>php %command.full_name% --connection=default</info>
EOT
);
EOT);
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
5 changes: 2 additions & 3 deletions Command/DropDatabaseDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function configure()
->addOption('connection', 'c', InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
->addOption('if-exists', null, InputOption::VALUE_NONE, 'Don\'t trigger an error, when the database doesn\'t exist')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Set this parameter to execute this action')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>%command.name%</info> command drops the default connections database:
<info>php %command.full_name%</info>
Expand All @@ -48,8 +48,7 @@ protected function configure()
<info>php %command.full_name% --connection=default</info>
<error>Be careful: All data in a given database will be lost when executing this command.</error>
EOT
);
EOT);
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
9 changes: 4 additions & 5 deletions Command/ImportMappingDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ protected function configure(): void
->addOption('force', null, InputOption::VALUE_NONE, 'Force to overwrite existing mapping files.')
->addOption('path', null, InputOption::VALUE_REQUIRED, 'The path where the files would be generated (not used when a bundle is passed).')
->setDescription('Imports mapping information from an existing database')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>%command.name%</info> command imports mapping information
from an existing database:
Generate annotation mappings into the src/ directory using App as the namespace:
<info>php %command.full_name% App\\\Entity annotation --path=src/Entity</info>
<info>php %command.full_name% App\\Entity annotation --path=src/Entity</info>
Generate xml mappings into the config/doctrine/ directory using App as the namespace:
<info>php %command.full_name% App\\\Entity xml --path=config/doctrine</info>
<info>php %command.full_name% App\\Entity xml --path=config/doctrine</info>
Generate XML mappings into a bundle:
<info>php %command.full_name% "MyCustomBundle" xml</info>
Expand All @@ -79,8 +79,7 @@ protected function configure(): void
Use the <info>--force</info> option, if you want to override existing mapping files:
<info>php %command.full_name% "MyCustomBundle" xml --force</info>
EOT
);
EOT);
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
1 change: 1 addition & 0 deletions Command/Proxy/ConvertMappingDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ConvertMappingDoctrineCommand extends ConvertMappingCommand
protected function configure()
{
parent::configure();

$this
->setName('doctrine:mapping:convert');

Expand Down
2 changes: 1 addition & 1 deletion Command/Proxy/DoctrineCommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function setApplicationEntityManager(Application $application, $em
'2.7',
'Providing an EntityManager using "%s" is deprecated. Use an instance of "%s" instead.',
EntityManagerHelper::class,
EntityManagerProvider::class
EntityManagerProvider::class,
);
}
}
3 changes: 2 additions & 1 deletion Command/Proxy/OrmProxyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ trait OrmProxyCommand
public function __construct(?EntityManagerProvider $entityManagerProvider = null)
{
parent::__construct($entityManagerProvider);

$this->entityManagerProvider = $entityManagerProvider;

trigger_deprecation(
'doctrine/doctrine-bundle',
'2.8',
'Class "%s" is deprecated. Use "%s" instead.',
self::class,
parent::class
parent::class,
);
}

Expand Down
5 changes: 2 additions & 3 deletions Command/Proxy/RunDqlDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function configure(): void

$this
->setName('doctrine:query:dql')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>%command.name%</info> command executes the given DQL query and
outputs the results:
Expand All @@ -35,8 +35,7 @@ protected function configure(): void
show:
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
EOT
);
EOT);

if ($this->getDefinition()->hasOption('em')) {
return;
Expand Down
7 changes: 3 additions & 4 deletions Command/Proxy/RunSqlDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ protected function configure(): void

$this
->setName('doctrine:query:sql')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>%command.name%</info> command executes the given SQL query and
outputs the results:
<info>php %command.full_name% "SELECT * FROM users"</info>
EOT
);
EOT);
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand All @@ -36,7 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'doctrine/doctrine-bundle',
'2.2',
'The "%s" (doctrine:query:sql) is deprecated, use dbal:run-sql command instead.',
self::class
self::class,
);

return parent::execute($input, $output);
Expand Down
6 changes: 3 additions & 3 deletions ConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function createConnection(array $params, ?Configuration $config = null, ?
$params = $this->addDatabaseSuffix(array_merge($connection->getParams(), $overriddenOptions));
$driver = $connection->getDriver();
$platform = $driver->getDatabasePlatform(
...(class_exists(StaticServerVersionProvider::class) ? [new StaticServerVersionProvider($params['serverVersion'] ?? '')] : [])
...(class_exists(StaticServerVersionProvider::class) ? [new StaticServerVersionProvider($params['serverVersion'] ?? '')] : []),
);

if (! isset($params['charset'])) {
Expand All @@ -128,7 +128,7 @@ public function createConnection(array $params, ?Configuration $config = null, ?
Deprecation::trigger(
'doctrine/doctrine-bundle',
'https://github.com/doctrine/dbal/issues/5214',
'The "collate" default table option is deprecated in favor of "collation" and will be removed in doctrine/doctrine-bundle 3.0. '
'The "collate" default table option is deprecated in favor of "collation" and will be removed in doctrine/doctrine-bundle 3.0. ',
);
$params['defaultTableOptions']['collation'] = $params['defaultTableOptions']['collate'];
unset($params['defaultTableOptions']['collate']);
Expand Down Expand Up @@ -186,7 +186,7 @@ private function getDatabasePlatform(Connection $connection): AbstractPlatform
'For further information have a look at:' . PHP_EOL .
'https://github.com/doctrine/DoctrineBundle/issues/673',
0,
$driverException
$driverException,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/CacheCompatibilityPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function createCompatibilityLayerDefinition(ContainerBuilder $container,
'doctrine/doctrine-bundle',
'2.4',
'Configuring doctrine/cache is deprecated. Please update the cache service "%s" to use a PSR-6 cache.',
$definitionId
$definitionId,
);

return (new Definition(CacheItemPoolInterface::class))
Expand Down
3 changes: 2 additions & 1 deletion DependencyInjection/Compiler/DoctrineOrmMappingsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class DoctrineOrmMappingsPass extends RegisterMappingsPass
public function __construct($driver, array $namespaces, array $managerParameters, $enabledParameter = false, array $aliasMap = [])
{
$managerParameters[] = 'doctrine.default_entity_manager';

parent::__construct(
$driver,
$namespaces,
Expand All @@ -49,7 +50,7 @@ public function __construct($driver, array $namespaces, array $managerParameters
$enabledParameter,
'doctrine.orm.%s_configuration',
'addEntityNamespace',
$aliasMap
$aliasMap,
);
}

Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/EntityListenerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function process(ContainerBuilder $container)
if ($lazyByAttribute && ! $resolverSupportsLazyListeners) {
throw new InvalidArgumentException(sprintf(
'Lazy-loaded entity listeners can only be resolved by a resolver implementing %s.',
EntityListenerServiceResolver::class
EntityListenerServiceResolver::class,
));
}

Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/MiddlewaresPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function process(ContainerBuilder $container): void
$middlewareDefs[$id] = [
$childDef = $container->setDefinition(
sprintf('%s.%s', $id, $name),
new ChildDefinition($id)
new ChildDefinition($id),
),
++$i,
];
Expand Down
24 changes: 12 additions & 12 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
->setDeprecated(
'doctrine/doctrine-bundle',
'2.9',
'The "platform_service" configuration key is deprecated since doctrine-bundle 2.9. DBAL 4 will not support setting a custom platform via connection params anymore.'
'The "platform_service" configuration key is deprecated since doctrine-bundle 2.9. DBAL 4 will not support setting a custom platform via connection params anymore.',
)
->end()
->booleanNode('auto_commit')->end()
Expand Down Expand Up @@ -240,7 +240,7 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
->arrayNode('default_table_options')
->info(sprintf(
"This option is used by the schema-tool and affects generated SQL. Possible keys include 'charset','%s', and 'engine'.",
$collationKey
$collationKey,
))
->useAttributeAsKey('name')
->prototype('scalar')->end()
Expand Down Expand Up @@ -299,7 +299,7 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node): void
'2.4',
'Setting the "doctrine.dbal.%s" %s while the "url" one is defined is deprecated',
implode('", "', $urlConflictingValues),
$tail
$tail,
);
}

Expand Down Expand Up @@ -332,7 +332,7 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node): void
->scalarNode('servicename')
->info(
'Overrules dbname parameter if given and used as SERVICE_NAME or SID connection parameter ' .
'for Oracle depending on the service parameter.'
'for Oracle depending on the service parameter.',
)
->end()
->scalarNode('sessionMode')
Expand All @@ -343,34 +343,34 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node): void
->end()
->scalarNode('default_dbname')
->info(
'Override the default database (postgres) to connect to for PostgreSQL connexion.'
'Override the default database (postgres) to connect to for PostgreSQL connexion.',
)
->end()
->scalarNode('sslmode')
->info(
'Determines whether or with what priority a SSL TCP/IP connection will be negotiated with ' .
'the server for PostgreSQL.'
'the server for PostgreSQL.',
)
->end()
->scalarNode('sslrootcert')
->info(
'The name of a file containing SSL certificate authority (CA) certificate(s). ' .
'If the file exists, the server\'s certificate will be verified to be signed by one of these authorities.'
'If the file exists, the server\'s certificate will be verified to be signed by one of these authorities.',
)
->end()
->scalarNode('sslcert')
->info(
'The path to the SSL client certificate file for PostgreSQL.'
'The path to the SSL client certificate file for PostgreSQL.',
)
->end()
->scalarNode('sslkey')
->info(
'The path to the SSL client key file for PostgreSQL.'
'The path to the SSL client key file for PostgreSQL.',
)
->end()
->scalarNode('sslcrl')
->info(
'The file name of the SSL certificate revocation list for PostgreSQL.'
'The file name of the SSL certificate revocation list for PostgreSQL.',
)
->end()
->booleanNode('pooled')->info('True to use a pooled server with the oci8/pdo_oracle driver')->end()
Expand All @@ -380,15 +380,15 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node): void
->info(
'Optional parameter, complete whether to add the INSTANCE_NAME parameter in the connection.' .
' It is generally used to connect to an Oracle RAC server to select the name' .
' of a particular instance.'
' of a particular instance.',
)
->end()
->scalarNode('connectstring')
->info(
'Complete Easy Connect connection descriptor, see https://docs.oracle.com/database/121/NETAG/naming.htm.' .
'When using this option, you will still need to provide the user and password parameters, but the other ' .
'parameters will no longer be used. Note that when using this parameter, the getHost and getPort methods' .
' from Doctrine\DBAL\Connection will no longer function as expected.'
' from Doctrine\DBAL\Connection will no longer function as expected.',
)
->end()
->end()
Expand Down
14 changes: 7 additions & 7 deletions DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected function loadDbalConnection($name, array $connection, ContainerBuilder
unset(
$connection['profiling'],
$connection['profiling_collect_backtrace'],
$connection['profiling_collect_schema_errors']
$connection['profiling_collect_schema_errors'],
);

if (isset($connection['auto_commit'])) {
Expand Down Expand Up @@ -298,7 +298,7 @@ protected function loadDbalConnection($name, array $connection, ContainerBuilder

$container->setDefinition(
ManagerRegistryAwareConnectionProvider::class,
new Definition(ManagerRegistryAwareConnectionProvider::class, [$container->getDefinition('doctrine')])
new Definition(ManagerRegistryAwareConnectionProvider::class, [$container->getDefinition('doctrine')]),
);

$configuration->addMethodCall('setSchemaManagerFactory', [new Reference($connection['schema_manager_factory'])]);
Expand Down Expand Up @@ -548,7 +548,7 @@ protected function ormLoad(array $config, ContainerBuilder $container)
if (! method_exists(OrmConfiguration::class, 'setLazyGhostObjectEnabled')) {
throw new LogicException(
'Lazy ghost objects cannot be enabled because the "doctrine/orm" library'
. ' version 2.14 or higher is not installed. Please run "composer update doctrine/orm".'
. ' version 2.14 or higher is not installed. Please run "composer update doctrine/orm".',
);
}

Expand All @@ -557,14 +557,14 @@ protected function ormLoad(array $config, ContainerBuilder $container)
if (! trait_exists(LazyGhostTrait::class)) {
throw new LogicException(
'Lazy ghost objects cannot be enabled because the "symfony/var-exporter" library'
. ' version 6.2 or higher is not installed. Please run "composer require symfony/var-exporter:^6.2".'
. ' version 6.2 or higher is not installed. Please run "composer require symfony/var-exporter:^6.2".',
);
}

if (! class_exists(RuntimeReflectionProperty::class)) {
throw new LogicException(
'Lazy ghost objects cannot be enabled because the "doctrine/persistence" library'
. ' version 3.1 or higher is not installed. Please run "composer update doctrine/persistence".'
. ' version 3.1 or higher is not installed. Please run "composer update doctrine/persistence".',
);
}
}
Expand Down Expand Up @@ -768,7 +768,7 @@ protected function loadOrmEntityManager(array $entityManager, ContainerBuilder $

$container->setAlias(
sprintf('doctrine.orm.%s_entity_manager.event_manager', $entityManager['name']),
new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $entityManager['connection']), false)
new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $entityManager['connection']), false),
);

if (! isset($entityManager['entity_listeners'])) {
Expand Down Expand Up @@ -1028,7 +1028,7 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
'Unknown cache of type "%s" configured for cache "%s" in entity manager "%s".',
$cacheDriver['type'],
$cacheName,
$objectManagerName
$objectManagerName,
));
}

Expand Down
Loading

0 comments on commit 3cdc411

Please sign in to comment.