| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 25 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 20 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 18 | protected function execute(InputInterface $input, OutputInterface $output): int | ||
| 19 |     { | ||
| 20 | $steps = 1; | ||
| 21 | $number = random_int(0, 100); | ||
| 22 | |||
| 23 | $io = new SymfonyStyle($input, $output); | ||
| 24 |         $io->title('Welcome to the Guessing Game!'); | ||
| 25 | |||
| 26 | |||
| 27 |         $helper = $this->getHelper('question'); | ||
| 28 |         $question = new Question('Please enter a number between 0 and 100: '); | ||
| 29 | |||
| 30 |         while (true) { | ||
| 31 | $answer = (int) $helper->ask($input, $output, $question); | ||
| 32 | |||
| 33 |             if ($answer === $number) { | ||
| 34 |                 $io->success('You win! You guessed the number in ' . $steps . ' steps.'); | ||
| 35 | return 0; | ||
| 36 | } | ||
| 37 | |||
| 38 | $steps++; | ||
| 39 |             if ($answer > $number) { | ||
| 40 |                 $io->warning('Too high!'); | ||
| 41 |             } else { | ||
| 42 |                 $io->warning('Too low!'); | ||
| 43 | } | ||
| 47 | 
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: