Passed
Push — master ( ee28da...1c3e2f )
by Alexander
14:20 queued 13:06
created

FakeGenerator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 2 1
A originClass() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Yiisoft\Yii\Cycle\Tests\Generator\Stub;
4
5
use Cycle\Schema\GeneratorInterface;
6
use Cycle\Schema\Registry;
7
8
class FakeGenerator implements GeneratorInterface
9
{
10
    private string $originClass;
11
12
    public function __construct(string $originClass)
13
    {
14
        $this->originClass = $originClass;
15
    }
16
17
    public function run(Registry $registry): Registry
18
    {
19
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Cycle\Schema\Registry. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
20
21
    public function originClass(): string
22
    {
23
        return $this->originClass;
24
    }
25
}
26