driftingly / rector-laravel

Rector upgrades rules for Laravel
http://getrector.org
MIT License
469 stars 48 forks source link

Fix JSON GET calls with the route helper #231

Closed GeniJaho closed 1 week ago

GeniJaho commented 2 weeks ago

Fixes https://github.com/driftingly/rector-laravel/issues/217.

This PR will ensure that the route() helper will receive the $data argument, which should produce the same behavior.

Some cases taken into account:

$http->json('GET', route('home'));
$http->json('GET', route('home'), ['payload']);
$http->json('GET', route('home'), data: ['payload']);
$http->json('GET', route('home', 'some arg'), ['payload']);
$http->json('GET', '/', ['data'], ['headers'], 1);
$http->json('GET', '/', ['data'], ['headers']);
$http->json('GET', '/', ['data']);
$http->json('GET', route('home'), headers: ['payload']);
$http->json('GET', route('home'), options: 1);