Skip to content

Commit a0c7d96

Browse files
committed
Update MethodExistsTypeSpecifyingExtension.php
1 parent 1b2bc46 commit a0c7d96

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Type/Php/MethodExistsTypeSpecifyingExtension.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use PHPStan\Type\FunctionTypeSpecifyingExtension;
1818
use PHPStan\Type\IntersectionType;
1919
use PHPStan\Type\ObjectWithoutClassType;
20+
use PHPStan\Type\TypeCombinator;
2021
use PHPStan\Type\UnionType;
2122
use function count;
2223

@@ -67,10 +68,10 @@ public function specifyTypes(
6768
foreach ($methodNameTypes as $methodNameType) {
6869
$specifiedTypes = $specifiedTypes->unionWith($this->typeSpecifier->create(
6970
$node->getArgs()[0]->value,
70-
new IntersectionType([
71+
TypeCombinator::intersect(
7172
$objectType,
7273
new HasMethodType($methodNameType->getValue()),
73-
]),
74+
),
7475
$context,
7576
$scope,
7677
));
@@ -83,13 +84,13 @@ public function specifyTypes(
8384
foreach ($methodNameTypes as $methodNameType) {
8485
$specifiedTypes = $specifiedTypes->unionWith($this->typeSpecifier->create(
8586
$node->getArgs()[0]->value,
86-
new UnionType([
87-
new IntersectionType([
87+
TypeCombinator::union(
88+
TypeCombinator::intersect(
8889
new ObjectWithoutClassType(),
8990
new HasMethodType($methodNameType->getValue()),
90-
]),
91+
),
9192
new ClassStringType(),
92-
]),
93+
),
9394
$context,
9495
$scope,
9596
));

0 commit comments

Comments
 (0)