diff --git a/src/Framework/MockObject/MockBuilder.php b/src/Framework/MockObject/MockBuilder.php index 22e927d5251..e6ddcba09d2 100644 --- a/src/Framework/MockObject/MockBuilder.php +++ b/src/Framework/MockObject/MockBuilder.php @@ -12,7 +12,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; @@ -119,44 +118,6 @@ public function getMock(): MockObject return $object; } - /** - * Creates a mock object for a trait using a fluent interface. - * - * @psalm-return MockObject&MockedType - * - * @throws Exception - * @throws ReflectionException - * @throws RuntimeException - * - * @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. *