Issues (3)

src/ComposerInstaller/Commands/CommandBase.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * YOURLS Composer Installer
4
 */
5
6
namespace YOURLS\ComposerInstaller\Commands;
7
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Composer\Command\BaseCommand;
10
use Composer\Console\Application;
11
use Symfony\Component\Console\Input\ArrayInput;
12
13
/**
14
 * YOURLS Composer Installer
15
 *
16
 * @package   YOURLS\ComposerInstaller
17
 * @author    Ozh <[email protected]>
18
 * @link      https://github.com/yourls/composer-installer/
19
 * @license   MIT
20
 */
21
class CommandBase extends BaseCommand
22
{
23
    /**
24
     * Run a composer internal command
25
     *
26
     * @param array $commandParams  Command parameters
27
     * @param OutputInterface       Output interface
0 ignored issues
show
The type YOURLS\ComposerInstaller\Commands\Output was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
     * @return int                  0 for success
29
     * @throws \RuntimeException
30
     */
31 2
    public function runComposerCommand(array $commandParams, OutputInterface $output)
32
    {
33 2
        $application = new Application();
34 2
        $application->resetComposer();
35
        // Don't auto exit after command so we can chain several ones
36 2
        $application->setAutoExit(false);
37
38 2
        $input = new ArrayInput($commandParams);
39
40
        // Execute command and display its output
41 2
        $exitCode = $application->run($input, $output);
42
43 2
        if ($exitCode) {
44 1
            throw new \RuntimeException(
45 1
                sprintf('Command "%s" failed', $commandParams['command'])
46
            );
47
        }
48
49 1
        return $exitCode;
50
    }
51
}
52