@@ -83,34 +83,36 @@ public static function fromDefinition(array $definition, ?string $name = null):
83
83
84
84
foreach ($ definition as $ definitionKey => $ definitionValue ) {
85
85
switch ($ definitionKey ) {
86
- case 'properties ' :
87
- foreach ($ definitionValue as $ propertyName => $ propertyDefinition ) {
88
- if (isset ($ propertyDefinition ['type ' ])) {
89
- $ self ->properties [$ propertyName ] = Type::fromDefinition ($ propertyDefinition , $ propertyName );
90
- } elseif (isset ($ propertyDefinition ['$ref ' ])) {
91
- $ ref = ReferenceType::fromDefinition ($ propertyDefinition , '' );
92
-
93
- if ($ resolvedType = $ resolveReference ($ propertyDefinition ['$ref ' ])) {
94
- $ ref ->setResolvedType ($ resolvedType );
95
- }
96
-
97
- $ self ->properties [$ propertyName ] = new TypeSet ($ ref );
86
+ case 'properties ' :
87
+ foreach ($ definitionValue as $ propertyName => $ propertyDefinition ) {
88
+ if (isset ($ propertyDefinition ['$ref ' ])) {
89
+ $ ref = ReferenceType::fromDefinition ($ propertyDefinition , '' );
90
+
91
+ if ($ resolvedType = $ resolveReference ($ propertyDefinition ['$ref ' ])) {
92
+ $ ref ->setResolvedType ($ resolvedType );
98
93
}
94
+ $ self ->properties [$ propertyName ] = new TypeSet ($ ref );
95
+ } else {
96
+ $ self ->properties [$ propertyName ] = Type::fromDefinition (
97
+ $ propertyDefinition ,
98
+ $ propertyName
99
+ );
99
100
}
100
- break ;
101
- case 'additionalProperties ' :
102
- $ self ->additionalProperties = \is_array ($ definitionValue )
103
- ? Type::fromDefinition ($ definitionValue , '' )
104
- : $ definitionValue ;
105
- break ;
106
- case 'definitions ' :
107
- // handled beforehand
108
- break ;
109
- default :
110
- if (\property_exists ($ self , $ definitionKey )) {
111
- $ self ->$ definitionKey = $ definitionValue ;
112
- }
113
- break ;
101
+ }
102
+ break ;
103
+ case 'additionalProperties ' :
104
+ $ self ->additionalProperties = \is_array ($ definitionValue )
105
+ ? Type::fromDefinition ($ definitionValue , '' )
106
+ : $ definitionValue ;
107
+ break ;
108
+ case 'definitions ' :
109
+ // handled beforehand
110
+ break ;
111
+ default :
112
+ if (\property_exists ($ self , $ definitionKey )) {
113
+ $ self ->$ definitionKey = $ definitionValue ;
114
+ }
115
+ break ;
114
116
}
115
117
}
116
118
0 commit comments