Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
29 | 7 | private function getModifiedSince(Request $request):\DateTime |
|
30 | { |
||
31 | 7 | if ($request->headers->has(self::HTTP_HEADER_NAME)) { |
|
32 | 2 | $string = $request->headers->get(self::HTTP_HEADER_NAME); |
|
33 | 2 | return \DateTime::createFromFormat(\DateTime::RSS, $string); |
|
34 | } |
||
35 | |||
36 | 6 | return new \DateTime('@1'); |
|
37 | } |
||
38 | } |
||
39 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: