1 | <?php |
||
17 | class StatisticsRepository |
||
18 | { |
||
19 | /** |
||
20 | * Array containing the allowed sources |
||
21 | * |
||
22 | * @var string[] |
||
23 | */ |
||
24 | public const ALLOWED_SOURCES = ['php_version', 'db_type', 'db_version', 'cms_version', 'server_os']; |
||
25 | |||
26 | /** |
||
27 | * The database driver. |
||
28 | * |
||
29 | * @var DatabaseInterface |
||
30 | * @since 1.3.0 |
||
31 | */ |
||
32 | private $db; |
||
33 | |||
34 | /** |
||
35 | * Instantiate the repository. |
||
36 | * |
||
37 | * @param DatabaseInterface $db The database driver. |
||
38 | */ |
||
39 | 13 | public function __construct(DatabaseInterface $db) |
|
43 | |||
44 | /** |
||
45 | * Loads the statistics data from the database. |
||
46 | * |
||
47 | * @param string $column A single column to filter on |
||
48 | * |
||
49 | * @return array An array containing the response data |
||
50 | * |
||
51 | * @throws \InvalidArgumentException |
||
52 | */ |
||
53 | 6 | public function getItems(string $column = ''): array |
|
84 | |||
85 | /** |
||
86 | * Loads the recently updated statistics data from the database. |
||
87 | * |
||
88 | * Recently updated is an arbitrary 90 days, submit a pull request for a different behavior. |
||
89 | * |
||
90 | * @return array An array containing the response data |
||
91 | */ |
||
92 | 1 | public function getRecentlyUpdatedItems(): array |
|
110 | |||
111 | /** |
||
112 | * Saves the given data. |
||
113 | * |
||
114 | * @param \stdClass $data Data object to save. |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | 4 | public function save(\stdClass $data): void |
|
141 | } |
||
142 |
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: