Skip to content

Commit

Permalink
fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Feb 28, 2023
1 parent 402d02b commit 54b0acd
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 36 deletions.
17 changes: 13 additions & 4 deletions Command/DropDatabaseDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
namespace Doctrine\Bundle\DoctrineBundle\Command;

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Throwable;

use function file_exists;
use function in_array;
use function method_exists;
use function sprintf;
use function unlink;

/**
* Database tool allows you to easily drop your configured databases.
Expand All @@ -24,9 +27,7 @@ class DropDatabaseDoctrineCommand extends DoctrineCommand

public const RETURN_CODE_NO_FORCE = 2;

/**
* {@inheritDoc}
*/
/** @return void */
protected function configure()
{
$this
Expand Down Expand Up @@ -101,7 +102,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int

try {
if ($shouldDropDatabase) {
$schemaManager->dropDatabase($name);
if ($schemaManager instanceof SqliteSchemaManager) {
// dropDatabase() is deprecated for Sqlite
if (file_exists($name)) {
unlink($name);
}
} else {
$schemaManager->dropDatabase($name);
}

$output->writeln(sprintf('<info>Dropped database <comment>%s</comment> for connection named <comment>%s</comment></info>', $name, $connectionName));
} else {
$output->writeln(sprintf('<info>Database <comment>%s</comment> for connection named <comment>%s</comment> doesn\'t exist. Skipped.</info>', $name, $connectionName));
Expand Down
4 changes: 1 addition & 3 deletions Command/Proxy/ConvertMappingDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class ConvertMappingDoctrineCommand extends ConvertMappingCommand
{
use OrmProxyCommand;

/**
* {@inheritDoc}
*/
/** @return void */
protected function configure()
{
parent::configure();
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Compiler/CacheSchemaSubscriberPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*/
class CacheSchemaSubscriberPass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
/** @return void */
public function process(ContainerBuilder $container)
{
$this->injectAdapters($container, 'doctrine.orm.listeners.doctrine_dbal_cache_adapter_schema_subscriber', DoctrineDbalAdapter::class);
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Compiler/DbalSchemaFilterPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
*/
class DbalSchemaFilterPass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
/** @return void */
public function process(ContainerBuilder $container)
{
$filters = $container->findTaggedServiceIds('doctrine.dbal.schema_filter');
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Compiler/EntityListenerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class EntityListenerPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;

/**
* {@inheritDoc}
*/
/** @return void */
public function process(ContainerBuilder $container)
{
$resolvers = $this->findAndSortTaggedServices('doctrine.orm.entity_listener', $container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/** @internal */
final class RemoveLoggingMiddlewarePass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if ($container->has('logger')) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/** @internal */
final class RemoveProfilerControllerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if ($container->has('twig') && $container->has('profiler')) {
return;
Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Compiler/WellKnownSchemaFilterPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*/
class WellKnownSchemaFilterPass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
/** @return void */
public function process(ContainerBuilder $container)
{
$blacklist = [];
Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
{
private string $defaultConnection;

/**
* {@inheritDoc}
*/
/** @return void */
public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
Expand Down Expand Up @@ -1021,6 +1019,8 @@ private function loadValidatorLoader(string $entityManagerName, ContainerBuilder
* @param array<string, mixed> $objectManager
* @param string $cacheName
*
* @return void
*
* @psalm-suppress MoreSpecificImplementedParamType
*/
public function loadObjectManagerCacheDriver(array $objectManager, ContainerBuilder $container, $cacheName)
Expand Down
16 changes: 4 additions & 12 deletions DoctrineBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ class DoctrineBundle extends Bundle
{
private ?Closure $autoloader = null;

/**
* {@inheritDoc}
*/
/** @return void */
public function build(ContainerBuilder $container)
{
parent::build($container);
Expand Down Expand Up @@ -83,9 +81,7 @@ public function process(ContainerBuilder $container): void
$container->addCompilerPass(new RegisterUidTypePass());
}

/**
* {@inheritDoc}
*/
/** @return void */
public function boot()
{
// Register an autoloader for proxies to avoid issues when unserializing them
Expand Down Expand Up @@ -133,9 +129,7 @@ public function boot()
$this->autoloader = Autoloader::register($dir, $namespace, $proxyGenerator);
}

/**
* {@inheritDoc}
*/
/** @return void */
public function shutdown()
{
if ($this->autoloader !== null) {
Expand Down Expand Up @@ -168,9 +162,7 @@ public function shutdown()
}
}

/**
* {@inheritDoc}
*/
/** @return void */
public function registerCommands(Application $application)
{
}
Expand Down

0 comments on commit 54b0acd

Please sign in to comment.