NullableParameterResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Habemus\Autowiring\Parameter;
5
6
use ReflectionParameter;
7
8
class NullableParameterResolver implements ParameterResolver
9
{
10
    /**
11
     * @inheritDoc
12
     */
13
    public function resolve(ReflectionParameter $parameter, array $arguments, array &$result): bool
14
    {
15
        if (!$parameter->isOptional() && $parameter->allowsNull()) {
16
            $result[] = null;
17
            return true;
18
        }
19
20
        return false;
21
    }
22
}
23