Skip to content

Commit c3ce2ea

Browse files
committed
update class to modifier
1 parent b36dae5 commit c3ce2ea

18 files changed

+38
-41
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ use PhpParser\Node\Stmt\ClassConst;
19871987
$defaultValue = new String_('default value');
19881988
$const = new Const_('SOME_CLASS_CONSTANT', $defaultValue);
19891989

1990-
return new ClassConst([$const], Class_::MODIFIER_PUBLIC);
1990+
return new ClassConst([$const], Modifier::PUBLIC);
19911991
```
19921992

19931993
@@ -2020,7 +2020,7 @@ use PhpParser\Node\Stmt\Class_;
20202020
use PhpParser\Node\Stmt\ClassMethod;
20212021

20222022
$classMethod = new ClassMethod('methodName');
2023-
$classMethod->flags = Class_::MODIFIER_PUBLIC;
2023+
$classMethod->flags = Modifier::PUBLIC;
20242024

20252025
return $classMethod;
20262026
```
@@ -2079,7 +2079,7 @@ use PhpParser\Node\Stmt\ClassMethod;
20792079
use PhpParser\Node\Stmt\Expression;
20802080

20812081
$classMethod = new ClassMethod('methodName');
2082-
$classMethod->flags = Class_::MODIFIER_PUBLIC;
2082+
$classMethod->flags = Modifier::PUBLIC;
20832083

20842084
$variable = new Variable('some');
20852085
$number = new LNumber(10000);
@@ -2607,7 +2607,7 @@ use PhpParser\Node\VarLikeIdentifier;
26072607

26082608
$propertyProperty = new PropertyProperty(new VarLikeIdentifier('propertyName'));
26092609

2610-
return new Property(Class_::MODIFIER_PUBLIC, [$propertyProperty]);
2610+
return new Property(Modifier::PUBLIC, [$propertyProperty]);
26112611
```
26122612

26132613
@@ -2629,7 +2629,7 @@ use PhpParser\Node\Stmt\PropertyProperty;
26292629

26302630
$propertyProperties = [new PropertyProperty('firstProperty'), new PropertyProperty('secondProperty')];
26312631

2632-
return new Property(Class_::MODIFIER_STATIC | Class_::MODIFIER_PUBLIC, $propertyProperties);
2632+
return new Property(Modifiers::STATIC | Modifier::PUBLIC, $propertyProperties);
26332633
```
26342634

26352635
@@ -2764,7 +2764,7 @@ use PhpParser\Node\Stmt\TraitUseAdaptation\Alias;
27642764

27652765
$traitFullyQualified = new FullyQualified('TraitName');
27662766

2767-
return new Alias($traitFullyQualified, 'method', Class_::MODIFIER_PUBLIC, 'aliasedMethod');
2767+
return new Alias($traitFullyQualified, 'method', Modifier::PUBLIC, 'aliasedMethod');
27682768
```
27692769

27702770

ecs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
__DIR__ . '/bin',
1010
__DIR__ . '/src',
1111
__DIR__ . '/tests',
12+
__DIR__ . '/snippet'
1213
])
1314
->withPreparedSets(symplify: true, common: true, psr12: true);

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ parameters:
55
- bin
66
- src
77
- tests
8+
- snippet
9+
810
treatPhpDocTypesAsCertain: false

snippet/alias.php

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

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Name\FullyQualified;
6-
use PhpParser\Node\Stmt\Class_;
77
use PhpParser\Node\Stmt\TraitUseAdaptation\Alias;
88

99
$traitFullyQualified = new FullyQualified('TraitName');
1010

11-
return new Alias($traitFullyQualified, 'method', Class_::MODIFIER_PUBLIC, 'aliasedMethod');
11+
return new Alias($traitFullyQualified, 'method', Modifiers::PUBLIC, 'aliasedMethod');

snippet/block.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpParser\Modifiers;
6+
use PhpParser\Node\Name\FullyQualified;
7+
use PhpParser\Node\Stmt\TraitUseAdaptation\Alias;
8+
9+
$traitFullyQualified = new FullyQualified('TraitName');
10+
11+
return new Alias($traitFullyQualified, 'method', Modifiers::PUBLIC, 'aliasedMethod');

snippet/class_const.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
use PhpParser\Node\Const_;
66
use PhpParser\Node\Scalar\String_;
7-
use PhpParser\Node\Stmt\Class_;
87
use PhpParser\Node\Stmt\ClassConst;
98

109
$defaultValue = new String_('default value');
1110
$const = new Const_('SOME_CLASS_CONSTANT', $defaultValue);
1211

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

snippet/class_final.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
use PhpParser\Node\Stmt\Class_;
66

77
$class = new Class_('ClassName');
8-
$class->flags |= Class_::MODIFIER_FINAL;
8+
$class->flags |= \PhpParser\Modifiers::FINAL;
99

1010
return $class;

snippet/class_method.php

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

33
declare(strict_types=1);
44

5-
use PhpParser\Node\Stmt\Class_;
65
use PhpParser\Node\Stmt\ClassMethod;
76

87
$classMethod = new ClassMethod('methodName');
9-
$classMethod->flags = Class_::MODIFIER_PUBLIC;
8+
$classMethod->flags = \PhpParser\Modifiers::PUBLIC;
109

1110
return $classMethod;

snippet/class_method_with_param_and_return_type.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
use PhpParser\Node\Expr\Variable;
66
use PhpParser\Node\Identifier;
77
use PhpParser\Node\Param;
8-
use PhpParser\Node\Stmt\Class_;
98
use PhpParser\Node\Stmt\ClassMethod;
109

1110
$classMethod = new ClassMethod('methodName');
12-
$classMethod->flags = Class_::MODIFIER_PRIVATE;
11+
$classMethod->flags = \PhpParser\Modifiers::PRIVATE;
1312

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

snippet/class_method_with_stmts.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
use PhpParser\Node\Expr\Assign;
66
use PhpParser\Node\Expr\Variable;
77
use PhpParser\Node\Scalar\LNumber;
8-
use PhpParser\Node\Stmt\Class_;
98
use PhpParser\Node\Stmt\ClassMethod;
109
use PhpParser\Node\Stmt\Expression;
1110

1211
$classMethod = new ClassMethod('methodName');
13-
$classMethod->flags = Class_::MODIFIER_PUBLIC;
12+
$classMethod->flags = \PhpParser\Modifiers::PUBLIC;
1413

1514
$variable = new Variable('some');
1615
$number = new LNumber(10000);

0 commit comments

Comments
 (0)