File tree Expand file tree Collapse file tree 5 files changed +14
-22
lines changed
PHPUnit60/Rector/MethodCall Expand file tree Collapse file tree 5 files changed +14
-22
lines changed Original file line number Diff line number Diff line change 1313 "phpstan/phpstan-deprecation-rules" : " ^2.0" ,
1414 "phpstan/phpstan-webmozart-assert" : " ^2.0" ,
1515 "phpunit/phpunit" : " ^11.5" ,
16- "rector/rector-src" : " dev-main " ,
16+ "rector/rector-src" : " dev-tv-stmts-interface " ,
1717 "rector/swiss-knife" : " ^1.0" ,
1818 "rector/type-perfect" : " ^2.1" ,
1919 "symplify/phpstan-extensions" : " ^12.0" ,
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ parameters:
1111 reportUnmatchedIgnoredErrors : false
1212 errorFormat : symplify
1313
14+ # see https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases
15+ typeAliases :
16+ StmtsAware : \PhpParser\Node\Expr\Closure | \PhpParser\Node\Stmt\Case_ | \PhpParser\Node\Stmt\Catch_ | \PhpParser\Node\Stmt\ClassMethod | \PhpParser\Node\Stmt\Do_ | \PhpParser\Node\Stmt\Else_ | \PhpParser\Node\Stmt\ElseIf_ | \PhpParser\Node\Stmt\Finally_ | \PhpParser\Node\Stmt\For_ | \PhpParser\Node\Stmt\Foreach_ | \PhpParser\Node\Stmt\Function_ | \PhpParser\Node\Stmt\If_ | \PhpParser\Node\Stmt\Namespace_ | \PhpParser\Node\Stmt\TryCatch | \PhpParser\Node\Stmt\While_
17+
1418 scanDirectories :
1519 - stubs
1620
@@ -31,21 +35,9 @@ parameters:
3135 # phpstan false positive
3236 - '#Parameter \#1 \$className of method Rector\\PhpParser\\AstResolver\:\:resolveClassMethod\ (\ ) expects class\-string , string given #'
3337
34- # false positive
35- - ' #Access to an undefined property Rector\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts #'
36-
3738 # more advanced usage, but not always working
3839 # see https://github.com/rectorphp/rector-src/actions/runs/11798721617/job/32865546672?pr=6422#step:5:110
3940 - ' #Doing instanceof PHPStan\\Type\\.+ is error\-prone and deprecated #'
4041
4142 - identifier : instanceof.alwaysTrue
4243 - identifier : assign.propertyType
43-
44- # not relevant
45- - '#Method (.*? )provideMinPhpVersion\ (\ ) never returns \d+ so it can be removed from the return type #'
46-
47- # chicken-egg false positive
48- -
49- message : ' #Parameter \#1 \$value of static method Webmozart\\Assert\\Assert\:\:isAOf\(\) expects object\|string, PhpParser\\Node\\Stmt\\Class_\|null given#'
50- path : rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php
51-
Original file line number Diff line number Diff line change 1414use PhpParser \Node \Identifier ;
1515use PhpParser \Node \Scalar \Int_ ;
1616use PhpParser \Node \Stmt \Expression ;
17- use Rector \Contract \PhpParser \Node \StmtsAwareInterface ;
1817use Rector \Exception \ShouldNotHappenException ;
1918use Rector \NodeManipulator \StmtsManipulator ;
19+ use Rector \PhpParser \Enum \NodeGroup ;
2020use Rector \PhpParser \Node \Value \ValueResolver ;
2121use Rector \PHPUnit \NodeAnalyzer \TestsNodeAnalyzer ;
2222use Rector \Rector \AbstractRector ;
@@ -77,11 +77,11 @@ public function getRuleDefinition(): RuleDefinition
7777 */
7878 public function getNodeTypes (): array
7979 {
80- return [StmtsAwareInterface::class] ;
80+ return NodeGroup:: STMTS_AWARE ;
8181 }
8282
8383 /**
84- * @param StmtsAwareInterface $node
84+ * @param StmtsAware $node
8585 */
8686 public function refactor (Node $ node ): ?Node
8787 {
Original file line number Diff line number Diff line change 1010use PhpParser \Node \Stmt \Nop ;
1111use PhpParser \NodeVisitor ;
1212use Rector \ChangesReporting \ValueObject \RectorWithLineChange ;
13- use Rector \Contract \PhpParser \Node \StmtsAwareInterface ;
1413use Rector \Contract \Rector \HTMLAverseRectorInterface ;
14+ use Rector \PhpParser \Enum \NodeGroup ;
1515use Rector \PhpParser \Node \BetterNodeFinder ;
1616use Rector \PhpParser \Node \CustomNode \FileWithoutNamespace ;
1717use Rector \PHPUnit \NodeAnalyzer \TestsNodeAnalyzer ;
@@ -121,11 +121,11 @@ public function beforeTraverse(array $nodes): ?array
121121 */
122122 public function getNodeTypes (): array
123123 {
124- return [StmtsAwareInterface::class] ;
124+ return NodeGroup:: STMTS_AWARE ;
125125 }
126126
127127 /**
128- * @param StmtsAwareInterface $node
128+ * @param StmtsAware $node
129129 */
130130 public function refactor (Node $ node ): int
131131 {
Original file line number Diff line number Diff line change 99use PhpParser \Node \Expr \StaticCall ;
1010use PhpParser \Node \Identifier ;
1111use PhpParser \Node \Stmt \Expression ;
12- use Rector \Contract \ PhpParser \Node \ StmtsAwareInterface ;
12+ use Rector \PhpParser \Enum \ NodeGroup ;
1313use Rector \PHPUnit \NodeAnalyzer \TestsNodeAnalyzer ;
1414use Rector \PHPUnit \NodeFactory \AssertCallFactory ;
1515use Rector \Rector \AbstractRector ;
@@ -76,11 +76,11 @@ public function test()
7676 */
7777 public function getNodeTypes (): array
7878 {
79- return [StmtsAwareInterface::class] ;
79+ return NodeGroup:: STMTS_AWARE ;
8080 }
8181
8282 /**
83- * @param StmtsAwareInterface $node
83+ * @param StmtsAware $node
8484 */
8585 public function refactor (Node $ node ): ?Node
8686 {
You can’t perform that action at this time.
0 commit comments