Issues (126)

ProcessDefinitionComponents.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlgoWeb\ODataMetadata\ModelVisitorConcerns;
6
7
use AlgoWeb\ODataMetadata\EdmModelVisitor;
8
use AlgoWeb\ODataMetadata\Interfaces\IEnumMember;
9
use AlgoWeb\ODataMetadata\Interfaces\INamedElement;
10
use AlgoWeb\ODataMetadata\Interfaces\INavigationProperty;
11
use AlgoWeb\ODataMetadata\Interfaces\IProperty;
12
use AlgoWeb\ODataMetadata\Interfaces\IStructuralProperty;
13
use AlgoWeb\ODataMetadata\Interfaces\ITypeReference;
14
use AlgoWeb\ODataMetadata\Interfaces\IVocabularyAnnotatable;
15
16
trait ProcessDefinitionComponents
17
{
18
    protected function processNavigationProperty(INavigationProperty $property): void
19
    {
20
        /** @var EdmModelVisitor $this */
21
        $this->startElement($property, __METHOD__);
22
        $this->processProperty($property);
23
        $this->endElement($property, __METHOD__);
24
    }
25
26
    protected function processStructuralProperty(IStructuralProperty $property): void
27
    {
28
        /** @var EdmModelVisitor $this */
29
        $this->startElement($property, __METHOD__);
30
        $this->processProperty($property);
31
        $this->endElement($property, __METHOD__);
32
    }
33
34
    protected function processProperty(IProperty $property): void
35
    {
36
        /** @var EdmModelVisitor $this */
37
        $this->startElement($property, __METHOD__);
38
        $this->processVocabularyAnnotatable($property);
39
        $this->processNamedElement($property);
40
        $this->visitTypeReference($property->getType());
0 ignored issues
show
It seems like $property->getType() can also be of type null; however, parameter $reference of AlgoWeb\ODataMetadata\Ed...r::visitTypeReference() does only seem to accept AlgoWeb\ODataMetadata\Interfaces\ITypeReference, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        $this->visitTypeReference(/** @scrutinizer ignore-type */ $property->getType());
Loading history...
41
        $this->endElement($property, __METHOD__);
42
    }
43
44
    protected function processEnumMember(IEnumMember $enumMember): void
45
    {
46
        /** @var EdmModelVisitor $this */
47
        $this->startElement($enumMember, __METHOD__);
48
        $this->processNamedElement($enumMember);
49
        $this->endElement($enumMember, __METHOD__);
50
    }
51
}
52