GraphNodeReflectionExtension::hasProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * phpDocumentor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @link      http://phpdoc.org
12
 */
13
14
namespace phpDocumentor\GraphViz\PHPStan;
15
16
use phpDocumentor\GraphViz\Graph;
17
use phpDocumentor\GraphViz\Node;
18
use PHPStan\Reflection\Annotations\AnnotationPropertyReflection;
19
use PHPStan\Reflection\ClassReflection;
20
use PHPStan\Reflection\PropertiesClassReflectionExtension;
21
use PHPStan\Reflection\PropertyReflection;
22
use PHPStan\Type\ObjectType;
23
24
final class GraphNodeReflectionExtension implements PropertiesClassReflectionExtension
25
{
26
    public function hasProperty(ClassReflection $classReflection, string $propertyName) : bool
27
    {
28
        return $classReflection->getName() === Graph::class;
29
    }
30
31
    public function getProperty(ClassReflection $classReflection, string $propertyName) : PropertyReflection
32
    {
33
        return new AnnotationPropertyReflection(
34
            $classReflection,
35
            new ObjectType(Node::class),
36
            true,
37
            true
38
        );
39
    }
40
}
41