Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
35 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
36 | { |
||
37 | $file = $input->getArgument('file'); |
||
38 | if (!file_exists($file)) { |
||
39 | throw new \RuntimeException("file not found"); |
||
40 | return 1; |
||
|
|||
41 | } |
||
42 | |||
43 | $code = file_get_contents($file); |
||
44 | $code = str_replace('<?php','',$code); |
||
45 | $success = $this->getCacheTool()->_eval($code); |
||
46 | $output->writeln(sprintf("<comment>File Output:\n <info>%s</info></comment>", $success)); |
||
47 | return 0; |
||
48 | } |
||
49 | } |
||
50 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.