Completed
Push — master ( dd8cf8...395659 )
by Jaap
08:57
created

GraphNodeReflectionExtension::getProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 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
        if ($classReflection->getName() === Graph::class) {
29
            return true;
30
        }
31
32
        return false;
33
    }
34
35
    public function getProperty(ClassReflection $classReflection, string $propertyName) : PropertyReflection
36
    {
37
        return new AnnotationPropertyReflection(
38
            $classReflection,
39
            new ObjectType(Node::class),
40
            true,
41
            true
42
        );
43
    }
44
}
45