1 | <?php |
||
5 | class Cache |
||
6 | { |
||
7 | /** @var array */ |
||
8 | public static $values = []; |
||
9 | |||
10 | /** |
||
11 | * Determine if a value exists for a given object / hash. |
||
12 | * |
||
13 | * @param mixed $object |
||
14 | * @param string $backtraceHash |
||
15 | * |
||
16 | * @return bool |
||
17 | */ |
||
18 | public static function has($object, string $backtraceHash): bool |
||
28 | |||
29 | /** |
||
30 | * Retrieve a value for an object / hash. |
||
31 | * |
||
32 | * @param mixed $object |
||
33 | * @param string $backtraceHash |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public static function get($object, string $backtraceHash) |
||
41 | |||
42 | /** |
||
43 | * Set a cached value for an object / hash. |
||
44 | * |
||
45 | * @param mixed $object |
||
46 | * @param string $backtraceHash |
||
47 | * @param mixed $value |
||
48 | */ |
||
49 | public static function set($object, string $backtraceHash, $value) |
||
55 | |||
56 | /** |
||
57 | * Forget the stored items for the given objectHash. |
||
58 | * |
||
59 | * @param string $objectHash |
||
60 | */ |
||
61 | public static function forget(string $objectHash) |
||
65 | |||
66 | protected static function objectHash($object) : string |
||
70 | |||
71 | protected static function addDestroyListener($object) |
||
85 | } |
||
86 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.