| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | protected function execute(InputInterface $input, OutputInterface $output): void |
||
| 42 | { |
||
| 43 | $username = $input->getArgument('username'); |
||
| 44 | $user = $this->userRepository->findByUsername($username); |
||
|
|
|||
| 45 | |||
| 46 | if (!$user) { |
||
| 47 | $output->writeln('<error>'.$username.' doesn\'t exists'); |
||
| 48 | |||
| 49 | return; |
||
| 50 | } |
||
| 51 | |||
| 52 | $baseUserTransferObject = UserDataTransferObject::fromUser($user); |
||
| 53 | |||
| 54 | $this->handler->handle($baseUserTransferObject); |
||
| 55 | |||
| 56 | $output->writeln($username . ' has been deleted'); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.