Completed
Push — master ( 91fdab...75a7b9 )
by
unknown
13:37
created

TranslatorBundle/Command/MigrationsDiffCommand.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Kunstmaan\TranslatorBundle\Command;
3
4
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper;
5
use Doctrine\Bundle\MigrationsBundle\Command\DoctrineCommand;
6
use Kunstmaan\TranslatorBundle\Service\Command\DiffCommand;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * Command for generate migration classes by checking the translation flag value
13
 *
14
 * @final since 5.1
15
 */
16
class MigrationsDiffCommand extends DiffCommand
17
{
18
    protected function configure()
19
    {
20
        parent::configure();
21
22
        $this
23
            ->setName('kuma:translator:migrations:diff')
24
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.')
25
        ;
26
    }
27
28
    public function execute(InputInterface $input, OutputInterface $output)
29
    {
30
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
0 ignored issues
show
$this->getApplication() is of type object<Symfony\Component...nsole\Application>|null, but the function expects a object<Symfony\Bundle\Fr...le\Console\Application>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
32
        $configuration = $this->getMigrationConfiguration($input, $output);
33
        DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
34
35
        parent::execute($input, $output);
36
    }
37
}
38