| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 26 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 22 | protected function execute(InputInterface $input, OutputInterface $output): int | ||
| 23 |     { | ||
| 24 | $steps = 1; | ||
| 25 | $number = random_int(0, 100); | ||
| 26 | |||
| 27 | $io = new SymfonyStyle($input, $output); | ||
| 28 |         $io->title('Welcome to the Guessing Game!'); | ||
| 29 | |||
| 30 | |||
| 31 | /** @var QuestionHelper $helper */ | ||
| 32 |         $helper = $this->getHelper('question'); | ||
| 33 |         $question = new Question('Please enter a number between 0 and 100: '); | ||
| 34 | |||
| 35 |         while (true) { | ||
| 36 | $answer = (int) $helper->ask($input, $output, $question); | ||
| 37 | |||
| 38 |             if ($answer === $number) { | ||
| 39 |                 $io->success('You win! You guessed the number in ' . $steps . ' steps.'); | ||
| 40 | return 0; | ||
| 41 | } | ||
| 42 | |||
| 43 | $steps++; | ||
| 44 |             if ($answer > $number) { | ||
| 45 |                 $io->warning('Too high!'); | ||
| 46 |             } else { | ||
| 47 |                 $io->warning('Too low!'); | ||
| 48 | } | ||
| 52 | 
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: