Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctrine CS 12 #1723

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
'2.7',
'Providing an EntityManager using "%s" is deprecated. Use an instance of "%s" instead.',
EntityManagerHelper::class,
EntityManagerProvider::class
EntityManagerProvider::class,

Check warning on line 38 in Command/Proxy/DoctrineCommandHelper.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/DoctrineCommandHelper.php#L38

Added line #L38 was not covered by tests
);
}
}
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 @@
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,

Check warning on line 30 in Command/Proxy/OrmProxyCommand.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/OrmProxyCommand.php#L30

Added line #L30 was not covered by tests
);
}

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 @@

$this
->setName('doctrine:query:dql')
->setHelp(<<<EOT
->setHelp(<<<'EOT'

Check warning on line 23 in Command/Proxy/RunDqlDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/RunDqlDoctrineCommand.php#L23

Added line #L23 was not covered by tests
The <info>%command.name%</info> command executes the given DQL query and
outputs the results:

Expand All @@ -35,8 +35,7 @@
show:

<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
EOT
);
EOT);

Check warning on line 38 in Command/Proxy/RunDqlDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/RunDqlDoctrineCommand.php#L38

Added line #L38 was not covered by tests

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 @@

$this
->setName('doctrine:query:sql')
->setHelp(<<<EOT
->setHelp(<<<'EOT'

Check warning on line 24 in Command/Proxy/RunSqlDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/RunSqlDoctrineCommand.php#L24

Added line #L24 was not covered by tests
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);

Check warning on line 29 in Command/Proxy/RunSqlDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/RunSqlDoctrineCommand.php#L29

Added line #L29 was not covered by tests
}

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

Check warning on line 38 in Command/Proxy/RunSqlDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

Command/Proxy/RunSqlDoctrineCommand.php#L38

Added line #L38 was not covered by tests
);

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 @@
$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 @@
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 @@
'For further information have a look at:' . PHP_EOL .
'https://github.com/doctrine/DoctrineBundle/issues/673',
0,
$driverException
$driverException,

Check warning on line 189 in ConnectionFactory.php

View check run for this annotation

Codecov / codecov/patch

ConnectionFactory.php#L189

Added line #L189 was not covered by tests
);
}
}
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 @@
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 @@
$enabledParameter,
'doctrine.orm.%s_configuration',
'addEntityNamespace',
$aliasMap
$aliasMap,

Check warning on line 53 in DependencyInjection/Compiler/DoctrineOrmMappingsPass.php

View check run for this annotation

Codecov / codecov/patch

DependencyInjection/Compiler/DoctrineOrmMappingsPass.php#L53

Added line #L53 was not covered by tests
);
}

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 @@
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 @@

$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 @@
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".',

Check warning on line 551 in DependencyInjection/DoctrineExtension.php

View check run for this annotation

Codecov / codecov/patch

DependencyInjection/DoctrineExtension.php#L551

Added line #L551 was not covered by tests
);
}

Expand All @@ -557,14 +557,14 @@
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".',

Check warning on line 560 in DependencyInjection/DoctrineExtension.php

View check run for this annotation

Codecov / codecov/patch

DependencyInjection/DoctrineExtension.php#L560

Added line #L560 was not covered by tests
);
}

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".',

Check warning on line 567 in DependencyInjection/DoctrineExtension.php

View check run for this annotation

Codecov / codecov/patch

DependencyInjection/DoctrineExtension.php#L567

Added line #L567 was not covered by tests
);
}
}
Expand Down Expand Up @@ -768,7 +768,7 @@

$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 @@
'Unknown cache of type "%s" configured for cache "%s" in entity manager "%s".',
$cacheDriver['type'],
$cacheName,
$objectManagerName
$objectManagerName,
));
}

Expand Down
Loading