Run Rector on your code to see what it can do for you:

     public function test()
     {
         self::any();
-        self::never();
-        self::atLeast();
-        self::atLeastOnce();
-        self::once();
+        $this->never();
+        $this->atLeast();
+        $this->atLeastOnce();
+        $this->once();
         self::exactly();
         self::atMost();
         self::throwException();
         self::getActualOutputForAssertion();
         self::expectOutputRegex();
         self::expectOutputString();
-        self::expectException();
-        self::expectExceptionCode();
-        self::expectExceptionMessage();
-        self::expectExceptionMessageMatches();
+        $this->expectException();
+        $this->expectExceptionCode();
+        $this->expectExceptionMessage();
+        $this->expectExceptionMessageMatches();
         self::expectExceptionObject();
         self::expectNotToPerformAssertions();
         self::getMockBuilder();
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: ea5089 - released at 2026-01-27 00:48