Copy the migrator.php file to the root of your project and run the following command:
for file in **/*.php; do php ./migrator.php "$file"; doneBACK UP YOUR REPOSITORY BEFORE RUNNING THIS SCRIPT!
Copy the migrator.php file to the root of your project and run the following command:
for file in **/*.php; do php ./migrator.php "$file"; doneBACK UP YOUR REPOSITORY BEFORE RUNNING THIS SCRIPT!
| --TEST-- | |
| Named arguments in varargs. | |
| --FILE-- | |
| <?php | |
| function dump(...$values): void { | |
| var_dump($values); | |
| } | |
| $p = dump('Foo', ?, bar: 'Bar'); |
| <?php | |
| class Sum { | |
| // Can be modified | |
| public initonly int $lhs; | |
| public initonly int $rhs; | |
| // Should be computed | |
| public initonly int $sum; |
| <?php | |
| class Point { | |
| public function __construct( | |
| public initonly int $x, | |
| public initonly int $y, | |
| ) {} | |
| public function __clone() { | |
| // What to set x/y to? |
| <?php | |
| class Sum { | |
| public initonly int $sum; | |
| public function __construct( | |
| public initonly int $lhs, | |
| public initonly int $rhs, | |
| ) { | |
| $this->sum = $this->lhs + $this->rhs; |
| // Literal pattern | |
| $foo is 1; | |
| $foo is 'foo'; | |
| $foo is SOME_CONST; // Ambiguous with class names :( | |
| // Binding pattern | |
| $foo is $bar; | |
| // Type pattern | |
| $foo is Foo; |
| <?php | |
| match ($foo) { | |
| is int => ..., | |
| is string|float => ..., | |
| is Foo => ..., | |
| is array => ..., | |
| }; |
| <?php | |
| data class Point( | |
| int $x, | |
| int $y, | |
| ); | |
| // Compiles to | |
| class Point { |
| <?php | |
| enum Foo { | |
| case Bar; | |
| case Baz(int $qux); | |
| } | |
| // Gets compiled to | |
| abstract class Foo |