Passed
Push — master ( 23f099...2790c0 )
by Smoren
02:31
created

NoValueMonad::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Smoren\PartialIntersection\Util;
4
5
class NoValueMonad
6
{
7
    private static ?self $instance = null;
8
9 121
    public static function getInstance(): self
10
    {
11 121
        if (self::$instance === null) {
12 1
            self::$instance = new self();
13
        }
14
15 121
        return self::$instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::instance could return the type null which is incompatible with the type-hinted return Smoren\PartialIntersection\Util\NoValueMonad. Consider adding an additional type-check to rule them out.
Loading history...
16
    }
17
18 1
    private function __construct()
19
    {
20 1
    }
21
}
22