migration symfony 5 4 (#300)

* symfony 5.4 (diff dev)

* symfony 5.4 (working)

* symfony 5.4 (update autoload)

* symfony 5.4 (remove swiftmailer mailer implementation)

* symfony 5.4 (php doc and split Global accessor class)


### Impacted packages:

composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies

composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
bdalsass
2022-06-16 09:13:24 +02:00
committed by GitHub
parent abb13b70b9
commit 79da71ecf8
2178 changed files with 87439 additions and 59451 deletions

View File

@@ -13,12 +13,12 @@ namespace Symfony\Bundle\FrameworkBundle\Console;
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Kernel;
@@ -41,19 +41,29 @@ class Application extends BaseApplication
$inputDefinition = $this->getDefinition();
$inputDefinition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
$inputDefinition->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
$inputDefinition->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switch off debug mode.'));
}
/**
* Gets the Kernel associated with this Console.
*
* @return KernelInterface A KernelInterface instance
* @return KernelInterface
*/
public function getKernel()
{
return $this->kernel;
}
/**
* {@inheritdoc}
*/
public function reset()
{
if ($this->kernel->getContainer()->has('services_resetter')) {
$this->kernel->getContainer()->get('services_resetter')->reset();
}
}
/**
* Runs the current application.
*
@@ -61,16 +71,14 @@ class Application extends BaseApplication
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->kernel->boot();
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
$this->registerCommands();
if ($this->registrationErrors) {
$this->renderRegistrationErrors($input, $output);
}
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
return parent::doRun($input, $output);
}
@@ -79,17 +87,29 @@ class Application extends BaseApplication
*/
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if ($this->registrationErrors) {
$this->renderRegistrationErrors($input, $output);
if (!$command instanceof ListCommand) {
if ($this->registrationErrors) {
$this->renderRegistrationErrors($input, $output);
$this->registrationErrors = [];
}
return parent::doRunCommand($command, $input, $output);
}
return parent::doRunCommand($command, $input, $output);
$returnCode = parent::doRunCommand($command, $input, $output);
if ($this->registrationErrors) {
$this->renderRegistrationErrors($input, $output);
$this->registrationErrors = [];
}
return $returnCode;
}
/**
* {@inheritdoc}
*/
public function find($name)
public function find(string $name)
{
$this->registerCommands();
@@ -99,7 +119,7 @@ class Application extends BaseApplication
/**
* {@inheritdoc}
*/
public function get($name)
public function get(string $name)
{
$this->registerCommands();
@@ -115,7 +135,7 @@ class Application extends BaseApplication
/**
* {@inheritdoc}
*/
public function all($namespace = null)
public function all(string $namespace = null)
{
$this->registerCommands();
@@ -127,7 +147,7 @@ class Application extends BaseApplication
*/
public function getLongVersion()
{
return parent::getLongVersion().sprintf(' (kernel: <comment>%s</>, env: <comment>%s</>, debug: <comment>%s</>)', $this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false');
return parent::getLongVersion().sprintf(' (env: <comment>%s</>, debug: <comment>%s</>) <bg=#0057B7;fg=#FFDD00>#StandWith</><bg=#FFDD00;fg=#0057B7>Ukraine</> <href=https://sf.to/ukraine>https://sf.to/ukraine</>', $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false');
}
public function add(Command $command)
@@ -153,10 +173,8 @@ class Application extends BaseApplication
if ($bundle instanceof Bundle) {
try {
$bundle->registerCommands($this);
} catch (\Exception $e) {
$this->registrationErrors[] = $e;
} catch (\Throwable $e) {
$this->registrationErrors[] = new FatalThrowableError($e);
$this->registrationErrors[] = $e;
}
}
}
@@ -171,10 +189,8 @@ class Application extends BaseApplication
if (!isset($lazyCommandIds[$id])) {
try {
$this->add($container->get($id));
} catch (\Exception $e) {
$this->registrationErrors[] = $e;
} catch (\Throwable $e) {
$this->registrationErrors[] = new FatalThrowableError($e);
$this->registrationErrors[] = $e;
}
}
}
@@ -190,9 +206,7 @@ class Application extends BaseApplication
(new SymfonyStyle($input, $output))->warning('Some commands could not be registered:');
foreach ($this->registrationErrors as $error) {
$this->doRenderException($error, $output);
$this->doRenderThrowable($error, $output);
}
$this->registrationErrors = [];
}
}