diff --git a/rules/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector.php b/rules/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector.php deleted file mode 100644 index ec8559ed..00000000 --- a/rules/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector.php +++ /dev/null @@ -1,102 +0,0 @@ -someServiceMock = $this->createMock(SomeService::class); - } - - public function testOne(): void - { - // use $this->someServiceMock - } - - public function testTwo(): void - { - // use $this->someServiceMock - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -use PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations; - -#[AllowMockObjectsWithoutExpectations] -final class SomeTest extends TestCase -{ - private \PHPUnit\Framework\MockObject\MockObject $someServiceMock; - - protected function setUp(): void - { - $this->someServiceMock = $this->createMock(SomeService::class); - } - - public function testOne(): void - { - $this->someServiceMock->expects($this->once()) - ->method('someMethod') - ->willReturn('someValue'); - } - - public function testTwo(): void - { - $this->someServiceMock->expects($this->once()) - ->method('someMethod') - ->willReturn('anotherValue'); - } -} -CODE_SAMPLE - ), - ] - ); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [Class_::class]; - } - - /** - * @param Class_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" is deprecated, as the attribute only silences the notice. Add the missing expects() to the test methods that use the mock instead.', - self::class, - )); - } -}