@@ -83,34 +83,36 @@ public static function fromDefinition(array $definition, ?string $name = null):
8383
8484 foreach ($ definition as $ definitionKey => $ definitionValue ) {
8585 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 );
9893 }
94+ $ self ->properties [$ propertyName ] = new TypeSet ($ ref );
95+ } else {
96+ $ self ->properties [$ propertyName ] = Type::fromDefinition (
97+ $ propertyDefinition ,
98+ $ propertyName
99+ );
99100 }
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 ;
114116 }
115117 }
116118
0 commit comments