1 | <?php |
||
22 | class ArrayDefinition extends AbstractDefinition implements NodeDefinitionContainerInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var NodeDefinitionInterface[] |
||
26 | */ |
||
27 | protected $children = array(); |
||
28 | |||
29 | /** |
||
30 | * @var NodeDefinitionInterface |
||
31 | */ |
||
32 | protected $prototype; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $nullEquivalent = array(); |
||
38 | |||
39 | /** |
||
40 | * @var NodeDefinitionBuilder|null |
||
41 | */ |
||
42 | protected $nodeBuilder; |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function setBuilder(NodeDefinitionBuilder $builder) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function append(NodeDefinitionInterface $node) |
||
69 | |||
70 | /** |
||
71 | * Chain children to builder. |
||
72 | * |
||
73 | * @return NodeDefinitionBuilder |
||
74 | */ |
||
75 | public function children() |
||
79 | |||
80 | /** |
||
81 | * Set array as prototype (numeric array) with definition type of children. |
||
82 | * |
||
83 | * @param string $type |
||
84 | * |
||
85 | * @return NodeDefinitionInterface |
||
86 | */ |
||
87 | public function prototype($type) |
||
91 | |||
92 | /** |
||
93 | * Get node definition builder. |
||
94 | * |
||
95 | * @return NodeDefinitionBuilder |
||
96 | */ |
||
97 | protected function getNodeBuilder() |
||
105 | |||
106 | /** |
||
107 | * Create and configure node by definition. |
||
108 | * |
||
109 | * @return NodeInterface |
||
110 | */ |
||
111 | protected function createNode() |
||
126 | |||
127 | /** |
||
128 | * Create array node. |
||
129 | * |
||
130 | * @return ArrayNode |
||
131 | */ |
||
132 | private function instantiateArrayNode() |
||
143 | |||
144 | /** |
||
145 | * Create prototype array node. |
||
146 | * |
||
147 | * @return PrototypeArrayNode |
||
148 | */ |
||
149 | private function instantiatePrototypeArrayNode() |
||
162 | } |
||
163 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.