1 | <?php |
||
19 | class Controller |
||
20 | { |
||
21 | /** |
||
22 | * Simple Date format. |
||
23 | * Example: `2005-08-15` |
||
24 | */ |
||
25 | private const DATE = 'DATE'; |
||
26 | |||
27 | /** |
||
28 | * Simple Time format. |
||
29 | * Example: `15:52:01` |
||
30 | */ |
||
31 | private const TIME = 'TIME'; |
||
32 | |||
33 | /** |
||
34 | * Simple DateTime format. |
||
35 | * Example: `2005-08-15 15:52:01` |
||
36 | */ |
||
37 | private const DATE_TIME = 'DATE_TIME'; |
||
38 | |||
39 | /** |
||
40 | * RFC 7231 date format. |
||
41 | * Example: `Mon, 15 Aug 2005 15:52:01 GMT` |
||
42 | */ |
||
43 | private const RFC7231 = 'RFC7231'; |
||
44 | |||
45 | /** |
||
46 | * ISO-8601 date format. |
||
47 | * Example: `2005-08-15T15:52:01+00:00` |
||
48 | * |
||
49 | * Note: This format is an alias of the RFC 3339 specification: |
||
50 | * @see https://www.iso.org/iso-8601-date-and-time-format.html |
||
51 | * @see https://www.ietf.org/rfc/rfc3339.txt |
||
52 | */ |
||
53 | private const ISO8601 = 'ISO8601'; |
||
54 | |||
55 | /** |
||
56 | * Human readable string. |
||
57 | * Example: `2 days ago` |
||
58 | */ |
||
59 | private const HUMAN_READABLE = 'HUMAN_READABLE'; |
||
60 | |||
61 | /** |
||
62 | * @param InputInterface $input |
||
63 | * @return string |
||
64 | * @throws \InvalidArgumentException |
||
65 | */ |
||
66 | public function getDateTime(InputInterface $input): string |
||
70 | |||
71 | /** |
||
72 | * @param \DateTimeInterface|\DateInterval $date |
||
73 | * @param string $format |
||
74 | * @return string |
||
75 | * @throws \InvalidArgumentException |
||
76 | * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException |
||
77 | */ |
||
78 | private function format($date, string $format): string |
||
106 | |||
107 | /** |
||
108 | * @param InputInterface $input |
||
109 | * @return Carbon |
||
110 | * @throws \InvalidArgumentException |
||
111 | */ |
||
112 | private function extract(InputInterface $input): Carbon |
||
125 | |||
126 | /** |
||
127 | * @param InputInterface $input |
||
128 | * @return string |
||
129 | * @throws \InvalidArgumentException |
||
130 | */ |
||
131 | public function diff(InputInterface $input): string |
||
146 | |||
147 | /** |
||
148 | * @param InputInterface $input |
||
149 | * @return Carbon |
||
150 | * @throws InvalidDateTimeFormat |
||
151 | * @throws \InvalidArgumentException |
||
152 | */ |
||
153 | private function extractDiff(InputInterface $input): Carbon |
||
165 | } |
||
166 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.