Conditions | 2 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
42 | 1 | public function passes($attribute, $value) |
|
43 | { |
||
44 | try { |
||
45 | 1 | $date = Carbon::createFromFormat($this->format, $value); |
|
46 | |||
47 | 1 | return Card::isValidExpirationDate($date->year, $date->month); |
|
48 | 1 | } catch (\InvalidArgumentException $ex) { |
|
49 | 1 | $this->message = static::MSG_CARD_EXPIRATION_DATE_FORMAT_INVALID; |
|
50 | |||
51 | 1 | return false; |
|
52 | } |
||
53 | |||
54 | return false; |
||
|
|||
55 | } |
||
56 | |||
67 |
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.