-
-
Notifications
You must be signed in to change notification settings - Fork 513
Symfony 8.0 support #2791
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
base: 2.12.x
Are you sure you want to change the base?
Symfony 8.0 support #2791
Changes from all commits
67e642b
0322005
d92d4a9
03ad29f
11f4ff3
eaa8fad
20eea6f
22c643c
a328c9b
1ebf6dc
fd037dc
92ad1f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,32 @@ | |
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
if ((new ReflectionMethod(Command::class, 'execute'))->hasReturnType()) { | ||
// Symfony 8 | ||
if ((new ReflectionMethod(Command::class, 'configure'))->hasReturnType()) { | ||
/** @internal */ | ||
trait CommandCompatibility | ||
{ | ||
protected function configure(): void | ||
{ | ||
$this->doConfigure(); | ||
} | ||
Comment on lines
+17
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps I'm missing something but I don't think we need this trait here. I did something similar in https://github.com/IonBazan/composer-diff/blob/8907711f0bf74677041f7b356da2367afea44a53/src/Command/BaseTypedCommand.php#L9-L14 but that's only needed to support different PHP versions.
|
||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
return $this->doExecute($input, $output); | ||
} | ||
} | ||
// Symfony 7 | ||
} elseif ((new ReflectionMethod(Command::class, 'execute'))->hasReturnType()) { | ||
/** @internal */ | ||
trait CommandCompatibility | ||
{ | ||
/** @return void */ | ||
protected function configure() | ||
{ | ||
$this->doConfigure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
return $this->doExecute($input, $output); | ||
|
@@ -22,6 +44,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |
/** @internal */ | ||
trait CommandCompatibility | ||
{ | ||
/** @return void */ | ||
protected function configure() | ||
{ | ||
$this->doConfigure(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,16 +19,15 @@ | |
|
||
abstract class AbstractCommand extends Command | ||
{ | ||
use AbstractCommandCompatibility; | ||
|
||
public const DB = 'db'; | ||
public const COLLECTION = 'collection'; | ||
public const INDEX = 'index'; | ||
public const SEARCH_INDEX = 'search-index'; | ||
|
||
/** @return void */ | ||
protected function configure() | ||
private function configureCommonOptions(): void | ||
{ | ||
parent::configure(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You remove the call to |
||
|
||
$this | ||
->addOption('maxTimeMs', null, InputOption::VALUE_REQUIRED, 'An optional maxTimeMs that will be used for all schema operations.') | ||
->addOption('w', null, InputOption::VALUE_REQUIRED, 'An optional w option for the write concern that will be used for all schema operations.') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\ODM\MongoDB\Tools\Console\Command\Schema; | ||
|
||
use ReflectionMethod; | ||
use Symfony\Component\Console\Command\Command; | ||
|
||
// Symfony 8 | ||
if ((new ReflectionMethod(Command::class, 'configure'))->hasReturnType()) { | ||
/** @internal */ | ||
trait AbstractCommandCompatibility | ||
{ | ||
protected function configure(): void | ||
{ | ||
$this->configureCommonOptions(); | ||
} | ||
} | ||
} else { | ||
/** @internal */ | ||
trait AbstractCommandCompatibility | ||
{ | ||
/** @return void */ | ||
protected function configure() | ||
{ | ||
$this->configureCommonOptions(); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.