1 | <?php |
||||
2 | |||||
3 | namespace evelikto\di\resolver; |
||||
4 | |||||
5 | /** Resolves parameter using its name */ |
||||
6 | trait NameResolver |
||||
7 | { |
||||
8 | /** |
||||
9 | * Tries to resolve parameter by its name from previously resolved dependencies. |
||||
10 | * |
||||
11 | * @param \ReflectionParameter $param Parameter to be resolved. |
||||
12 | * @return mixed|null Resolved value or null. |
||||
13 | */ |
||||
14 | protected function resolveStoredByName(\ReflectionParameter $param) { |
||||
15 | return $this->read($param->getName()); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
16 | } |
||||
17 | |||||
18 | /** |
||||
19 | * Tries to resolve parameter by its name from factory method with the same name. |
||||
20 | * |
||||
21 | * @param \ReflectionParameter $param Parameter to be resolved. |
||||
22 | * @return mixed|null Resolved value or null. |
||||
23 | */ |
||||
24 | protected function resolveMethodByName(\ReflectionParameter $param) { |
||||
25 | return $this->fromMethod($param->getName()); |
||||
0 ignored issues
–
show
It seems like
fromMethod() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
26 | } |
||||
27 | } |