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

FieldDefinitionNode::getArguments()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 0
dl 0
loc 11
ccs 0
cts 9
cp 0
crap 12
rs 9.9
c 0
b 0
f 0
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