1 | <?php |
||
20 | abstract class AbstractDateHeader implements HeaderInterface |
||
21 | { |
||
22 | use HeaderFactoryTrait { |
||
23 | HeaderFactoryTrait::create as protected createHeader; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected static $headerName; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected static $format = 'D, d M Y H:i:s \G\M\T'; |
||
35 | |||
36 | /** |
||
37 | * @var DateTime |
||
38 | */ |
||
39 | private $date; |
||
40 | |||
41 | /** |
||
42 | * Constructor. |
||
43 | * |
||
44 | * @param DateTime|null $date |
||
45 | */ |
||
46 | public function __construct(DateTime $date = null) |
||
51 | |||
52 | /** |
||
53 | * Factory create header. |
||
54 | * |
||
55 | * @param string $fieldName |
||
56 | * @param string $fieldValue |
||
57 | * |
||
58 | * @return $this |
||
59 | */ |
||
60 | public static function create($fieldName, $fieldValue) |
||
64 | |||
65 | /** |
||
66 | * Get header name. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getFieldName() |
||
74 | |||
75 | /** |
||
76 | * Set date. |
||
77 | * |
||
78 | * @param DateTime $date |
||
79 | * |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function setDate(DateTime $date) |
||
90 | |||
91 | /** |
||
92 | * Get date. |
||
93 | * |
||
94 | * @return DateTime |
||
95 | */ |
||
96 | public function getDate() |
||
100 | |||
101 | /** |
||
102 | * Get header field value. |
||
103 | * |
||
104 | * @return mixed |
||
105 | */ |
||
106 | public function getFieldValue() |
||
110 | |||
111 | /** |
||
112 | * Cast header to string. |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | public function __toString() |
||
120 | } |
||
121 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: