1 | <?php |
||
35 | class ConsoleDispatcher extends Component implements SingletonInterface, DispatcherInterface |
||
36 | { |
||
37 | /** |
||
38 | * Undefined response code for command (errors). See below. |
||
39 | */ |
||
40 | const CODE_UNDEFINED = 102; |
||
41 | |||
42 | /** |
||
43 | * @var ConsoleApplication |
||
44 | */ |
||
45 | private $application = null; |
||
46 | |||
47 | /** |
||
48 | * Active console output. |
||
49 | * |
||
50 | * @var OutputInterface |
||
51 | */ |
||
52 | private $output = null; |
||
53 | |||
54 | /** |
||
55 | * @var ConsoleConfig |
||
56 | */ |
||
57 | protected $config; |
||
58 | |||
59 | /** |
||
60 | * @invisible |
||
61 | * @var ContainerInterface |
||
62 | */ |
||
63 | protected $container; |
||
64 | |||
65 | /** |
||
66 | * @invisible |
||
67 | * @var MemoryInterface |
||
68 | */ |
||
69 | protected $memory; |
||
70 | |||
71 | /** |
||
72 | * @invisible |
||
73 | * @var LocatorInterface |
||
74 | */ |
||
75 | protected $locator; |
||
76 | |||
77 | /** |
||
78 | * @param ConsoleConfig $config |
||
79 | * @param ContainerInterface|null $container |
||
80 | * @param MemoryInterface|null $memory |
||
81 | * @param LocatorInterface|null $locator |
||
82 | */ |
||
83 | public function __construct( |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | * |
||
98 | * @param InputInterface $input |
||
99 | * @param OutputInterface $output |
||
100 | */ |
||
101 | public function start(InputInterface $input = null, OutputInterface $output = null) |
||
113 | |||
114 | /** |
||
115 | * Execute console command by it's name. |
||
116 | * |
||
117 | * @param string|null $command Default command when null. |
||
118 | * @param array|InputInterface $input |
||
119 | * @param OutputInterface $output |
||
120 | * |
||
121 | * @return CommandOutput |
||
122 | * |
||
123 | * @throws ConsoleException |
||
124 | */ |
||
125 | public function run( |
||
158 | |||
159 | /** |
||
160 | * Get or create instance of ConsoleApplication. |
||
161 | * |
||
162 | * @return ConsoleApplication |
||
163 | */ |
||
164 | public function consoleApplication() |
||
184 | |||
185 | /** |
||
186 | * Locate every available Symfony command using Tokenizer. |
||
187 | * |
||
188 | * @param bool $reset Ignore cache. |
||
189 | * |
||
190 | * @return array |
||
191 | */ |
||
192 | public function getCommands(bool $reset = false): array |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | * |
||
214 | * @param OutputInterface $output |
||
215 | */ |
||
216 | public function handleSnapshot(SnapshotInterface $snapshot, OutputInterface $output = null) |
||
223 | } |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.