Skip to content

Commit 973d8fc

Browse files
committed
Stub EntityRepository in the autocomplete test for lowest-deps Prophecy
The lowest version of Doctrine ORM exposes at least one inherited EntityRepository method whose signature contains an intersection type. Prophecy's class mirror refuses to double such classes ("Doubling intersection types is not supported"), so the unit-tests matrix was red on every lowest job. Swap the prophesized EntityRepository for a no-op anonymous-class subclass — the closure under test never reads the repository argument anyway, so all we need is an instance of the correct type to satisfy the signature. Bypassing the parent constructor leaves the readonly properties uninitialized but, again, nothing in the test path touches them.
1 parent cf3db1d commit 973d8fc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/Form/Type/ProductVariantAutocompleteTypeTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,15 @@ public function the_resolved_filter_query_scopes_the_query_builder_to_the_suppli
9494
->willReturn($qbReveal)
9595
;
9696

97-
$repository = $this->prophesize(EntityRepository::class)->reveal();
97+
// Prophecy's class mirror chokes on intersection types reached through Doctrine's lowest
98+
// EntityRepository ancestors, so we hand-roll a no-op subclass. The closure never reads the
99+
// repository argument — it just needs an instance of the right type to satisfy the call.
100+
$repository = new class() extends EntityRepository {
101+
/** @phpstan-ignore constructor.missingParentCall (intentional — see comment above) */
102+
public function __construct()
103+
{
104+
}
105+
};
98106

99107
$filterQuery($qbReveal, 'any-search-query', $repository);
100108
}

0 commit comments

Comments
 (0)