Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
56 | public function timestampProvider() { |
||
57 | return array( |
||
58 | // Make sure it's identical to the PHP/Unix time stamps in current years |
||
59 | array( '+2004-02-29T00:00:00Z', strtotime( '2004-02-29T00:00:00+00:00' ) ), |
||
60 | array( '+2038-00-00T00:00:00Z', strtotime( '2038-01-01T00:00:00+00:00' ) ), |
||
61 | |||
62 | // Time zones |
||
63 | array( '+2000-01-01T12:59:59', strtotime( '2000-01-01T12:59:59-02:00' ), -120 ), |
||
64 | array( '+2000-01-01T12:59:59', strtotime( '2000-01-01T12:59:59+04:45' ), 285 ), |
||
65 | |||
66 | array( '+0401-00-00T00:00:00Z', -49512816000 ), |
||
67 | array( '+1902-00-00T00:00:00Z', -2145916800 ), |
||
68 | array( '+1939-00-00T00:00:00Z', -978307200 ), |
||
69 | array( '+1969-12-31T23:59:00Z', -60 ), |
||
70 | array( '+1969-12-31T23:59:59Z', -1 ), |
||
71 | array( '+1970-01-01T00:00:00Z', 0 ), |
||
72 | array( '+1970-01-01T00:00:01Z', 1 ), |
||
73 | array( '+1970-01-01T00:01:00Z', 60 ), |
||
74 | array( '+1972-02-29T00:00:00Z', 68169600 ), |
||
75 | array( '+1996-02-29T00:00:00Z', 825552000 ), |
||
76 | array( '+1999-12-31T23:59:59Z', 946684799 ), |
||
77 | array( '+2000-01-01T00:00:00Z', 946684800 ), |
||
78 | array( '+2000-02-01T00:00:00Z', 949363200 ), |
||
79 | array( '+2000-02-29T00:00:00Z', 951782400 ), |
||
80 | array( '+2001-00-00T00:00:00Z', 978307200 ), |
||
81 | array( '+2001-01-01T00:00:00Z', 978307200 ), |
||
82 | array( '+2014-04-30T12:35:55Z', 1398861355 ), |
||
83 | array( '+2401-00-00T00:00:00Z', 13601088000 ), |
||
84 | |||
85 | // Make sure there is only 1 second between these two |
||
86 | array( '-0001-12-31T23:59:59Z', -62135596801 ), |
||
87 | array( '+0001-00-00T00:00:00Z', -62135596800 ), |
||
88 | |||
89 | // No special calculation for leap seconds, just make sure they pass |
||
90 | array( '+1970-10-11T12:13:61Z', 24495241 ), |
||
91 | array( '+1970-10-11T12:14:01Z', 24495241 ), |
||
92 | |||
93 | // Year 0 does not exist, but we do not complain, assume -1 |
||
94 | array( '-0000-12-31T23:59:59Z', -62135596801 ), |
||
95 | array( '+0000-00-00T00:00:00Z', floor( ( -1 - 1969 ) * 365.2425 ) * 86400 ), |
||
96 | |||
97 | // Since there is no year 0, negative leap years are -1, -5 and so on |
||
98 | array( '-8001-00-00T00:00:00Z', floor( ( -8001 - 1969 ) * 365.2425 ) * 86400 ), |
||
99 | array( '-0005-00-00T00:00:00Z', floor( ( -5 - 1969 ) * 365.2425 ) * 86400 ), |
||
100 | array( '+0004-00-00T00:00:00Z', floor( ( 4 - 1970 ) * 365.2425 ) * 86400 ), |
||
101 | array( '+8000-00-00T00:00:00Z', floor( ( 8000 - 1970 ) * 365.2425 ) * 86400 ), |
||
102 | |||
103 | // PHP_INT_MIN is -2147483648 |
||
104 | array( '-2147484001-00-00T00:00:00Z', floor( ( -2147484001 - 1969 ) * 365.2425 ) * 86400 ), |
||
105 | // PHP_INT_MAX is +2147483647 |
||
106 | array( '+2147484000-00-00T00:00:00Z', floor( ( 2147484000 - 1970 ) * 365.2425 ) * 86400 ), |
||
107 | ); |
||
108 | } |
||
109 | |||
214 |
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: