-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration rules for Laravel 5.3 (#261)
* Migrate the deprecated lists method in Laravel 5.3 * Migrate even more deprecations Laravel 5.3
- Loading branch information
Showing
4 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace RectorLaravel\Tests\Sets\Laravel53; | ||
|
||
(new \Illuminate\Support\Collection())->lists('id'); | ||
(new \Illuminate\Database\Eloquent\Builder())->lists('id'); | ||
(new \Illuminate\Database\Query\Builder())->lists('id'); | ||
(new \Illuminate\Database\Eloquent\Collection())->withHidden([]); | ||
(new \Illuminate\Database\Eloquent\Model())->withHidden([]); | ||
\Illuminate\Support\Str::randomBytes(16); | ||
\Illuminate\Support\Str::equals('knownString', 'userInput'); | ||
|
||
class SomeJob implements \Illuminate\Contracts\Bus\SelfHandling | ||
{ | ||
} | ||
|
||
class SomeScope implements \Illuminate\Database\Eloquent\ScopeInterface | ||
{ | ||
} | ||
|
||
class SomeView extends \Illuminate\View\Expression | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace RectorLaravel\Tests\Sets\Laravel53; | ||
|
||
(new \Illuminate\Support\Collection())->pluck('id'); | ||
(new \Illuminate\Database\Eloquent\Builder())->pluck('id'); | ||
(new \Illuminate\Database\Query\Builder())->pluck('id'); | ||
(new \Illuminate\Database\Eloquent\Collection())->makeVisible([]); | ||
(new \Illuminate\Database\Eloquent\Model())->makeVisible([]); | ||
\random_bytes(16); | ||
\hash_equals('knownString', 'userInput'); | ||
|
||
class SomeJob | ||
{ | ||
} | ||
|
||
class SomeScope implements \Illuminate\Database\Eloquent\Scope | ||
{ | ||
} | ||
|
||
class SomeView extends \Illuminate\Support\HtmlString | ||
{ | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RectorLaravel\Tests\Sets\Laravel53; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
final class Laravel53Test extends AbstractRectorTestCase | ||
{ | ||
public static function provideData(): Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/configured_rule.php'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->import(__DIR__ . '/../../../../config/sets/laravel53.php'); | ||
}; |