Test Failed
Push — master ( 3e22f3...90cc1b )
by Kirill
03:50
created

FieldDefinitionNode   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypeHint() 0 4 1
A getFieldName() 0 4 1
A getArguments() 0 11 3
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\Compiler\Ast\Dependent;
11
12
use Railt\Parser\Ast\NodeInterface;
13
use Railt\Parser\Ast\Rule;
14
use Railt\Parser\Ast\RuleInterface;
15
use Railt\SDL\Compiler\Ast\Common\DescriptionProvider;
16
use Railt\SDL\Compiler\Ast\TypeHintNode;
17
18
/**
19
 * Class FieldDefinitionNode
20
 */
21
class FieldDefinitionNode extends Rule
22
{
23
    use DescriptionProvider;
24
25
    /**
26
     * @return TypeHintNode|NodeInterface
27
     */
28
    public function getTypeHint(): TypeHintNode
29
    {
30
        return $this->first('TypeHint', 1);
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getFieldName(): string
37
    {
38
        return $this->first('T_NAME', 1)->getValue();
0 ignored issues
show
Bug introduced by
The method getValue() does not exist on Railt\Parser\Ast\NodeInterface. Did you maybe mean getValues()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
39
    }
40
41
    /**
42
     * @return iterable|ArgumentDefinitionNode[]
43
     */
44
    public function getArguments(): iterable
45
    {
46
        $arguments = $this->first('FieldArguments', 1);
47
48
        if ($arguments) {
49
            /** @var RuleInterface $argument */
50
            foreach ($arguments as $argument) {
0 ignored issues
show
Bug introduced by
The expression $arguments of type object<Railt\Parser\Ast\NodeInterface> is not traversable.
Loading history...
51
                yield $argument->getChild(0);
52
            }
53
        }
54
    }
55
}
56