Skip to content

Commit ae7794f

Browse files
authored
Fix redundant default arguments in Laravel 9 set, add tests for the Laravel 9 set. (#221)
1 parent 9c1f2e5 commit ae7794f

20 files changed

+330
-7
lines changed

config/sets/laravel90.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
declare(strict_types=1);
44

55
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
6-
use Rector\Arguments\ValueObject\ArgumentAdder;
6+
use Rector\Arguments\ValueObject\ArgumentAdderWithoutDefaultValue;
77
use Rector\Config\RectorConfig;
88
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
99
use Rector\Renaming\ValueObject\MethodCallRename;
@@ -19,29 +19,27 @@
1919

2020
// https://github.com/laravel/framework/commit/8f9ddea4481717943ed4ecff96d86b703c81a87d
2121
$rectorConfig
22-
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder(
22+
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdderWithoutDefaultValue(
2323
'Illuminate\Contracts\Foundation\Application',
2424
'storagePath',
2525
0,
2626
'path',
27-
''
2827
),
2928
]);
3029

3130
// https://github.com/laravel/framework/commit/e6c8aaea886d35cc55bd3469f1a95ad56d53e474
3231
$rectorConfig
33-
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder(
32+
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdderWithoutDefaultValue(
3433
'Illuminate\Foundation\Application',
3534
'langPath',
3635
0,
3736
'path',
38-
''
3937
),
4038
]);
4139

4240
// https://github.com/laravel/framework/commit/e095ac0e928b5620f33c9b60816fde5ece867d32
4341
$rectorConfig
44-
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder(
42+
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdderWithoutDefaultValue(
4543
'Illuminate\Database\Eloquent\Model',
4644
'touch',
4745
0,
@@ -51,7 +49,7 @@
5149

5250
// https://github.com/laravel/framework/commit/6daecf43dd931dc503e410645ff4a7d611e3371f
5351
$rectorConfig
54-
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder(
52+
->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdderWithoutDefaultValue(
5553
'Illuminate\Queue\Failed\FailedJobProviderInterface',
5654
'flush',
5755
0,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Foundation;
6+
7+
if (class_exists('Illuminate\Foundation\Application')) {
8+
return;
9+
}
10+
11+
class Application
12+
{
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Foundation\Exceptions;
6+
7+
if (class_exists('Illuminate\Foundation\Exceptions\Handler')) {
8+
return;
9+
}
10+
11+
class Handler
12+
{
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Mail;
6+
7+
if (class_exists('Illuminate\Mail\MailManager')) {
8+
return;
9+
}
10+
11+
class MailManager
12+
{
13+
}

stubs/Illuminate/Mail/Mailable.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Mail;
6+
7+
if (class_exists('Illuminate\Mail\Mailable')) {
8+
return;
9+
}
10+
11+
class Mailable
12+
{
13+
}

stubs/Illuminate/Mail/Mailer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Mail;
6+
7+
if (class_exists('Illuminate\Mail\Mailer')) {
8+
return;
9+
}
10+
11+
class Mailer
12+
{
13+
}

stubs/Illuminate/Mail/Message.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Mail;
6+
7+
if (class_exists('Illuminate\Mail\Message')) {
8+
return;
9+
}
10+
11+
class Message
12+
{
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Notifications\Messages;
6+
7+
if (class_exists('Illuminate\Notifications\Messages\MailMessage')) {
8+
return;
9+
}
10+
11+
class MailMessage
12+
{
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Queue\Failed;
6+
7+
if (class_exists('Illuminate\Queue\Failed\FailedJobProviderInterface')) {
8+
return;
9+
}
10+
11+
interface FailedJobProviderInterface
12+
{
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Illuminate\Support;
6+
7+
if (class_exists('Illuminate\Support\Enumerable')) {
8+
return;
9+
}
10+
11+
interface Enumerable
12+
{
13+
}

0 commit comments

Comments
 (0)