1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of Railt package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace Railt\Reflection\Invocation\Dependent; |
11
|
|
|
|
12
|
|
|
use Railt\Reflection\Contracts\Definition\Behaviour\ProvidesArguments; |
13
|
|
|
use Railt\Reflection\Contracts\Definition\TypeDefinition; |
14
|
|
|
use Railt\Reflection\Contracts\Invocation\Dependent\ArgumentInvocation as ArgumentInvocationInterface; |
15
|
|
|
use Railt\Reflection\Contracts\Invocation\TypeInvocation; |
16
|
|
|
use Railt\Reflection\Contracts\Type; |
17
|
|
|
use Railt\Reflection\Definition\Dependent\ArgumentDefinition; |
18
|
|
|
use Railt\Reflection\Document; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class ArgumentInvocation |
22
|
|
|
*/ |
23
|
|
|
class ArgumentInvocation extends AbstractDependentTypeInvocation implements ArgumentInvocationInterface |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @var mixed |
27
|
|
|
*/ |
28
|
|
|
protected $value; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* ArgumentInvocation constructor. |
32
|
|
|
* @param TypeInvocation $parent |
33
|
|
|
* @param Document $document |
34
|
|
|
* @param string $name |
35
|
|
|
* @param mixed $value |
36
|
|
|
*/ |
37
|
|
|
public function __construct(TypeInvocation $parent, Document $document, string $name, $value) |
|
|
|
|
38
|
|
|
{ |
39
|
|
|
parent::__construct($parent, $document, $name); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return Type |
44
|
|
|
*/ |
45
|
|
|
public static function getType(): Type |
46
|
|
|
{ |
47
|
|
|
return ArgumentDefinition::getType(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return mixed |
52
|
|
|
*/ |
53
|
|
|
public function getValue() |
54
|
|
|
{ |
55
|
|
|
return $this->value; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return TypeDefinition |
60
|
|
|
*/ |
61
|
|
|
public function getTypeDefinition(): TypeDefinition |
62
|
|
|
{ |
63
|
|
|
/** @var ProvidesArguments $parent */ |
64
|
|
|
$parent = $this->getParent()->getTypeDefinition(); |
|
|
|
|
65
|
|
|
|
66
|
|
|
\assert($parent instanceof ProvidesArguments); |
67
|
|
|
|
68
|
|
|
return $parent->getArgumentDefinition($this->name); |
|
|
|
|
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.