1 | <?php |
||
7 | trait HasAttributesTrait |
||
8 | { |
||
9 | protected $attributes = []; |
||
10 | |||
11 | /** |
||
12 | * Set a given log value. |
||
13 | * |
||
14 | * @param array|string $key |
||
15 | * @param mixed $value |
||
16 | * |
||
17 | * @return $this |
||
18 | */ |
||
19 | public function setAttribute($key, $value = null) |
||
28 | |||
29 | /** |
||
30 | * Get the specified log value. |
||
31 | * |
||
32 | * @param null|string $key |
||
33 | * @param mixed $default |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function getAttribute($key = null, $default = null) |
||
41 | |||
42 | /** |
||
43 | * Get all of the current attributes on the class. |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | public function getAttributes() |
||
51 | |||
52 | /** |
||
53 | * Determine if the given key exists in the attributes. |
||
54 | * |
||
55 | * @param string|int $key |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function existsAttribute($key) |
||
63 | |||
64 | /** |
||
65 | * Check if an key or keys exist in the attributes using "dot" notation. |
||
66 | * |
||
67 | * @param string|array $keys |
||
68 | * |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function hasAttribute($keys) |
||
75 | |||
76 | /** |
||
77 | * Convert the Object instance to an array. |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function toArray() |
||
87 | |||
88 | /** |
||
89 | * Convert the object into something JSON serializable. |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | public function jsonSerialize() |
||
97 | |||
98 | /** |
||
99 | * Convert the Object instance to JSON. |
||
100 | * |
||
101 | * @param int $options |
||
102 | * @return string |
||
103 | */ |
||
104 | public function toJson($options = 0) |
||
108 | } |
||
109 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.