Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function testNewFromDateTime() { |
||
36 | |||
37 | $instance = DITime::newFromDateTime( |
||
38 | new \DateTime( '2012-07-08 11:14:15.638276' ) |
||
39 | ); |
||
40 | |||
41 | $this->assertEquals( |
||
42 | '15.638276', |
||
43 | $instance->getSecond() |
||
44 | ); |
||
45 | |||
46 | $instance = DITime::newFromDateTime( |
||
47 | new \DateTime( '1582-10-04' ) |
||
48 | ); |
||
49 | |||
50 | $this->assertEquals( |
||
51 | DITime::CM_JULIAN, |
||
52 | $instance->getCalendarModel() |
||
53 | ); |
||
54 | |||
55 | $instance = DITime::newFromDateTime( |
||
56 | new \DateTime( '1582-10-05' ) |
||
57 | ); |
||
58 | |||
59 | $this->assertEquals( |
||
60 | DITime::CM_GREGORIAN, |
||
61 | $instance->getCalendarModel() |
||
62 | ); |
||
63 | } |
||
64 | |||
108 |
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: