1 | <?php |
||
10 | abstract class AbstractFieldParserDate extends FieldParserFixedText implements FieldParserInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var \DateTimeImmutable |
||
14 | */ |
||
15 | protected $dateTimeNow; |
||
16 | |||
17 | /** |
||
18 | * @var DateFormatterFactory |
||
19 | */ |
||
20 | private $dateFormatterFactory; |
||
21 | |||
22 | /** |
||
23 | * @param \DateTimeImmutable $dateTimeNow |
||
24 | * @param DateFormatterFactory $dateFormatterFactory |
||
25 | */ |
||
26 | 16 | public function __construct(\DateTimeImmutable $dateTimeNow, DateFormatterFactory $dateFormatterFactory) |
|
31 | |||
32 | /** |
||
33 | * @return string |
||
34 | * @throws UnsupportedDateFormatException |
||
35 | */ |
||
36 | 2 | public function getText() |
|
46 | |||
47 | /** |
||
48 | * Fetch a DateTime object set to the correct date/time. |
||
49 | * |
||
50 | * @return \DateTimeInterface |
||
51 | */ |
||
52 | abstract protected function getDateTime(); |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 2 | public function getDateFormat() |
|
61 | |||
62 | /** |
||
63 | * @return FieldParserInterface |
||
64 | */ |
||
65 | 2 | public static function factory() |
|
72 | } |
||
73 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: