Skip to content

Commit 5ad91b0

Browse files
committed
fix
1 parent cebf288 commit 5ad91b0

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/Type/IntersectionType.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,13 @@ public function getIterableValueType(): Type
802802
{
803803
$result = $this->intersectTypes(static fn (Type $type): Type => $type->getIterableValueType());
804804
if ($this->isCallable()->yes() && $this->isArray()->yes()) {
805-
return TypeCombinator::intersect($result, new UnionType([new ObjectWithoutClassType(), new StringType()]));
805+
return TypeCombinator::intersect(
806+
$result,
807+
new UnionType([
808+
new ObjectWithoutClassType(),
809+
new IntersectionType([new StringType(), new AccessoryNonEmptyStringType()]),
810+
])
811+
);
806812
}
807813
return $result;
808814
}

tests/PHPStan/Rules/Methods/MissingMethodParameterTypehintRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function testBug14549(): void
152152
{
153153
$this->analyse([__DIR__ . '/data/bug-14549.php'], [
154154
[
155-
'Method Bug14549\MondayMorning::call() has parameter $task with no signature specified for callable.',
155+
'Method Bug14549\Foo::doFoo() has parameter $task with no signature specified for callable.',
156156
12,
157157
],
158158
]);

tests/PHPStan/Rules/Methods/data/bug-14549.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function doFoo(array $task): void
1313
{
1414
foreach($task as $k => $v) {
1515
assertType('0|1', $k);
16-
assertType('object|string', $v);
16+
assertType('object|non-empty-string', $v);
1717
}
1818
assertType('class-string|object', $task[0]);
1919
assertType('string', $task[1]);
@@ -34,7 +34,7 @@ public function doBar(array $list): void
3434

3535
foreach($list as $k => $v) {
3636
assertType('0|1', $k);
37-
assertType('string', $v);
37+
assertType('non-empty-string', $v);
3838
}
3939
}
4040
}

0 commit comments

Comments
 (0)