Skip to content

Commit 71ad91d

Browse files
committed
bump to PHP 8.3
1 parent 464f944 commit 71ad91d

14 files changed

+119
-95
lines changed

README.md

Lines changed: 77 additions & 63 deletions
Large diffs are not rendered by default.

rector.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66
use Rector\Config\RectorConfig;
77
use Rector\Set\ValueObject\LevelSetList;
88

9-
return static function (RectorConfig $rectorConfig): void {
10-
$rectorConfig->importNames();
11-
12-
$rectorConfig->paths([
9+
return RectorConfig::configure()
10+
->withImportNames()
11+
->withPaths([
12+
__DIR__ . '/snippet',
1313
__DIR__ . '/src',
1414
__DIR__ . '/tests',
15-
]);
16-
17-
$rectorConfig->sets([
18-
LevelSetList::UP_TO_PHP_81
19-
]);
20-
};
15+
])
16+
->withPhpSets();

snippet/class_const.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Const_;
67
use PhpParser\Node\Scalar\String_;
78
use PhpParser\Node\Stmt\ClassConst;
89

910
$defaultValue = new String_('default value');
1011
$const = new Const_('SOME_CLASS_CONSTANT', $defaultValue);
1112

12-
return new ClassConst([$const], \PhpParser\Modifiers::PUBLIC);
13+
return new ClassConst([$const], Modifiers::PUBLIC);

snippet/class_final.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Stmt\Class_;
67

78
$class = new Class_('ClassName');
8-
$class->flags |= \PhpParser\Modifiers::FINAL;
9+
$class->flags |= Modifiers::FINAL;
910

1011
return $class;

snippet/class_method.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Stmt\ClassMethod;
67

78
$classMethod = new ClassMethod('methodName');
8-
$classMethod->flags = \PhpParser\Modifiers::PUBLIC;
9+
$classMethod->flags = Modifiers::PUBLIC;
910

1011
return $classMethod;

snippet/class_method_with_param_and_return_type.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Expr\Variable;
67
use PhpParser\Node\Identifier;
78
use PhpParser\Node\Param;
89
use PhpParser\Node\Stmt\ClassMethod;
910

1011
$classMethod = new ClassMethod('methodName');
11-
$classMethod->flags = \PhpParser\Modifiers::PRIVATE;
12+
$classMethod->flags = Modifiers::PRIVATE;
1213

1314
$param = new Param(new Variable('paramName'));
1415
$classMethod->params = [$param];

snippet/class_method_with_stmts.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Expr\Assign;
67
use PhpParser\Node\Expr\Variable;
78
use PhpParser\Node\Scalar\Int_;
89
use PhpParser\Node\Stmt\ClassMethod;
910
use PhpParser\Node\Stmt\Expression;
1011

1112
$classMethod = new ClassMethod('methodName');
12-
$classMethod->flags = \PhpParser\Modifiers::PUBLIC;
13+
$classMethod->flags = Modifiers::PUBLIC;
1314

1415
$variable = new Variable('some');
1516
$number = new Int_(10000);

snippet/final_class_with_parent_class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Name\FullyQualified;
67
use PhpParser\Node\Stmt\Class_;
78

89
$class = new Class_('ClassName');
910

10-
$class->flags = \PhpParser\Modifiers::FINAL;
11+
$class->flags = Modifiers::FINAL;
1112
$class->extends = new FullyQualified('ParentClass');
1213

1314
return $class;

snippet/php_74/property_typed.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Node\Identifier;
56
use PhpParser\Modifiers;
67
use PhpParser\Node\Stmt\Property;
78
use PhpParser\Node\Stmt\PropertyProperty;
89
use PhpParser\Node\VarLikeIdentifier;
910

1011
$propertyProperty = new PropertyProperty(new VarLikeIdentifier('propertyName'));
1112

12-
return new Property(Modifiers::PUBLIC, [$propertyProperty], [], new \PhpParser\Node\Identifier('string'));
13+
return new Property(Modifiers::PUBLIC, [$propertyProperty], [], new Identifier('string'));

snippet/php_84/property_hook.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Node\PropertyItem;
6+
use PhpParser\Node\Stmt\Property;
7+
use PhpParser\Node\Expr\BinaryOp\Plus;
8+
use PhpParser\Node\Expr\Variable;
9+
use PhpParser\Node\Scalar\Int_;
10+
use PhpParser\Node\PropertyHook;
511
use PhpParser\Modifiers;
612

7-
$propertyItem = new \PhpParser\Node\PropertyItem('someProperty');
8-
$property = new \PhpParser\Node\Stmt\Property(Modifiers::PUBLIC, [$propertyItem]);
13+
$propertyItem = new PropertyItem('someProperty');
14+
$property = new Property(Modifiers::PUBLIC, [$propertyItem]);
915

10-
$plus = new \PhpParser\Node\Expr\BinaryOp\Plus(
11-
new \PhpParser\Node\Expr\Variable('variable'),
12-
new \PhpParser\Node\Scalar\Int_(100)
16+
$plus = new Plus(
17+
new Variable('variable'),
18+
new Int_(100)
1319
);
1420

15-
$getPropertyHook = new \PhpParser\Node\PropertyHook('getProperty', $plus);
21+
$getPropertyHook = new PropertyHook('getProperty', $plus);
1622

1723
$property->hooks[] = $getPropertyHook;
1824

0 commit comments

Comments
 (0)