1 | <?php |
||
23 | class MongoTimestamp implements TypeInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | private static $globalInc = 0; |
||
29 | |||
30 | /** |
||
31 | * @link http://php.net/manual/en/class.mongotimestamp.php#mongotimestamp.props.sec |
||
32 | * @var int |
||
33 | */ |
||
34 | public $sec; |
||
35 | |||
36 | /** |
||
37 | * @link http://php.net/manual/en/class.mongotimestamp.php#mongotimestamp.props.inc |
||
38 | * @var int |
||
39 | */ |
||
40 | public $inc; |
||
41 | |||
42 | /** |
||
43 | * Creates a new timestamp. If no parameters are given, the current time is used |
||
44 | * and the increment is automatically provided. The increment is set to 0 when the |
||
45 | * module is loaded and is incremented every time this constructor is called |
||
46 | * (without the $inc parameter passed in). |
||
47 | * |
||
48 | * @link http://php.net/manual/en/mongotimestamp.construct.php |
||
49 | * @param int $sec [optional] Number of seconds since January 1st, 1970 |
||
50 | * @param int $inc [optional] Increment |
||
51 | */ |
||
52 | public function __construct($sec = 0, $inc = 0) |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function __toString() |
||
83 | |||
84 | /** |
||
85 | * Converts this MongoTimestamp to the new BSON Timestamp type |
||
86 | * |
||
87 | * @return Timestamp |
||
88 | * @internal This method is not part of the ext-mongo API |
||
89 | */ |
||
90 | public function toBSONType() |
||
94 | } |
||
95 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: