add Laravel 5.0, 5.1 and 5.2 sets

This commit is contained in:
Tomas Votruba 2019-03-09 14:29:44 +00:00
parent 3e02367aa0
commit b419f625c7
8 changed files with 55 additions and 5 deletions

View File

@ -38,7 +38,7 @@ Rector **instantly upgrades and instantly refactors PHP code of your application
- Rename classes, methods, properties, namespaces, constants... anything :)
- Add, replace or remove arguments
- Add [parameter or return type declarations](https://www.tomasvotruba.cz/blog/2019/01/03/how-to-complete-type-declarations-without-docblocks-with-rector/) without docblocks - just with static analysis
- Add [parameter or return type declarations](https://www.tomasvotruba.cz/blog/2019/01/03/how-to-complete-type-declarations-without-docblocks-with-rector/) without docblocks - just with static analysis
- Change visibility of constant, property or method
- Upgrade from PHP 5.3 to PHP 7.4
- [Complete PHP 7.4 property type declarations](https://www.tomasvotruba.cz/blog/2018/11/15/how-to-get-php-74-typed-properties-to-your-code-in-few-seconds/)

View File

@ -0,0 +1,16 @@
# see: https://laravel.com/docs/5.0/upgrade
services:
Rector\Rector\Class_\RenameClassRector:
Illuminate\Cache\CacheManager: 'Illuminate\Contracts\Cache\Repository'
# https://stackoverflow.com/a/24949656/1348344
Illuminate\Database\Eloquent\SoftDeletingTrait: 'Illuminate\Database\Eloquent\SoftDeletes'
Rector\Rector\MethodCall\RenameMethodRector:
Illuminate\Contracts\Pagination\Paginator:
links: 'render'
getFrom: 'firstItem'
getTo: 'lastItem'
getPerPage: 'perPage'
getCurrentPage: 'currentPage'
getLastPage: 'lastPage'
getTotal: 'total'

View File

@ -0,0 +1,4 @@
# see: https://laravel.com/docs/5.1/upgrade
services:
Rector\Rector\Class_\RenameClassRector:
Illuminate\Validation\Validator: 'Illuminate\Contracts\Validation\Validator'

View File

@ -0,0 +1,23 @@
# see: https://laravel.com/docs/5.2/upgrade
services:
Rector\Rector\Class_\RenameClassRector:
Illuminate\Auth\Access\UnauthorizedException: 'Illuminate\Auth\Access\AuthorizationException'
Illuminate\Http\Exception\HttpResponseException: 'Illuminate\Foundation\Validation\ValidationException'
Illuminate\Foundation\Composer: 'Illuminate\Support\Composer'
Rector\Rector\String_\StringToClassConstantRector:
artisan.start: ['Illuminate\Console\Events\ArtisanStarting', 'class']
auth.attempting: ['Illuminate\Auth\Events\Attempting', 'class']
auth.login: ['Illuminate\Auth\Events\Login', 'class']
auth.logout: ['Illuminate\Auth\Events\Logout', 'class']
cache.missed: ['Illuminate\Cache\Events\CacheMissed', 'class']
cache.hit: ['Illuminate\Cache\Events\CacheHit', 'class']
cache.write: ['Illuminate\Cache\Events\KeyWritten', 'class']
cache.delete: ['Illuminate\Cache\Events\KeyForgotten', 'class']
illuminate.query: ['Illuminate\Database\Events\QueryExecuted', 'class']
illuminate.queue.before: ['Illuminate\Queue\Events\JobProcessing', 'class']
illuminate.queue.after: ['Illuminate\Queue\Events\JobProcessed', 'class']
illuminate.queue.failed: ['Illuminate\Queue\Events\JobFailed', 'class']
illuminate.queue.stopping: ['Illuminate\Queue\Events\WorkerStopping', 'class']
mailer.sending: ['Illuminate\Mail\Events\MessageSending', 'class']
router.matched: ['Illuminate\Routing\Events\RouteMatched', 'class']

View File

@ -2277,7 +2277,7 @@ Changes rand, srand and getrandmax by new md_* alternatives.
- class: `Rector\Php\Rector\FuncCall\PregReplaceEModifierRector`
The /e modifier is no longer supported, use preg_replace_callback instead
The /e modifier is no longer supported, use preg_replace_callback instead
```diff
class SomeClass

View File

@ -910,7 +910,7 @@ if (true) {
```php
?>
<strong>feel</strong><?php
<strong>feel</strong><?php
```
<br>

View File

@ -6,7 +6,10 @@ final class SomeSubscriber
{
public static function getSubscribedEvents()
{
return ['compiler.post_dump' => 'compile'];
return [
'compiler.post_dump' => 'compile',
'compiler.to_class' => 'compile'
];
}
}
@ -20,7 +23,10 @@ final class SomeSubscriber
{
public static function getSubscribedEvents()
{
return [\Yet\AnotherClass::CONSTANT => 'compile'];
return [
\Yet\AnotherClass::CONSTANT => 'compile',
\Yet\AnotherClass::class => 'compile'
];
}
}

View File

@ -24,6 +24,7 @@ final class StringToClassConstantRectorTest extends AbstractRectorTestCase
{
return [
'compiler.post_dump' => ['Yet\AnotherClass', 'CONSTANT'],
'compiler.to_class' => ['Yet\AnotherClass', 'class'],
];
}
}