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

 class Test1 extends Super
 {
     # err: should NOT change to Super::
-    public function testClass(string $dir = self::SORT_ORDER_ASC)
+    public function testClass(string $dir = \Super::SORT_ORDER_ASC)
     {
         # err: should NOT change to Super::
-        $this->replaceClass(self::SORT_ORDER_ASC);
+        $this->replaceClass(\Super::SORT_ORDER_ASC);
     }
 
     # okay
 class Test2 extends Super
 {
     # err: should change to self::
-    public function testClass(string $dir = 'asc')
+    public function testClass(string $dir = \Super::SORT_ORDER_ASC)
     {
         # err: should change to self::
-        $this->replaceClass('asc');
+        $this->replaceClass(\Super::SORT_ORDER_ASC);
     }
 
     # okay
-    public function testSelf(string $dir = 'asc')
+    public function testSelf(string $dir = self::SORT_ORDER_ASC)
     {
         # okay
-        $this->replaceSelf('asc');
+        $this->replaceSelf(self::SORT_ORDER_ASC);
     }
 
 }
 class Test3 extends Super
 {
     # err: should change to self::
-    public function testClass(string $dir = Super::SORT_ORDER_ASC)
+    public function testClass(string $dir = \Super::SORT_ORDER_ASC)
     {
         # err: should change to self::
-        $this->replaceClass(Super::SORT_ORDER_ASC);
+        $this->replaceClass(\Super::SORT_ORDER_ASC);
     }
     
     # okay
-    public function testSelf(string $dir = Super::SORT_ORDER_ASC)
+    public function testSelf(string $dir = self::SORT_ORDER_ASC)
     {
         # okay
-        $this->replaceSelf(Super::SORT_ORDER_ASC);
+        $this->replaceSelf(self::SORT_ORDER_ASC);
     }
 }
 
     {
         # okay
         $test = new Test3();
-        $test->replaceClass('asc');
+        $test->replaceClass(\Super::SORT_ORDER_ASC);
     }
 
     public function testSelf(string $dir = 'asc')
     {
         # err: class Test4 has no constant SORT_ORDER_ASC
         $test = new Test3();
-        $test->replaceSelf('asc');
+        $test->replaceSelf(self::SORT_ORDER_ASC);
     }
 }
PHP snippet to change
Config  rector.php
Rector version: 2.4.2 - released at 2026-04-16 14:00