Variables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A assert() 0 7 2
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Spec\Constraint;
13
14
use Phplrt\Contracts\Ast\NodeInterface;
15
use Railt\SDL\Exception\TypeErrorException;
16
use Railt\SDL\Frontend\Ast\Value\VariableValueNode;
17
use Railt\SDL\Spec\SpecificationInterface;
18
19
/**
20
 * Class Variables
21
 */
22
class Variables extends Constraint
23
{
24
    /**
25
     * @param NodeInterface $node
26
     * @param SpecificationInterface $spec
27
     * @return void
28
     */
29
    public static function assert(NodeInterface $node, SpecificationInterface $spec): void
30
    {
31
        if (! $node instanceof VariableValueNode) {
32
            return;
33
        }
34
35
        throw TypeErrorException::fromAst(static::notSupported($spec), $node);
36
    }
37
}
38