@@ -112,14 +112,14 @@ private function getValidTypes(string $content): string
112
112
while ('' !== $ content && false !== $ content ) {
113
113
preg_match ('{^ ' .SniffHelper::REGEX_TYPES .'$}ix ' , $ content , $ matches );
114
114
115
- if (isset ($ matches ['array ' ]) && '' !== $ matches ['array ' ]) {
116
- $ validType = $ this ->getValidTypes (mb_substr ($ matches ['array ' ], 0 , -2 )).'[] ' ;
117
- } elseif (isset ($ matches ['multiple ' ]) && '' !== $ matches ['multiple ' ]) {
115
+ if (isset ($ matches ['multiple ' ]) && '' !== $ matches ['multiple ' ]) {
118
116
$ validType = '( ' .$ this ->getValidTypes ($ matches ['mutipleContent ' ]).') ' ;
119
- } elseif (isset ($ matches ['generic ' ]) && '' !== $ matches ['generic ' ]) {
120
- $ validType = $ this ->getValidGenericType ($ matches ['genericName ' ], $ matches ['genericContent ' ]);
121
117
} elseif (isset ($ matches ['object ' ]) && '' !== $ matches ['object ' ]) {
122
118
$ validType = $ this ->getValidObjectType ($ matches ['objectContent ' ]);
119
+ } elseif (isset ($ matches ['generic ' ]) && '' !== $ matches ['generic ' ]) {
120
+ $ validType = $ this ->getValidGenericType ($ matches ['genericName ' ], $ matches ['genericContent ' ]);
121
+ } elseif (isset ($ matches ['array ' ]) && '' !== $ matches ['array ' ]) {
122
+ $ validType = $ this ->getValidTypes (mb_substr ($ matches ['array ' ], 0 , -2 )).'[] ' ;
123
123
} else {
124
124
$ validType = $ this ->getValidType ($ matches ['type ' ]);
125
125
}
@@ -203,11 +203,13 @@ private function getValidObjectType(string $objectContent): string
203
203
$ validType = 'array{ ' ;
204
204
205
205
while ('' !== $ objectContent && false !== $ objectContent ) {
206
- $ split = preg_split ('/(\??:|,)/ ' , $ objectContent , 2 , PREG_SPLIT_DELIM_CAPTURE );
206
+ if (0 !== mb_strpos ($ objectContent , 'array{ ' ) && 0 !== mb_strpos ($ objectContent , 'array< ' )) {
207
+ $ split = preg_split ('/(\??:|,)/ ' , $ objectContent , 2 , PREG_SPLIT_DELIM_CAPTURE );
207
208
208
- if (isset ($ split [1 ]) && ', ' !== $ split [1 ]) {
209
- $ validType .= $ split [0 ].$ split [1 ].' ' ;
210
- $ objectContent = $ split [2 ];
209
+ if (isset ($ split [1 ]) && ', ' !== $ split [1 ]) {
210
+ $ validType .= $ split [0 ].$ split [1 ].' ' ;
211
+ $ objectContent = $ split [2 ];
212
+ }
211
213
}
212
214
213
215
preg_match ('{^ ' .SniffHelper::REGEX_TYPES .',?}ix ' , $ objectContent , $ matches );
0 commit comments