File tree Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -10,5 +10,6 @@ parameters:
1010 internalTag : true
1111 newStaticInAbstractClassStaticMethod : true
1212 checkExtensionsForComparisonOperators : true
13+ checkGenericIterableClasses : true
1314 reportTooWideBool : true
1415 rawMessageInBaseline : true
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ parameters:
3434 internalTag : false
3535 newStaticInAbstractClassStaticMethod : false
3636 checkExtensionsForComparisonOperators : false
37+ checkGenericIterableClasses : false
3738 reportTooWideBool : false
3839 rawMessageInBaseline : false
3940 fileExtensions :
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ parametersSchema:
3737 internalTag : bool ()
3838 newStaticInAbstractClassStaticMethod : bool ()
3939 checkExtensionsForComparisonOperators : bool ()
40+ checkGenericIterableClasses : bool ()
4041 reportTooWideBool : bool ()
4142 rawMessageInBaseline : bool ()
4243 ])
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ final class MissingTypehintCheck
4343 Traversable::class,
4444 Iterator::class,
4545 IteratorAggregate::class,
46- // Generator::class,
46+ Generator::class,
4747 ];
4848
4949 /**
@@ -54,6 +54,8 @@ public function __construct(
5454 private bool $ checkMissingCallableSignature ,
5555 #[AutowiredParameter(ref: '%featureToggles.skipCheckGenericClasses% ' )]
5656 private array $ skipCheckGenericClasses ,
57+ #[AutowiredParameter(ref: '%featureToggles.checkGenericIterableClasses% ' )]
58+ private bool $ checkGenericIterableClasses ,
5759 )
5860 {
5961 }
@@ -118,7 +120,10 @@ public function getNonGenericObjectTypesWithGenericClass(Type $type): array
118120 if ($ classReflection === null ) {
119121 return $ type ;
120122 }
121- if (in_array ($ classReflection ->getName (), self ::ITERABLE_GENERIC_CLASS_NAMES , true )) {
123+ if (
124+ $ this ->checkGenericIterableClasses !== true &&
125+ in_array ($ classReflection ->getName (), self ::ITERABLE_GENERIC_CLASS_NAMES , true )
126+ ) {
122127 // checked by getIterableTypesWithMissingValueTypehint() already
123128 return $ type ;
124129 }
You can’t perform that action at this time.
0 commit comments