| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 35 | { |
||
| 36 | $object = $input->getArgument('object'); |
||
| 37 | $classes = (array) ClassInfo::subclassesFor($object); |
||
| 38 | // Remove the class itself |
||
| 39 | array_shift($classes); |
||
| 40 | if (!$classes) { |
||
|
|
|||
| 41 | $output->writeln('There are no child classes for ' . $object); |
||
| 42 | return; |
||
| 43 | } |
||
| 44 | sort($classes); |
||
| 45 | $rows = array_map(function ($class) { |
||
| 46 | return [$class]; |
||
| 47 | }, $classes); |
||
| 48 | |||
| 49 | $output->writeln('<info>Child classes for ' . $object . ':</info>'); |
||
| 50 | $table = new Table($output); |
||
| 51 | $table |
||
| 52 | ->setHeaders(['Class name']) |
||
| 53 | ->setRows($rows) |
||
| 54 | ->render(); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.