SingletonClass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
1
<?php
2
3
namespace TestNamespace;
4
5
/**
6
 * Generated Class
7
 */
8
class SingletonClass
9
{
10
    /**
11
     * Singleton instance
12
     *
13
     * @var TestNamespace\SingletonClass
14
     */
15
    protected static $instance;
16
17
    /**
18
     * Singleton NO THREAD SAFE!
19
     *
20
     * @return TestNamespace\SingletonClass|null
21
     */
22
    final public static function getInstance()
23
    {
24
        if (is_null(self::$instance)) {
25
            self::$instance = new self();
0 ignored issues
show
Documentation Bug introduced by
It seems like new self() of type object<TestNamespace\SingletonClass> is incompatible with the declared type object<TestNamespace\Tes...mespace\SingletonClass> of property $instance.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
26
        }
27
28
        return self::$instance;
29
    }
30
}
31