Skip to content

Commit 6347450

Browse files
committed
do not skip generic iterables for MissingTypehintCheck on bleeding edge
# Conflicts: # conf/bleedingEdge.neon # conf/config.neon # conf/parametersSchema.neon
1 parent e32909a commit 6347450

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

conf/bleedingEdge.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

conf/config.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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:

conf/parametersSchema.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
])

src/Rules/MissingTypehintCheck.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)