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 @@ -9,3 +9,4 @@ parameters:
99 internalTag : true
1010 newStaticInAbstractClassStaticMethod : true
1111 checkExtensionsForComparisonOperators : true
12+ checkGenericIterableClasses : true
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ parameters:
3333 internalTag : false
3434 newStaticInAbstractClassStaticMethod : false
3535 checkExtensionsForComparisonOperators : false
36+ checkGenericIterableClasses : false
3637 fileExtensions :
3738 - php
3839 checkAdvancedIsset : false
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ parametersSchema:
3636 internalTag : bool ()
3737 newStaticInAbstractClassStaticMethod : bool ()
3838 checkExtensionsForComparisonOperators : bool ()
39+ checkGenericIterableClasses : bool ()
3940 ])
4041 fileExtensions : listOf (string ())
4142 checkAdvancedIsset : bool ()
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