Skip to content

Commit

Permalink
Support Symfony 7 by adding return types conditionally (#10919)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Aug 24, 2023
1 parent b6441b4 commit aa333e2
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ORM\Cache;
use Doctrine\ORM\Tools\Console\Command\AbstractEntityManagerCommand;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -20,6 +21,8 @@
*/
class CollectionRegionCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -58,12 +61,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ORM\Cache;
use Doctrine\ORM\Tools\Console\Command\AbstractEntityManagerCommand;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -20,6 +21,8 @@
*/
class EntityRegionCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -57,12 +60,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\ORM\Tools\Console\Command\ClearCache;

use Doctrine\ORM\Tools\Console\Command\AbstractEntityManagerCommand;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -18,6 +19,8 @@
*/
class MetadataCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand All @@ -31,12 +34,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\Common\Cache\FlushableCache;
use Doctrine\Common\Cache\XcacheCache;
use Doctrine\ORM\Tools\Console\Command\AbstractEntityManagerCommand;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use InvalidArgumentException;
use LogicException;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
Expand All @@ -28,6 +29,8 @@
*/
class QueryCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -55,12 +58,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ORM\Cache;
use Doctrine\ORM\Tools\Console\Command\AbstractEntityManagerCommand;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -20,6 +21,8 @@
*/
class QueryRegionCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -56,12 +59,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\Common\Cache\XcacheCache;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\Tools\Console\Command\AbstractEntityManagerCommand;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use InvalidArgumentException;
use LogicException;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
Expand All @@ -29,6 +30,8 @@
*/
class ResultCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -56,12 +59,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ORM\Tools\Console\Command;

use Doctrine\ORM\Tools\Console\CommandCompatibility;
use Doctrine\ORM\Tools\ConvertDoctrine1Schema;
use Doctrine\ORM\Tools\EntityGenerator;
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
Expand Down Expand Up @@ -34,6 +35,8 @@
*/
class ConvertDoctrine1SchemaCommand extends Command
{
use CommandCompatibility;

/** @var EntityGenerator|null */
private $entityGenerator = null;

Expand Down Expand Up @@ -87,12 +90,7 @@ protected function configure()
->setHelp('Converts Doctrine 1.x schema into a Doctrine 2.x schema.');
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = new SymfonyStyle($input, $output);
$ui->getErrorStyle()->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine ORM 3.0.');
Expand Down
10 changes: 4 additions & 6 deletions lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\DBAL\Connection;
use Doctrine\ORM\Mapping\Driver\DatabaseDriver;
use Doctrine\ORM\Tools\Console\CommandCompatibility;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Doctrine\ORM\Tools\EntityGenerator;
Expand Down Expand Up @@ -37,6 +38,8 @@
*/
class ConvertMappingCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -84,12 +87,7 @@ protected function configure()
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = new SymfonyStyle($input, $output);
$ui->getErrorStyle()->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine ORM 3.0.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ORM\Tools\Console\Command;

use Doctrine\ORM\Tools\Console\CommandCompatibility;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -19,6 +20,8 @@
*/
class EnsureProductionSettingsCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand All @@ -29,12 +32,7 @@ protected function configure()
->setHelp('Verify that Doctrine is properly configured for a production environment.');
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();
$ui->warning('This console command has been deprecated and will be removed in a future version of Doctrine ORM.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ORM\Tools\Console\Command;

use Doctrine\ORM\Tools\Console\CommandCompatibility;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Doctrine\ORM\Tools\EntityGenerator;
Expand All @@ -28,6 +29,8 @@
*/
class GenerateEntitiesCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand Down Expand Up @@ -67,12 +70,7 @@ class is supposed to extend which. You have to adjust the entity
);
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();
$ui->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine ORM 3.0.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ORM\Tools\Console\Command;

use Doctrine\ORM\Tools\Console\CommandCompatibility;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
Expand All @@ -26,6 +27,8 @@
*/
class GenerateProxiesCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand All @@ -38,12 +41,7 @@ protected function configure()
->setHelp('Generates proxy classes for entity classes.');
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ORM\Tools\Console\Command;

use Doctrine\ORM\Tools\Console\CommandCompatibility;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\EntityRepositoryGenerator;
use InvalidArgumentException;
Expand All @@ -27,6 +28,8 @@
*/
class GenerateRepositoriesCommand extends AbstractEntityManagerCommand
{
use CommandCompatibility;

/** @return void */
protected function configure()
{
Expand All @@ -39,12 +42,7 @@ protected function configure()
->setHelp('Generate repository classes from your mapping information.');
}

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input, OutputInterface $output): int
{
$ui = (new SymfonyStyle($input, $output))->getErrorStyle();
$ui->warning('Command ' . $this->getName() . ' is deprecated and will be removed in Doctrine ORM 3.0.');
Expand Down
Loading

0 comments on commit aa333e2

Please sign in to comment.