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

NoValueMonad   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getInstance() 0 7 2
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