1 | <?php |
||
18 | class BaseConsumerCommand extends Command |
||
19 | { |
||
20 | /** |
||
21 | * The name and signature of the console command. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $signature = 'rabbitmq:consume {consumer} {--time=60} {--messages=100} {--memory=64}'; |
||
26 | |||
27 | /** |
||
28 | * The console command description. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $description = 'Start consuming messages'; |
||
33 | |||
34 | /** |
||
35 | * @param string $consumerAliasName |
||
36 | * @return ConsumerInterface |
||
37 | */ |
||
38 | protected function getConsumer(string $consumerAliasName): ConsumerInterface |
||
42 | |||
43 | /** |
||
44 | * Execute the console command. |
||
45 | * @return int |
||
46 | */ |
||
47 | 2 | public function handle() |
|
74 | |||
75 | /** |
||
76 | * Inject a stdout logger |
||
77 | * |
||
78 | * This is a "hackish" method because we handle a interface to deduce an implementation |
||
79 | * that exposes certain methods. |
||
80 | * |
||
81 | * @todo - Find a better way to inject a CLI logger when running in verbose mode |
||
82 | * |
||
83 | * @param LoggerAwareInterface $consumerWithLogger |
||
84 | * @throws \Exception |
||
85 | */ |
||
86 | protected function injectCliLogger(LoggerAwareInterface $consumerWithLogger) |
||
101 | } |
||
102 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.