Total Complexity | 4 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | #[Attribute(Attribute::TARGET_PROPERTY)] |
||
11 | class FoneSemDDD extends AbstractValidation |
||
12 | { |
||
13 | const WITH_MASK = '/^\[0-9]{4,5}-[0-9]{4}$/'; |
||
14 | const NO_MASK = '/^\[0-9]{8,9}$/'; |
||
15 | |||
16 | public function __construct(private bool $mask = true, ?string $message = 'Telefone inválido') |
||
19 | } |
||
20 | |||
21 | public function evaluate($input, array $context = []): bool |
||
33 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.