Passed
Push — master ( 0057b2...3e8fcf )
by Marek
02:11
created

application.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
#!/usr/bin/env php
2
<?php
3
4
require __DIR__ . '/vendor/autoload.php';
5
6
use PVG\Command\DeployTestBranchCommand;
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\Console\Application;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
11
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
12
13
$application = new Application('Test branch builder', '1.0.0');
14
$container   = new ContainerBuilder();
15
$fileLocator = new FileLocator(__DIR__);
16
17
try {
18
    $container->set('app.file_locator', $fileLocator);
19
    $container->set('app.event_dispatcher', new ContainerAwareEventDispatcher($container));
20
    $loader = new YamlFileLoader($container, $fileLocator);
21
    $loader->load('config/services.yml');
22
23
    $application->setCatchExceptions(true);
24
    $application->add($container->get('deploy_test_branch_command'));
0 ignored issues
show
$container->get('deploy_test_branch_command') is of type object|null, but the function expects a object<Symfony\Component\Console\Command\Command>.

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...
25
    $application->setDefaultCommand(DeployTestBranchCommand::NAME);
26
27
    $application->run();
28
} catch (Exception $exception) {
29
    (new \SimpleLogger\Stdout())->critical($exception->getMessage());
30
    exit(1);
31
}
32