Test Failed
Push — master ( 08b170...e6bc2a )
by Kirill
02:02
created

TypeDefinitionBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A bind() 0 12 2
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Builder\Definition;
11
12
use Railt\Reflection\AbstractTypeDefinition;
13
use Railt\Reflection\Contracts\Definition;
14
use Railt\Reflection\Contracts\Invocation\Behaviour\ProvidesDirectives;
15
use Railt\SDL\Builder\Builder;
16
use Railt\SDL\Builder\Utils;
17
18
/**
19
 * Class TypeDefinitionBuilder
20
 */
21
abstract class TypeDefinitionBuilder extends Builder
22
{
23
    /**
24
     * @param Definition|AbstractTypeDefinition $definition
25
     * @return Definition
26
     */
27
    protected function bind(Definition $definition): Definition
28
    {
29
        if ($definition instanceof Definition\TypeDefinition) {
0 ignored issues
show
Bug introduced by
The class Railt\Reflection\Contrac...finition\TypeDefinition does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
30
            $definition->withDescription(Utils::findDescription($this->ast));
31
        }
32
33
        //if ($definition instanceof ProvidesDirectives) {
34
35
        //}
36
37
        return parent::bind($definition);
38
    }
39
}
40