Skip to content

Commit

Permalink
Merge pull request #376 from doctrine/return-types-optional-commands
Browse files Browse the repository at this point in the history
declare return types on commands to be future proof
  • Loading branch information
dbu authored May 13, 2023
2 parents fff6a2f + a7c7924 commit 322df15
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 50 deletions.
10 changes: 3 additions & 7 deletions src/OptionalCommand/Jackalope/InitDoctrineDbalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

use Doctrine\Bundle\PHPCRBundle\Command\DoctrineCommandHelper;
use Jackalope\Tools\Console\Command\InitDoctrineDbalCommand as BaseInitDoctrineDbalCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Wrapper to use this command in the symfony console with multiple sessions.
*/
class InitDoctrineDbalCommand extends BaseInitDoctrineDbalCommand
{
/**
* @see Command
*/
protected function configure(): void
{
parent::configure();
Expand All @@ -24,9 +23,6 @@ protected function configure(): void
;
}

/**
* @see Command
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$application = $this->getApplication();
Expand Down
11 changes: 2 additions & 9 deletions src/OptionalCommand/Jackalope/JackrabbitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Wrapper to use this command in the symfony console with multiple sessions.
*
* @author Daniel Barsotti <[email protected]>
*/
class JackrabbitCommand extends BaseJackrabbitCommand implements ContainerAwareInterface
Expand All @@ -30,17 +32,11 @@ protected function getContainer()
return $this->container;
}

/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}

/**
* {@inheritdoc}
*/
protected function configure(): void
{
parent::configure();
Expand All @@ -59,9 +55,6 @@ protected function configure(): void
;
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
if ($this->getContainer()->hasParameter('doctrine_phpcr.jackrabbit_jar')) {
Expand Down
12 changes: 3 additions & 9 deletions src/OptionalCommand/ODM/DocumentConvertTranslationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@
use Symfony\Component\Console\Output\OutputInterface;

/**
* Integrate command into symfony.
* Wrapper to use this command in the symfony console with multiple sessions.
*
* @author David Buchmann <[email protected]>
*/
class DocumentConvertTranslationCommand extends BaseDocumentConvertTranslationCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -34,10 +31,7 @@ protected function configure()
);
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
DoctrineCommandHelper::setApplicationDocumentManager(
$this->getApplication(),
Expand Down
10 changes: 2 additions & 8 deletions src/OptionalCommand/ODM/DocumentMigrateClassCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@
*/
class DocumentMigrateClassCommand extends BaseDocumentMigrateClassCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();

$this->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command');
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$dmName = $input->getOption('dm'); // defaults to null
DoctrineCommandHelper::setApplicationDocumentManager(
Expand Down
12 changes: 3 additions & 9 deletions src/OptionalCommand/ODM/InfoDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@
use Symfony\Component\Console\Output\OutputInterface;

/**
* Show information about mapped entities.
* Wrapper to use this command in the symfony console with multiple sessions.
*
* @author Lukas Kahwe Smith <[email protected]>
*/
class InfoDoctrineCommand extends BaseInfoDoctrineCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -34,10 +31,7 @@ protected function configure()
);
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
DoctrineCommandHelper::setApplicationDocumentManager(
$this->getApplication(),
Expand Down
10 changes: 2 additions & 8 deletions src/OptionalCommand/ODM/VerifyUniqueNodeTypesMappingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
*/
class VerifyUniqueNodeTypesMappingCommand extends BaseVerifyUniqueNodeTypesMappingCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -31,10 +28,7 @@ protected function configure()
);
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
DoctrineCommandHelper::setApplicationDocumentManager(
$this->getApplication(),
Expand Down

0 comments on commit 322df15

Please sign in to comment.