@@ -63,7 +63,13 @@ private function transformCommonType(Type $type): Type
63
63
64
64
return TypeTraverser::map ($ type , function (Type $ type , callable $ traverse ) {
65
65
if ($ type instanceof TemplateMixedType) {
66
- return $ type ->toStrictMixedType ();
66
+ if (!$ this ->newRuleLevelHelper ) {
67
+ return $ type ->toStrictMixedType ();
68
+ }
69
+
70
+ if ($ this ->checkExplicitMixed ) {
71
+ return $ type ->toStrictMixedType ();
72
+ }
67
73
}
68
74
if (
69
75
$ type instanceof MixedType
@@ -301,22 +307,39 @@ public function findTypeToCheck(
301
307
$ type = TypeCombinator::removeNull ($ type );
302
308
}
303
309
304
- if (
305
- $ this ->checkExplicitMixed
306
- && $ type instanceof MixedType
307
- && !$ type instanceof TemplateMixedType
308
- && $ type ->isExplicitMixed ()
309
- ) {
310
- return new FoundTypeResult (new StrictMixedType (), [], [], null );
311
- }
310
+ if ($ this ->newRuleLevelHelper ) {
311
+ if (
312
+ ($ this ->checkExplicitMixed || $ this ->checkImplicitMixed )
313
+ && $ type instanceof MixedType
314
+ && ($ type ->isExplicitMixed () ? $ this ->checkExplicitMixed : $ this ->checkImplicitMixed )
315
+ ) {
316
+ return new FoundTypeResult (
317
+ $ type instanceof TemplateMixedType
318
+ ? $ type ->toStrictMixedType ()
319
+ : new StrictMixedType (),
320
+ [],
321
+ [],
322
+ null ,
323
+ );
324
+ }
325
+ } else {
326
+ if (
327
+ $ this ->checkExplicitMixed
328
+ && $ type instanceof MixedType
329
+ && !$ type instanceof TemplateMixedType
330
+ && $ type ->isExplicitMixed ()
331
+ ) {
332
+ return new FoundTypeResult (new StrictMixedType (), [], [], null );
333
+ }
312
334
313
- if (
314
- $ this ->checkImplicitMixed
315
- && $ type instanceof MixedType
316
- && !$ type instanceof TemplateMixedType
317
- && !$ type ->isExplicitMixed ()
318
- ) {
319
- return new FoundTypeResult (new StrictMixedType (), [], [], null );
335
+ if (
336
+ $ this ->checkImplicitMixed
337
+ && $ type instanceof MixedType
338
+ && !$ type instanceof TemplateMixedType
339
+ && !$ type ->isExplicitMixed ()
340
+ ) {
341
+ return new FoundTypeResult (new StrictMixedType (), [], [], null );
342
+ }
320
343
}
321
344
322
345
if ($ type instanceof MixedType || $ type instanceof NeverType) {
0 commit comments