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

 <?php
 
 class Demo
 {
-    public static function getOptions()
+    /**
+     * @return mixed[]
+     */
+    public static function getOptions(): array
     {
-        function sortByOrder(array $a, array $b): int
-        {
-            return strcmp((string) $a['label'], (string) $b['label']);
-        }
-
         $options = [
             ['value' => 'b', 'label' => 'Bravo'],
             ['value' => 'a', 'label' => 'Alpha'],
PHP snippet to change
Config  rector.php
Rector version: d1a635 - released at 2026-07-08 23:03