1 | <?php defined('SYSPATH') OR die('No direct script access.'); |
||
21 | abstract class Kohana_Jam_Field_Timestamp extends Jam_Field { |
||
22 | |||
23 | /** |
||
24 | * @var int default is NULL, which implies no date |
||
25 | */ |
||
26 | public $default = NULL; |
||
27 | |||
28 | /** |
||
29 | * @var boolean whether or not to automatically set now() on creation |
||
30 | */ |
||
31 | public $auto_now_create = FALSE; |
||
32 | |||
33 | /** |
||
34 | * @var boolean whether or not to automatically set now() on update |
||
35 | */ |
||
36 | public $auto_now_update = FALSE; |
||
37 | |||
38 | /** |
||
39 | * @var string a date formula representing the time in the database |
||
40 | */ |
||
41 | public $format = NULL; |
||
42 | |||
43 | /** |
||
44 | * Jam_Timezone object for manipulating timezones |
||
45 | * @var Jam_Timezone |
||
46 | */ |
||
47 | public $timezone = NULL; |
||
48 | |||
49 | /** |
||
50 | * Convert empty values by default because some DB's |
||
51 | * will convert empty strings to zero timestamps |
||
52 | */ |
||
53 | public $convert_empty = TRUE; |
||
54 | |||
55 | /** |
||
56 | * Sets the default to 0 if we have no format, or an empty string otherwise. |
||
57 | * |
||
58 | * @param array $options |
||
59 | */ |
||
60 | 8 | public function __construct($options = array()) |
|
75 | |||
76 | |||
77 | 4 | public function get(Jam_Validated $model, $value, $is_loaded) |
|
99 | |||
100 | /** |
||
101 | * Automatically creates or updates the time and |
||
102 | * converts it, if necessary. |
||
103 | * |
||
104 | * @param Jam_Model $model |
||
105 | * @param mixed $value |
||
106 | * @param boolean $is_loaded |
||
107 | * @return int|string |
||
108 | */ |
||
109 | 6 | public function convert(Jam_Validated $model, $value, $is_loaded) |
|
143 | |||
144 | } // End Kohana_Jam_Field_Timestamp |
||
145 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.