Passed
Push — master ( be1c18...95b62e )
by SignpostMarv
05:53
created

ObtainPropertyReflection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
* Base daft objects.
4
*
5
* @author SignpostMarv
6
*/
7
declare(strict_types=1);
8
9
namespace SignpostMarv\DaftObject\DaftNestedObject\PHPStan;
10
11
use PHPStan\Broker\Broker;
12
use PHPStan\Reflection\ClassReflection;
13
use PHPStan\Reflection\PropertyReflection;
14
use SignpostMarv\DaftObject\DaftNestedObject;
15
use SignpostMarv\DaftObject\PHPStan\ClassReflectionExtension as Base;
16
17
/**
18
* @template TObj as DaftNestedObject
19
*
20
* @template-extends Base<TObj>
21
*/
22
class ClassReflectionExtension extends Base
23
{
24
    public function hasProperty(ClassReflection $classReflection, string $propertyName) : bool
25
    {
26
        $property = ucfirst($propertyName);
27
28
        return
29
            parent::hasProperty($classReflection, $property) ||
30
            PropertyReflectionExtension::PropertyIsInt($property);
31
    }
32
33
    protected function ObtainPropertyReflection(
34
        ClassReflection $ref,
35
        Broker $broker,
36
        string $propertyName
37
    ) : PropertyReflection {
38
        return new PropertyReflectionExtension($ref, $broker, $propertyName);
39
    }
40
}
41