These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | trait ExampleTrait |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | // FilterClassProperties::from() will find these, depending on the |
||
6 | // $filter that you pass to it |
||
7 | public static $trait1 = "I am public static trait1"; |
||
8 | protected static $trait2 = "I am protected static trait2"; |
||
9 | private static $trait3 = "I am private static trait3"; |
||
10 | |||
11 | // FilterClassProperties::from() will not find these, because they are not |
||
12 | // static propertes |
||
13 | public $trait4 = "I am public trait4"; |
||
14 | protected $trait5 = "I am protected trait5"; |
||
15 | private $trait6 = "I am private trait6"; |
||
16 | } |
||
17 | |||
18 | class ExampleClass |
||
0 ignored issues
–
show
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class: namespace YourVendor;
class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
Loading history...
|
|||
19 | { |
||
20 | use ExampleTrait; |
||
21 | |||
22 | // FilterClassProperties::from() will find these, depending on the |
||
23 | // $filter that you pass to it |
||
24 | public static $value1 = "I am public static value1"; |
||
25 | protected static $value2 = "I am protected static value2"; |
||
26 | private static $value3 = "I am private static value3"; |
||
0 ignored issues
–
show
|
|||
27 | |||
28 | // FilterClassProperties::from() will not find these, because they are not |
||
29 | // static propertes |
||
30 | public $value4 = "I am public value4"; |
||
31 | protected $value5 = "I am protected value5"; |
||
32 | private $value6 = "I am private value6"; |
||
0 ignored issues
–
show
|
|||
33 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.