From b71ab34bf6867c74c9e70a34ed4c3a5c36dbeea2 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Wed, 7 Feb 2024 15:22:28 +0100 Subject: [PATCH] Closes #5313 --- src/Framework/MockObject/MockBuilder.php | 39 ------------------------ 1 file changed, 39 deletions(-) diff --git a/src/Framework/MockObject/MockBuilder.php b/src/Framework/MockObject/MockBuilder.php index a84a3bc4ae7..b41acd703d9 100644 --- a/src/Framework/MockObject/MockBuilder.php +++ b/src/Framework/MockObject/MockBuilder.php @@ -13,7 +13,6 @@ use function array_merge; use function assert; use function debug_backtrace; -use function trait_exists; use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Framework\Exception; use PHPUnit\Framework\InvalidArgumentException; @@ -123,44 +122,6 @@ public function getMock(): MockObject return $object; } - /** - * Creates a mock object for a trait using a fluent interface. - * - * @throws Exception - * @throws ReflectionException - * @throws RuntimeException - * - * @return MockedType&MockObject - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5306 - */ - public function getMockForTrait(): MockObject - { - EventFacade::emitter()->testTriggeredPhpunitDeprecation( - $this->testCase->valueObjectForEvents(), - 'MockBuilder::getMockForTrait() is deprecated and will be removed in PHPUnit 12 without replacement.', - ); - - assert(trait_exists($this->type)); - - $object = $this->generator->mockObjectForTrait( - $this->type, - $this->constructorArgs, - $this->mockClassName ?? '', - $this->originalConstructor, - $this->originalClone, - $this->autoload, - $this->methods, - $this->cloneArguments, - ); - - assert($object instanceof MockObject); - - $this->testCase->registerMockObject($object); - - return $object; - } - /** * Specifies the subset of methods to mock, requiring each to exist in the class. *