@@ -195,11 +195,12 @@ private function parseTypes(ArrayIterator $tokens, Context $context, int $parser
195195 );
196196 }
197197
198- if (!in_array ($ parserContext , [
199- self ::PARSER_IN_COMPOUND ,
200- self ::PARSER_IN_ARRAY_EXPRESSION ,
201- self ::PARSER_IN_COLLECTION_EXPRESSION ,
202- ], true )
198+ if (
199+ !in_array ($ parserContext , [
200+ self ::PARSER_IN_COMPOUND ,
201+ self ::PARSER_IN_ARRAY_EXPRESSION ,
202+ self ::PARSER_IN_COLLECTION_EXPRESSION ,
203+ ], true )
203204 ) {
204205 throw new RuntimeException (
205206 'Unexpected type separator '
@@ -209,11 +210,12 @@ private function parseTypes(ArrayIterator $tokens, Context $context, int $parser
209210 $ compoundToken = $ token ;
210211 $ tokens ->next ();
211212 } elseif ($ token === '? ' ) {
212- if (!in_array ($ parserContext , [
213- self ::PARSER_IN_COMPOUND ,
214- self ::PARSER_IN_ARRAY_EXPRESSION ,
215- self ::PARSER_IN_COLLECTION_EXPRESSION ,
216- ], true )
213+ if (
214+ !in_array ($ parserContext , [
215+ self ::PARSER_IN_COMPOUND ,
216+ self ::PARSER_IN_ARRAY_EXPRESSION ,
217+ self ::PARSER_IN_COLLECTION_EXPRESSION ,
218+ ], true )
217219 ) {
218220 throw new RuntimeException (
219221 'Unexpected nullable character '
@@ -258,7 +260,8 @@ private function parseTypes(ArrayIterator $tokens, Context $context, int $parser
258260 }
259261
260262 $ tokens ->next ();
261- } elseif ($ parserContext === self ::PARSER_IN_COLLECTION_EXPRESSION
263+ } elseif (
264+ $ parserContext === self ::PARSER_IN_COLLECTION_EXPRESSION
262265 && ($ token === '> ' || trim ($ token ) === ', ' )
263266 ) {
264267 break ;
@@ -333,8 +336,10 @@ private function resolveSingleType(string $type, Context $context): object
333336 switch (true ) {
334337 case $ this ->isKeyword ($ type ):
335338 return $ this ->resolveKeyword ($ type );
339+
336340 case $ this ->isFqsen ($ type ):
337341 return $ this ->resolveTypedObject ($ type );
342+
338343 case $ this ->isPartialStructuralElementName ($ type ):
339344 return $ this ->resolveTypedObject ($ type , $ context );
340345
@@ -515,8 +520,10 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
515520 $ isIterable = ((string ) $ classType === 'iterable ' );
516521
517522 // allow only "array", "iterable" or class name before "<"
518- if (!$ isArray && !$ isIterable
519- && (!$ classType instanceof Object_ || $ classType ->getFqsen () === null )) {
523+ if (
524+ !$ isArray && !$ isIterable
525+ && (!$ classType instanceof Object_ || $ classType ->getFqsen () === null )
526+ ) {
520527 throw new RuntimeException (
521528 $ classType . ' is not a collection '
522529 );
@@ -534,7 +541,8 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
534541 if ($ isArray ) {
535542 // check the key type for an "array" collection. We allow only
536543 // strings or integers.
537- if (!$ keyType instanceof String_ &&
544+ if (
545+ !$ keyType instanceof String_ &&
538546 !$ keyType instanceof Integer &&
539547 !$ keyType instanceof Compound
540548 ) {
@@ -545,7 +553,8 @@ private function resolveCollection(ArrayIterator $tokens, Type $classType, Conte
545553
546554 if ($ keyType instanceof Compound) {
547555 foreach ($ keyType ->getIterator () as $ item ) {
548- if (!$ item instanceof String_ &&
556+ if (
557+ !$ item instanceof String_ &&
549558 !$ item instanceof Integer
550559 ) {
551560 throw new RuntimeException (
0 commit comments