These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | class ExampleClass1 |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | // HasClassProperties::check() will find these, depending on the |
||
6 | // $filter that you pass to it |
||
7 | public static $value1 = "I am public static value1"; |
||
8 | protected static $value2 = "I am protected static value2"; |
||
9 | private static $value3 = "I am private static value3"; |
||
10 | |||
11 | // HasClassProperties::check() will not find these, because they are not |
||
12 | // static propertes |
||
13 | public $value4 = "I am public value4"; |
||
14 | protected $value5 = "I am protected value5"; |
||
15 | private $value6 = "I am private value6"; |
||
16 | } |
||
17 | |||
18 | class ExampleClass2 |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
The type
ExampleClass2 has been defined more than once; this definition is ignored, only the first definition in doc-examples/HasClassPro.../ExampleClasses.inc.php (L18-31) is considered.
This check looks for classes that have been defined more than once. If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface. This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.
Loading history...
|
|||
19 | { |
||
20 | // HasClassProperties::check() will find these, depending on the |
||
21 | // $filter that you pass to it |
||
22 | public static $value7 = "I am public static value7"; |
||
23 | protected static $value8 = "I am protected static value8"; |
||
24 | private static $value9 = "I am private static value9"; |
||
25 | |||
26 | // HasClassProperties::check() will not find these, because they are not |
||
27 | // static propertes |
||
28 | public $value10 = "I am public value10"; |
||
29 | protected $value11 = "I am protected value11"; |
||
30 | private $value12 = "I am private value12"; |
||
31 | } |
||
32 | |||
33 | class ExampleClass3 |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
The type
ExampleClass3 has been defined more than once; this definition is ignored, only the first definition in doc-examples/HasClassPro.../ExampleClasses.inc.php (L33-36) is considered.
This check looks for classes that have been defined more than once. If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface. This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.
Loading history...
|
|||
34 | { |
||
35 | // we have no static properties! |
||
36 | } |
This check looks for classes that have been defined more than once.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.