Skip to content

Commit 3ca888d

Browse files
authored
Allow RouteActionCallableRector to work with \Route calls (#185)
1 parent 68a890f commit 3ca888d

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/NodeFactory/RouterRegisterNodeAnalyzer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public function isRegisterMethodStaticCall(MethodCall|StaticCall $node): bool
3333
return true;
3434
}
3535

36-
return $node instanceof StaticCall && $this->nodeNameResolver->isName(
36+
return $node instanceof StaticCall && $this->nodeNameResolver->isNames(
3737
$node->class,
38-
'Illuminate\Support\Facades\Route'
38+
['Illuminate\Support\Facades\Route', 'Route']
3939
);
4040
}
4141

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace RectorLaravel\Tests\Rector\StaticCall\RouteActionCallableRector\Fixture;
4+
5+
use Route;
6+
7+
Route::get('/users', ['as' => 'users.index', 'uses' => 'SomeController@index']);
8+
9+
?>
10+
-----
11+
<?php
12+
13+
namespace RectorLaravel\Tests\Rector\StaticCall\RouteActionCallableRector\Fixture;
14+
15+
use Route;
16+
17+
Route::get('/users', [\RectorLaravel\Tests\Rector\StaticCall\RouteActionCallableRector\Source\SomeController::class, 'index'])->name('users.index');
18+
19+
?>

0 commit comments

Comments
 (0)