gyselroth /
mongodb-php-task-scheduler
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /** |
||
| 6 | * TaskScheduler |
||
| 7 | * |
||
| 8 | * @author Raffael Sahli <[email protected]> |
||
| 9 | * @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com) |
||
| 10 | * @license MIT https://opensource.org/licenses/MIT |
||
| 11 | */ |
||
| 12 | |||
| 13 | namespace TaskScheduler; |
||
| 14 | |||
| 15 | trait InjectTrait |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * This method may seem useless but is actually very useful to mock the loop. |
||
| 19 | */ |
||
| 20 | protected function loop(): bool |
||
| 21 | { |
||
| 22 | return true; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * This method may seem useless but is actually very useful to mock exits. |
||
| 27 | */ |
||
| 28 | protected function exit(): bool |
||
| 29 | { |
||
| 30 | exit(); |
||
|
0 ignored issues
–
show
|
|||
| 31 | } |
||
| 32 | } |
||
| 33 |
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: