Passed
Push — 1.x ( 44281e...e2dae5 )
by Kevin
02:12
created

UntypedParameter::type()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Zenstruck\Callback\Parameter;
4
5
use Zenstruck\Callback\Exception\UnresolveableArgument;
6
use Zenstruck\Callback\Parameter;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
final class UntypedParameter extends Parameter
12
{
13
    private $value;
14
15
    public function __construct($value)
16
    {
17
        $this->value = $value;
18
    }
19
20
    public function type(): string
21
    {
22
        return 'mixed';
23
    }
24
25
    protected function valueFor(\ReflectionParameter $parameter)
26
    {
27
        if ($parameter->getType()) {
28
            throw new UnresolveableArgument('Argument has type.');
29
        }
30
31
        return $this->value;
32
    }
33
}
34