ValidEnumElement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zlikavac32\SymfonyEnum\Validator\Constraints;
6
7
/**
8
 * @Annotation
9
 * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
10
 */
11
class ValidEnumElement extends AbstractEnumConstraint
12
{
13
    public function __construct($options = null)
14
    {
15
        parent::__construct(
16
            function (): array {
17
                return $this->enumClass::values();
0 ignored issues
show
Bug introduced by
The method values() does not exist on null. ( Ignorable by Annotation )

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

17
                return $this->enumClass::/** @scrutinizer ignore-call */ values();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
            },
19
            $options
20
        );
21
    }
22
}
23