@@ -112,14 +112,14 @@ private function getValidTypes(string $content): string
112112 while ('' !== $ content && false !== $ content ) {
113113 preg_match ('{^ ' .SniffHelper::REGEX_TYPES .'$}ix ' , $ content , $ matches );
114114
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 ' ]) {
118116 $ validType = '( ' .$ this ->getValidTypes ($ matches ['mutipleContent ' ]).') ' ;
119- } elseif (isset ($ matches ['generic ' ]) && '' !== $ matches ['generic ' ]) {
120- $ validType = $ this ->getValidGenericType ($ matches ['genericName ' ], $ matches ['genericContent ' ]);
121117 } elseif (isset ($ matches ['object ' ]) && '' !== $ matches ['object ' ]) {
122118 $ 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 )).'[] ' ;
123123 } else {
124124 $ validType = $ this ->getValidType ($ matches ['type ' ]);
125125 }
@@ -203,11 +203,13 @@ private function getValidObjectType(string $objectContent): string
203203 $ validType = 'array{ ' ;
204204
205205 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 );
207208
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+ }
211213 }
212214
213215 preg_match ('{^ ' .SniffHelper::REGEX_TYPES .',?}ix ' , $ objectContent , $ matches );
0 commit comments