@@ -43,16 +43,16 @@ protected function generateValidators(PropertyInterface $property, array $proper
43
43
// @codeCoverageIgnoreEnd
44
44
}
45
45
46
- $ properties = $ this ->getCompositionProperties ($ property , $ propertyData );
47
- $ availableAmount = count ($ properties );
46
+ $ compositionProperties = $ this ->getCompositionProperties ($ property , $ propertyData );
47
+ $ availableAmount = count ($ compositionProperties );
48
48
49
49
$ property ->addValidator (
50
50
new ComposedPropertyValidator (
51
51
$ property ,
52
- $ properties ,
52
+ $ compositionProperties ,
53
53
static ::class,
54
54
[
55
- 'properties ' => $ properties ,
55
+ 'properties ' => $ compositionProperties ,
56
56
'generatorConfiguration ' => $ this ->schemaProcessor ->getGeneratorConfiguration (),
57
57
'viewHelper ' => new RenderHelper ($ this ->schemaProcessor ->getGeneratorConfiguration ()),
58
58
'availableAmount ' => $ availableAmount ,
@@ -63,7 +63,7 @@ protected function generateValidators(PropertyInterface $property, array $proper
63
63
'postPropose ' => $ this instanceof ComposedPropertiesInterface,
64
64
'mergedProperty ' =>
65
65
$ this instanceof MergedComposedPropertiesInterface
66
- ? $ this ->createMergedProperty ($ property , $ properties , $ propertyData )
66
+ ? $ this ->createMergedProperty ($ property , $ compositionProperties , $ propertyData )
67
67
: null ,
68
68
'onlyForDefinedValues ' =>
69
69
$ propertyData ['onlyForDefinedValues ' ] && $ this instanceof ComposedPropertiesInterface,
@@ -86,7 +86,7 @@ protected function generateValidators(PropertyInterface $property, array $proper
86
86
protected function getCompositionProperties (PropertyInterface $ property , array $ propertyData ): array
87
87
{
88
88
$ propertyFactory = new PropertyFactory (new PropertyProcessorFactory ());
89
- $ properties = [];
89
+ $ compositionProperties = [];
90
90
91
91
foreach ($ propertyData ['propertyData ' ][$ propertyData ['type ' ]] as $ compositionElement ) {
92
92
$ compositionProperty = new CompositionPropertyDecorator (
@@ -113,36 +113,39 @@ protected function getCompositionProperties(PropertyInterface $property, array $
113
113
$ property ->addTypeHintDecorator (new CompositionTypeHintDecorator ($ compositionProperty ));
114
114
}
115
115
116
- $ properties [] = $ compositionProperty ;
116
+ $ compositionProperties [] = $ compositionProperty ;
117
117
}
118
118
119
- return $ properties ;
119
+ return $ compositionProperties ;
120
120
}
121
121
122
122
/**
123
123
* TODO: no nested properties --> cancel, only one --> use original model
124
124
*
125
125
* Gather all nested object properties and merge them together into a single merged property
126
126
*
127
- * @param PropertyInterface $compositionProperty
127
+ * @param PropertyInterface $property
128
128
* @param CompositionPropertyDecorator[] $properties
129
129
* @param array $propertyData
130
130
*
131
- * @return PropertyInterface
131
+ * @return PropertyInterface|null
132
132
*
133
133
* @throws SchemaException
134
134
*/
135
135
private function createMergedProperty (
136
- PropertyInterface $ compositionProperty ,
136
+ PropertyInterface $ property ,
137
137
array $ properties ,
138
138
array $ propertyData
139
- ): PropertyInterface {
140
- $ mergedClassName = $ this ->schemaProcessor ->getGeneratorConfiguration ()->getClassNameGenerator ()->getClassName (
141
- $ compositionProperty ->getName (),
142
- $ propertyData ['propertyData ' ],
143
- true ,
144
- $ this ->schemaProcessor ->getCurrentClassName ()
145
- );
139
+ ): ?PropertyInterface {
140
+ $ mergedClassName = $ this ->schemaProcessor
141
+ ->getGeneratorConfiguration ()
142
+ ->getClassNameGenerator ()
143
+ ->getClassName (
144
+ $ property ->getName (),
145
+ $ propertyData ['propertyData ' ],
146
+ true ,
147
+ $ this ->schemaProcessor ->getCurrentClassName ()
148
+ );
146
149
147
150
// check if the merged property already has been generated
148
151
if (isset (self ::$ generatedMergedProperties [$ mergedClassName ])) {
@@ -161,7 +164,7 @@ private function createMergedProperty(
161
164
$ mergedPropertySchema
162
165
);
163
166
164
- $ compositionProperty ->addTypeHintDecorator (new CompositionTypeHintDecorator ($ mergedProperty ));
167
+ $ property ->addTypeHintDecorator (new CompositionTypeHintDecorator ($ mergedProperty ));
165
168
166
169
return $ mergedProperty
167
170
->addDecorator (
0 commit comments