Conditions | 1 |
Paths | 1 |
Total Lines | 7 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
21 | 1 | public static function detectDate(SplFileInfo $file) : DateTimeInterface |
|
22 | { |
||
23 | 1 | preg_match('/(\d{4})[\/\-]*(\d{2})[\/\-]*(\d{2})[\/\-]*(\d+|)/', $file->getFilename(), $matches); |
|
24 | 1 | list($dummy, $year, $month, $day) = $matches; |
|
|
|||
25 | |||
26 | 1 | return new DateTime(implode('-', [$year, $month, $day])); |
|
27 | } |
||
28 | |||
36 |
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.