1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @copyright Bluz PHP Team |
||
5 | * @link https://github.com/bluzphp/bluzman |
||
6 | */ |
||
7 | |||
8 | namespace Bluzman\Command\Module; |
||
9 | |||
10 | use Bluzman\Command\AbstractCommand; |
||
11 | use Exception; |
||
12 | use Composer\Console\Application; |
||
13 | use Symfony\Component\Console\Input\ArrayInput; |
||
0 ignored issues
–
show
|
|||
14 | use Symfony\Component\Console\Input\InputArgument; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Input\InputArgument 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
15 | use Symfony\Component\Console\Input\InputInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Input\InputInterface 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
16 | use Symfony\Component\Console\Output\OutputInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Output\OutputInterface 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
17 | |||
18 | /** |
||
19 | * Class List command |
||
20 | * |
||
21 | * @package Bluzman\Command |
||
22 | * |
||
23 | * @author Pavel Machekhin |
||
24 | * @created 2013-03-28 14:03 |
||
25 | */ |
||
26 | class RemoveCommand extends AbstractCommand |
||
27 | { |
||
28 | /** |
||
29 | 15 | * Command configuration |
|
30 | */ |
||
31 | protected function configure() |
||
32 | { |
||
33 | 15 | $this |
|
34 | // the name of the command (the part after "bin/bluzman") |
||
35 | 15 | ->setName('module:remove') |
|
36 | // the short description shown while running "php bin/bluzman list" |
||
37 | ->setDescription('Remove installed module') |
||
38 | 15 | // the full command description shown when running the command with |
|
39 | // the "--help" option |
||
40 | ->setHelp('Remove module, for retrieve list of modules run command <info>bluzman module:list</info>') |
||
41 | 15 | ; |
|
42 | 15 | ||
43 | 15 | $module = new InputArgument( |
|
44 | 15 | 'module', |
|
45 | InputArgument::REQUIRED, |
||
46 | 'Module name is required' |
||
47 | 15 | ); |
|
48 | 15 | ||
49 | $this->getDefinition()->addArgument($module); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @param InputInterface $input |
||
54 | * @param OutputInterface $output |
||
55 | * @return int |
||
56 | * @throws Exception |
||
57 | */ |
||
58 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
59 | { |
||
60 | // Composer\Factory::getHomeDir() method |
||
61 | // needs COMPOSER_HOME environment variable set |
||
62 | // putenv('COMPOSER_HOME=' . PATH_VENDOR . '/bin/composer'); |
||
63 | |||
64 | $arguments = [ |
||
65 | 'command' => 'remove', |
||
66 | 'packages' => ['bluzphp/module-' . $input->getArgument('module')] |
||
67 | ]; |
||
68 | |||
69 | // call `composer install` command programmatically |
||
70 | $composerInput = new ArrayInput($arguments); |
||
71 | $application = new Application(); |
||
72 | $application->setAutoExit(false); // prevent `$application->run` method from exiting the script |
||
73 | return $application->run($composerInput); |
||
74 | } |
||
75 | } |
||
76 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths