Completed
Push — develop ( b9756c...666e87 )
by Stuart
02:32
created

__construct/ExampleClass.inc.php (5 issues)

Upgrade to new PHP Analysis Engine

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
Coding Style Compatibility introduced by
Each trait must be in a namespace of at least one level (a top-level vendor name)

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...
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
Coding Style Compatibility introduced by
Each trait must be in a file by itself

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
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
The property $value3 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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
The property $value6 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
33
}