Skip to content

Commit 8606348

Browse files
authored
Merge branch refs/heads/1.12.x into 2.0.x
2 parents 0210d45 + e2654b7 commit 8606348

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

Diff for: src/Rules/MissingTypehintCheck.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ public function getIterableTypesWithMissingValueTypehint(Type $type): array
7676
if ($iterableValue instanceof MixedType && !$iterableValue->isExplicitMixed()) {
7777
$iterablesWithMissingValueTypehint[] = $type;
7878
}
79-
if ($type instanceof IntersectionType && !$type->isList()->yes()) {
79+
if ($type instanceof IntersectionType) {
80+
if ($type->isList()->yes()) {
81+
return $traverse($type->getIterableValueType());
82+
}
83+
8084
return $type;
8185
}
8286
}

Diff for: tests/PHPStan/Rules/PhpDoc/FunctionAssertRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ public function testRule(): void
6969
'Asserted negated type string for $i with type int does not narrow down the type.',
7070
70,
7171
],
72+
[
73+
'PHPDoc tag @phpstan-assert for $array has no value type specified in iterable type array<int, mixed>.',
74+
88,
75+
'See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type',
76+
],
7277
]);
7378
}
7479

Diff for: tests/PHPStan/Rules/PhpDoc/data/function-assert.php

+15
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,18 @@ function negate1(int $i): void
7676
function negate2(int $i): void
7777
{
7878
}
79+
80+
/**
81+
* @param array<mixed> $array
82+
* @param string $message
83+
*
84+
* @phpstan-impure
85+
*
86+
* @psalm-assert list $array
87+
*/
88+
function isList($array, $message = ''): void
89+
{
90+
if (!array_is_list($array)) {
91+
92+
}
93+
}

0 commit comments

Comments
 (0)