File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 55 "php" : " ^8.2" ,
66 "phpunit/phpunit" : " 10.*|11.*|12.*" ,
77 "nikic/php-parser" : " 5.4.*" ,
8- "rector/rector" : " dev-main" ,
8+ "rector/rector" : " dev-main as 2.2.6 " ,
99 "phpstan/phpstan" : " 2.1.*" ,
10- "driftingly/rector-laravel" : " ^0.27.0 "
10+ "driftingly/rector-laravel" : " ^2.1 "
1111 },
1212 "autoload" : {
1313 "psr-4" : {
Original file line number Diff line number Diff line change 44
55use Rector \Config \RectorConfig ;
66use Rector \RectorCompatTests \Rector \UseGetArgRector ;
7+ use RectorLaravel \Set \LaravelSetList ;
78
89return RectorConfig::configure ()
910 ->withPaths ([
1011 __DIR__ . '/src ' ,
1112 __DIR__ . '/tests ' ,
1213 __DIR__ . '/fixture ' ,
1314 ])
14- // uncomment to reach your current PHP version
15- // ->withPhpSets()
16- ->withRules ([UseGetArgRector::class])
15+ ->withRules ([UseGetArgRector::class])
1716 ->withTypeCoverageLevel (0 )
1817 ->withDeadCodeLevel (0 )
1918 ->withCodeQualityLevel (0 );
Original file line number Diff line number Diff line change 66
77use PhpParser \Modifiers ;
88use PhpParser \Node ;
9+ use PhpParser \Node \Arg ;
910use PhpParser \Node \Expr \FuncCall ;
11+ use PhpParser \Node \Scalar \String_ ;
1012use PhpParser \Node \Stmt \Class_ ;
1113use PhpParser \Node \Stmt \Function_ ;
1214use Rector \Rector \AbstractRector ;
@@ -27,7 +29,13 @@ public function getNodeTypes(): array
2729 public function refactor (Node $ node )
2830 {
2931 // here we should load Rector's php-parser 5.6, that already has getArg() method
32+ $ firstArg = $ node ->getArg ('' , 0 );
33+ if (! $ firstArg instanceof Arg) {
34+ return null ;;
35+ }
3036
31- return $ node ->getArg ('name ' , 5 );
37+ $ firstArg ->value = new String_ ('changed_value ' );
38+
39+ return $ node ;
3240 }
3341}
You can’t perform that action at this time.
0 commit comments