Issues (7)

src/Command/DeclareCommand.php (1 issue)

Labels
Severity
1
<?php declare(strict_types = 1);
2
3
namespace Portiny\RabbitMQ\Command;
4
5
use Portiny\RabbitMQ\BunnyManager;
6
use Symfony\Component\Console\Attribute\AsCommand;
0 ignored issues
show
The type Symfony\Component\Console\Attribute\AsCommand 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...
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
#[AsCommand(
12
	name: 'rabbitmq:declare',
13
	description: 'Creates all exchanges and queues.'
14
)]
15
final class DeclareCommand extends Command
16
{
17
18
	/**
19
	 * @var BunnyManager
20
	 */
21
	private $bunnyManager;
22
23
24
	public function __construct(BunnyManager $bunnyManager)
25
	{
26
		parent::__construct();
27
28
		$this->bunnyManager = $bunnyManager;
29
	}
30
31
32
	protected function configure(): void
33
	{
34
		$this->setName('rabbitmq:declare')
35
			->setDescription('Creates all exchanges and queues.');
36
	}
37
38
39
	protected function execute(InputInterface $input, OutputInterface $output): int
40
	{
41
		$output->write('<comment>Declaring...</comment>');
42
43
		$this->bunnyManager->declare();
44
45
		$output->writeln(' <info>DONE</info>');
46
47
		return 0;
48
	}
49
50
}
51