|
12 | 12 | use PHPStan\Type\ObjectType;
|
13 | 13 | use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
|
14 | 14 | use PHPUnit\Framework\MockObject\MockObject;
|
| 15 | +use PHPUnit\Framework\MockObject\Stub; |
15 | 16 | use function array_filter;
|
16 | 17 | use function count;
|
17 | 18 | use function implode;
|
@@ -52,11 +53,14 @@ public function processNode(Node $node, Scope $scope): array
|
52 | 53 |
|
53 | 54 | if (
|
54 | 55 | $type instanceof IntersectionType
|
55 | | - && in_array(MockObject::class, $type->getReferencedClasses(), true) |
| 56 | + && ( |
| 57 | + in_array(MockObject::class, $type->getReferencedClasses(), true) |
| 58 | + || in_array(Stub::class, $type->getReferencedClasses(), true) |
| 59 | + ) |
56 | 60 | && !$type->hasMethod($method)->yes()
|
57 | 61 | ) {
|
58 | 62 | $mockClass = array_filter($type->getReferencedClasses(), static function (string $class): bool {
|
59 | | - return $class !== MockObject::class; |
| 63 | + return $class !== MockObject::class && $class !== Stub::class; |
60 | 64 | });
|
61 | 65 |
|
62 | 66 | return [
|
|
0 commit comments