Skip to content

Deprecate ReplaceTestFunctionPrefixWithAttributeRector - #739

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-replace-test-function-prefix
Jul 31, 2026
Merged

Deprecate ReplaceTestFunctionPrefixWithAttributeRector#739
TomasVotruba merged 1 commit into
mainfrom
deprecate-replace-test-function-prefix

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

ReplaceTestFunctionPrefixWithAttributeRector is not a common upgrade path and is not part of any set. Users should only use sets, so a rule that is only reachable by manual registration is better implemented as a local custom rule.

Rule turns test-prefixed methods into #[Test] attributed ones:

 class SomeTest extends \PHPUnit\Framework\TestCase
 {
-    public function testOnePlusOneShouldBeTwo()
+    #[Test]
+    public function onePlusOneShouldBeTwo()
     {
         $this->assertSame(2, 1+1);
     }
 }

This is a project-specific naming preference, not an upgrade. Deprecated the same way as other deprecated rules here: DeprecatedInterface + refactor() throwing ShouldNotHappenException, tests removed.

@TomasVotruba
TomasVotruba merged commit e1bfd76 into main Jul 31, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-replace-test-function-prefix branch July 31, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant