1 | <?php |
||
13 | abstract class CachedModel extends BaseModel |
||
14 | { |
||
15 | /** |
||
16 | * {@inheritdoc} |
||
17 | * |
||
18 | * @return static |
||
19 | */ |
||
20 | 77 | public static function get($id) |
|
41 | |||
42 | /** |
||
43 | * Find out whether a model exists in the cache |
||
44 | * |
||
45 | * @param int $id The ID of the model |
||
46 | * @return bool True if the model exists in the cache |
||
47 | */ |
||
48 | 76 | private static function existsInCache($id) |
|
58 | |||
59 | /** |
||
60 | * Get a model from the cache |
||
61 | * |
||
62 | * @param int $id The ID of the model |
||
63 | * @return static|null The model if it's found, null if it doesn't exist |
||
64 | */ |
||
65 | 76 | private static function getFromCache($id) |
|
73 | |||
74 | /** |
||
75 | * Store the model in the cache |
||
76 | * |
||
77 | * @return self |
||
78 | */ |
||
79 | 76 | protected function storeInCache() |
|
89 | |||
90 | /** |
||
91 | * Fetch a model's data from the database again |
||
92 | * @return static The new model |
||
93 | */ |
||
94 | 76 | public function refresh() |
|
100 | |||
101 | /** |
||
102 | * Get a model's data from the database |
||
103 | */ |
||
104 | 76 | private function getFromDatabase() |
|
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | 76 | protected static function create($params, $now = null, $table = '') |
|
124 | } |
||
125 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.