1 | <?php |
||
21 | trait DateTimeTrait |
||
22 | { |
||
23 | use ArithmeticTrait, ComparisonTrait, TypeTrait; |
||
24 | |||
25 | /** |
||
26 | * @var \DateTime |
||
27 | */ |
||
28 | protected $native; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $timestamp; |
||
34 | |||
35 | /** |
||
36 | * @param $string |
||
37 | * @return mixed |
||
38 | */ |
||
39 | 16 | public static function fromString($string) |
|
43 | |||
44 | /** |
||
45 | * @param $timestamp |
||
46 | * @return mixed |
||
47 | */ |
||
48 | 1 | public static function fromTimestamp($timestamp) |
|
52 | |||
53 | /** |
||
54 | * @param string $format |
||
55 | * @return int |
||
56 | */ |
||
57 | 33 | public static function getNowDateTimeFormat($format) |
|
61 | |||
62 | /** |
||
63 | * @param string $string |
||
|
|||
64 | * @return \DateTime |
||
65 | */ |
||
66 | 44 | public static function getDateTime($string = null) |
|
70 | |||
71 | /** |
||
72 | * @return \DateTime |
||
73 | */ |
||
74 | 44 | public static function getNowDateTime() |
|
78 | |||
79 | /** |
||
80 | * @return \DateTime |
||
81 | */ |
||
82 | 8 | public function getNative() |
|
86 | |||
87 | /** |
||
88 | * @return int |
||
89 | */ |
||
90 | 11 | public function getTimestamp() |
|
94 | |||
95 | /** |
||
96 | * @param DateTimeInterface $object |
||
97 | * @return bool |
||
98 | */ |
||
99 | 1 | public function isBefore(DateTimeInterface $object) |
|
103 | |||
104 | /** |
||
105 | * @param DateTimeInterface $object |
||
106 | * @return bool |
||
107 | */ |
||
108 | 1 | public function isAfter(DateTimeInterface $object) |
|
112 | |||
113 | /** |
||
114 | * @param DateTimeInterface $object |
||
115 | * @return bool |
||
116 | */ |
||
117 | 1 | public function isAfterOrIs(DateTimeInterface $object) |
|
121 | |||
122 | /** |
||
123 | * @param DateTimeInterface $object |
||
124 | * @return bool |
||
125 | */ |
||
126 | 1 | public function isBeforeOrIs(DateTimeInterface $object) |
|
130 | } |
||
131 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.