1 | <?php |
||
18 | final class NodeFactory |
||
19 | { |
||
20 | /** @var InjectorInterface|null */ |
||
21 | private $injector; |
||
22 | |||
23 | /** @var Normalizer */ |
||
24 | private $normalizer; |
||
25 | |||
26 | /** @var FactoryCode */ |
||
27 | private $factoryCompiler; |
||
28 | |||
29 | /** @var PrivateProperty */ |
||
30 | private $privateProperty; |
||
31 | |||
32 | public function __construct( |
||
42 | |||
43 | /** |
||
44 | * Return on-demand dependency pull code for not compiled |
||
45 | * |
||
46 | * @return Expr|Expr\FuncCall |
||
47 | */ |
||
48 | public function getNode(Argument $argument): Expr |
||
67 | |||
68 | /** |
||
69 | * @param SetterMethod[] $setterMethods |
||
70 | * |
||
71 | * @return Expr\MethodCall[] |
||
72 | */ |
||
73 | public function getSetterInjection(Expr\Variable $instance, array $setterMethods): array |
||
92 | |||
93 | public function getPostConstruct(Expr\Variable $instance, string $postConstruct): Expr\MethodCall |
||
97 | |||
98 | /** |
||
99 | * Return default argument value |
||
100 | */ |
||
101 | private function getDefault(Argument $argument): Expr |
||
111 | |||
112 | /** |
||
113 | * Return code for provider |
||
114 | * |
||
115 | * "$provider" needs [class, method, parameter] for InjectionPoint (Contextual Dependency Injection) |
||
116 | * |
||
117 | * @return array<Expr\Array_|Node\Arg> |
||
118 | */ |
||
119 | private function getInjectionProviderParams(Argument $argument) |
||
136 | |||
137 | /** |
||
138 | * Return setter method parameters |
||
139 | * |
||
140 | * Return false when no dependency given and @ Inject(optional=true) annotated to setter method. |
||
141 | * |
||
142 | * @param Argument[] $arguments |
||
143 | * |
||
144 | * @return false|Node\Expr[] |
||
145 | */ |
||
146 | private function getSetterParams(array $arguments, bool $isOptional) |
||
161 | } |
||
162 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.