Skip to content

Commit

Permalink
Merge 8de32c9 into eaab664
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Feb 6, 2020
2 parents eaab664 + 8de32c9 commit 9e152e7
Show file tree
Hide file tree
Showing 1,483 changed files with 4,119 additions and 13,563 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Let's say we want to **change method calls from `set*` to `change*`**.

### 1. Create a New Rector and Implement Methods

Create a class that extends [`Rector\Rector\AbstractRector`](/src/Rector/AbstractRector.php). It will inherit useful methods e.g. to check node type and name. See the source (or type `$this->` in an IDE) for a list of available methods.
Create a class that extends [`Rector\Core\Rector\AbstractRector`](/src/Rector/AbstractRector.php). It will inherit useful methods e.g. to check node type and name. See the source (or type `$this->` in an IDE) for a list of available methods.

```php
<?php
Expand All @@ -311,9 +311,9 @@ use Nette\Utils\Strings;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Expr\MethodCall;
use Rector\Rector\AbstractRector;
use Rector\Core\Rector\AbstractRector;
use Rector\RectorDefinition\CodeSample;
use Rector\RectorDefinition\RectorDefinition;
use Rector\Core\RectorDefinition\RectorDefinition;

final class MyFirstRector extends AbstractRector
{
Expand Down
10 changes: 5 additions & 5 deletions bin/rector
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

declare(strict_types=1);

use Rector\Configuration\Configuration;
use Rector\Console\Application;
use Rector\Console\Style\SymfonyStyleFactory;
use Rector\DependencyInjection\RectorContainerFactory;
use Rector\Set\Set;
use Rector\Core\Configuration\Configuration;
use Rector\Core\Console\Application;
use Rector\Core\Console\Style\SymfonyStyleFactory;
use Rector\Core\DependencyInjection\RectorContainerFactory;
use Rector\Core\Set\Set;
use Symfony\Component\Console\Input\ArgvInput;
use Symplify\PackageBuilder\Reflection\PrivatesCaller;
use Symplify\SetConfigResolver\ConfigResolver;
Expand Down
2 changes: 1 addition & 1 deletion ci/check_keep_fixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

use Nette\Utils\Strings;
use Rector\Testing\PHPUnit\FixtureSplitter;
use Rector\Core\Testing\PHPUnit\FixtureSplitter;
use Symplify\PackageBuilder\Console\ShellCode;
use Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;
use Symplify\SmartFileSystem\Finder\FinderSanitizer;
Expand Down
2 changes: 1 addition & 1 deletion ci/run_all_sets.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

use Nette\Utils\Strings;
use Rector\Set\SetProvider;
use Rector\Core\Set\SetProvider;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
use Symplify\PackageBuilder\Console\ShellCode;
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"autoload": {
"psr-4": {
"Rector\\": "src",
"Rector\\Core\\": "src",
"Rector\\Autodiscovery\\": "packages/Autodiscovery/src",
"Rector\\Architecture\\": "packages/Architecture/src",
"Rector\\AttributeAwarePhpDoc\\": "packages/AttributeAwarePhpDoc/src",
Expand Down Expand Up @@ -119,7 +119,7 @@
},
"autoload-dev": {
"psr-4": {
"Rector\\Tests\\": "tests",
"Rector\\Core\\Tests\\": "tests",
"Rector\\Autodiscovery\\Tests\\": "packages/Autodiscovery/tests",
"Rector\\Architecture\\Tests\\": "packages/Architecture/tests",
"Rector\\BetterPhpDocParser\\Tests\\": "packages/BetterPhpDocParser/tests",
Expand Down Expand Up @@ -218,16 +218,16 @@
"@phpstan",
"@docs"
],
"check-cs": "ecs check bin packages src tests utils compiler --ansi",
"check-cs": "vendor/bin/ecs check bin packages src tests utils compiler --ansi",
"fix-cs": [
"ecs check bin packages src tests utils compiler --fix --ansi",
"vendor/bin/ecs check bin packages src tests utils compiler --fix --ansi",
"ci/clean_trailing_spaces.sh"
],
"phpstan": "phpstan analyse packages src tests compiler/src --ansi --error-format symplify",
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
"changelog": [
"changelog-linker dump-merges --in-categories",
"changelog-linker link",
"changelog-linker cleanup"
"vendor/bin/changelog-linker dump-merges --in-categories",
"vendor/bin/changelog-linker link",
"vendor/bin/changelog-linker cleanup"
],
"check-docs": [
"bin/rector dump-rectors -o markdown | diff --ignore-space-change docs/AllRectorsOverview.md - ",
Expand Down
6 changes: 3 additions & 3 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
public: true
autowire: true

Rector\:
Rector\Core\:
resource: '../src'
exclude:
- '../src/Rector/**/*Rector.php'
Expand All @@ -21,7 +21,7 @@ services:
Rector\Symfony\Rector\Form\Helper\FormTypeStringToTypeProvider: null

Symfony\Component\Console\Application:
alias: 'Rector\Console\Application'
alias: 'Rector\Core\Console\Application'

Symfony\Component\Console\Descriptor\TextDescriptor: null

Expand All @@ -43,7 +43,7 @@ services:
Symplify\PackageBuilder\Strings\StringFormatConverter: null

# alises
Symfony\Contracts\EventDispatcher\EventDispatcherInterface: '@Rector\EventDispatcher\AutowiredEventDispatcher'
Symfony\Contracts\EventDispatcher\EventDispatcherInterface: '@Rector\Core\EventDispatcher\AutowiredEventDispatcher'

OndraM\CiDetector\CiDetector: null

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
services:
Rector\Rector\Architecture\DependencyInjection\ActionInjectionToConstructorInjectionRector: null
Rector\Rector\Architecture\DependencyInjection\ReplaceVariableByPropertyFetchRector: null
Rector\Core\Rector\Architecture\DependencyInjection\ActionInjectionToConstructorInjectionRector: null
Rector\Core\Rector\Architecture\DependencyInjection\ReplaceVariableByPropertyFetchRector: null
6 changes: 3 additions & 3 deletions config/set/architecture/doctrine-repository-as-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:

services:
# order matters, this needs to be first to correctly detect parent repository
Rector\Rector\Architecture\RepositoryAsService\ReplaceParentRepositoryCallsByRepositoryPropertyRector: null
Rector\Rector\Architecture\RepositoryAsService\MoveRepositoryFromParentToConstructorRector: null
Rector\Rector\Architecture\RepositoryAsService\ServiceLocatorToDIRector: null
Rector\Core\Rector\Architecture\RepositoryAsService\ReplaceParentRepositoryCallsByRepositoryPropertyRector: null
Rector\Core\Rector\Architecture\RepositoryAsService\MoveRepositoryFromParentToConstructorRector: null
Rector\Core\Rector\Architecture\RepositoryAsService\ServiceLocatorToDIRector: null
Rector\Doctrine\Rector\Class_\RemoveRepositoryFromEntityAnnotationRector: null
8 changes: 4 additions & 4 deletions config/set/cakephp/cakephp34.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html
services:
Rector\Rector\Property\PropertyToMethodRector:
Rector\Core\Rector\Property\PropertyToMethodRector:
$perClassPropertyToMethods:
Cake\Network\Request:
params:
Expand All @@ -27,7 +27,7 @@ services:
method: 'getAttribute'
arguments: ['here']

Rector\Rector\Property\RenamePropertyRector:
Rector\Core\Rector\Property\RenamePropertyRector:
$oldToNewPropertyByTypes:
Cake\Network\Request:
_session: 'session'
Expand Down Expand Up @@ -237,7 +237,7 @@ services:
Cake\Routing\Router:
parse: 'parseRequest'

Rector\Rector\Visibility\ChangeMethodVisibilityRector:
Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector:
$methodToVisibilityByClass:
Cake\Mailer\MailerAwareTrait:
getMailer: 'protected'
Expand All @@ -248,7 +248,7 @@ services:
$oldToNewClasses:
Cake\Database\Schema\Table: 'Cake\Database\Schema\TableSchema'

Rector\Rector\MethodBody\NormalToFluentRector:
Rector\Core\Rector\MethodBody\NormalToFluentRector:
$fluentMethodsByType:
Cake\Network\Response:
# https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html#adopting-immutable-responses
Expand Down
2 changes: 1 addition & 1 deletion config/set/cakephp/cakephp36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
'isPresenceRequired': 'requirePresence'
'isEmptyAllowed': 'allowEmpty'

Rector\Rector\Property\PropertyToMethodRector:
Rector\Core\Rector\Property\PropertyToMethodRector:
$perClassPropertyToMethods:
'Cake\Controller\Controller':
'name':
Expand Down
4 changes: 2 additions & 2 deletions config/set/cakephp/cakephp37.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
Cake\Core\Plugin:
unload: 'clear'

Rector\Rector\Property\PropertyToMethodRector:
Rector\Core\Rector\Property\PropertyToMethodRector:
$perClassPropertyToMethods:
Cake\Http\Client\Response:
body:
Expand Down Expand Up @@ -67,7 +67,7 @@ services:
helpers:
get: 'helpers'

Rector\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector:
Rector\Core\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector:
$oldMethodsToNewMethodsWithArgsByType:
Cake\Database\Query:
join: ['clause', ['join']]
Expand Down
4 changes: 2 additions & 2 deletions config/set/cakephp/cakephp40.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ services:
setRequestInfo: setRequest
setRequestContext: setRequest

Rector\Rector\Property\RenamePropertyRector:
Rector\Core\Rector\Property\RenamePropertyRector:
$oldToNewPropertyByTypes:
Cake\ORM\Entity:
_properties: _fields

Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector:
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
Cake\Http\BaseApplication:
bootstrap: 'void'
Expand Down
2 changes: 1 addition & 1 deletion config/set/database-migration/mysql-to-mysqli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector: null

# first swap arguments, then rename
Rector\Rector\Argument\SwapFuncCallArgumentsRector:
Rector\Core\Rector\Argument\SwapFuncCallArgumentsRector:
$newArgumentPositionsByFunctionName:
mysql_real_escape_string: [1, 0]
mysql_select_db: [1, 0]
Expand Down
2 changes: 1 addition & 1 deletion config/set/doctrine/doctrine-dbal-30.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
Doctrine\DBAL\Driver\DriverException:
getErrorCode: 'getCode'

Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector:
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
Doctrine\DBAL\Connection:
ping: 'void'
Expand Down
2 changes: 1 addition & 1 deletion config/set/doctrine/doctrine-services.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
Rector\Rector\MethodCall\ServiceGetterToConstructorInjectionRector:
Rector\Core\Rector\MethodCall\ServiceGetterToConstructorInjectionRector:
$methodNamesByTypesToServiceTypes:
'Doctrine\Common\Persistence\ManagerRegistry':
'getConnection': 'Doctrine\DBAL\Connection'
Expand Down
2 changes: 1 addition & 1 deletion config/set/doctrine/doctrine25.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
dumpIdentityMap:
0: 'Doctrine\ORM\EntityManagerInterface'

Rector\Rector\Argument\ArgumentRemoverRector:
Rector\Core\Rector\Argument\ArgumentRemoverRector:
$positionsByMethodNameByClassType:
Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister:
getSelectJoinColumnSQL:
Expand Down
4 changes: 2 additions & 2 deletions config/set/framework-migration/nette-to-symfony.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
Rector\NetteToSymfony\Rector\ClassMethod\RouterListToControllerAnnotationsRector: null

# run(Request $appRequest): IResponse -> run(Request $appRequest): \Symfony\Component\HttpFoundation\Response
Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector:
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
Nette\Application\IPresenter:
run: 'Symfony\Component\HttpFoundation\Response'
Expand Down Expand Up @@ -42,7 +42,7 @@ services:
Symfony\Component\Config\Loader\LoaderInterface:
addConfig: load

Rector\Rector\Interface_\RemoveInterfacesRector:
Rector\Core\Rector\Interface_\RemoveInterfacesRector:
$interfacesToRemove:
# Removes "implements IPresenter"
- Nette\Application\IPresenter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
Rector\Rector\Visibility\ChangeMethodVisibilityRector:
Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector:
$methodToVisibilityByClass:
Kdyby\Events\Subscriber:
getSubscribedEvents: 'static'
Expand Down
8 changes: 4 additions & 4 deletions config/set/guzzle/guzzle50.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ parameters:
services:
# both uses "%classes_to_defluent%
# covers https://github.com/guzzle/guzzle/commit/668209c895049759377593eed129e0949d9565b7#diff-810cdcfdd8a6b9e1fc0d1e96d7786874
Rector\Rector\MethodBody\ReturnThisRemoveRector: null
Rector\Rector\MethodBody\FluentReplaceRector: null
Rector\Core\Rector\MethodBody\ReturnThisRemoveRector: null
Rector\Core\Rector\MethodBody\FluentReplaceRector: null

Rector\Rector\Function_\FunctionToMethodCallRector:
Rector\Core\Rector\Function_\FunctionToMethodCallRector:
$functionToMethodCall:
GuzzleHttp\json_decode: ['GuzzleHttp\Utils', 'jsonDecode']
GuzzleHttp\get_path: ['GuzzleHttp\Utils', 'getPath']

Rector\Rector\StaticCall\StaticCallToFunctionRector:
Rector\Core\Rector\StaticCall\StaticCallToFunctionRector:
$staticCallToFunctionByType:
GuzzleHttp\Utils:
setPath: 'GuzzleHttp\set_path'
Expand Down
2 changes: 1 addition & 1 deletion config/set/jms/jms-decouple.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
services:
Rector\Rector\Property\InjectAnnotationClassRector:
Rector\Core\Rector\Property\InjectAnnotationClassRector:
$annotationClasses:
- 'JMS\DiExtraBundle\Annotation\Inject'
2 changes: 1 addition & 1 deletion config/set/laravel/laravel-static-to-injection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ services:
Rector\Laravel\Rector\StaticCall\RequestStaticValidateToInjectRector: null
Rector\Laravel\Rector\FuncCall\HelperFunctionToConstructorInjectionRector: null

Rector\Rector\FuncCall\FunctionToNewRector:
Rector\Core\Rector\FuncCall\FunctionToNewRector:
$functionToNew:
collect: 'Illuminate\Support\Collection'
2 changes: 1 addition & 1 deletion config/set/laravel/laravel52.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
Illuminate\Http\Exception\HttpResponseException: 'Illuminate\Foundation\Validation\ValidationException'
Illuminate\Foundation\Composer: 'Illuminate\Support\Composer'

Rector\Rector\String_\StringToClassConstantRector:
Rector\Core\Rector\String_\StringToClassConstantRector:
$stringsToClassConstants:
artisan.start: ['Illuminate\Console\Events\ArtisanStarting', 'class']
auth.attempting: ['Illuminate\Auth\Events\Attempting', 'class']
Expand Down
2 changes: 1 addition & 1 deletion config/set/laravel/laravel53.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# see https://laravel.com/docs/5.3/upgrade
services:
Rector\Rector\ClassLike\RemoveTraitRector:
Rector\Core\Rector\ClassLike\RemoveTraitRector:
$traitsToRemove:
- 'Illuminate\Foundation\Auth\Access\AuthorizesResources'
2 changes: 1 addition & 1 deletion config/set/laravel/laravel54.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# see: https://laravel.com/docs/5.4/upgrade
services:
Rector\Rector\String_\StringToClassConstantRector:
Rector\Core\Rector\String_\StringToClassConstantRector:
$stringsToClassConstants:
kernel.handled: ['Illuminate\Foundation\Http\Events\RequestHandled', 'class']
locale.changed: ['Illuminate\Foundation\Events\LocaleUpdated', 'class']
Expand Down
2 changes: 1 addition & 1 deletion config/set/laravel/laravel55.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
Illuminate\Console\Command:
fire: 'handle'

Rector\Rector\Property\RenamePropertyRector:
Rector\Core\Rector\Property\RenamePropertyRector:
$oldToNewPropertyByTypes:
Illuminate\Database\Eloquent\Concerns\HasEvents:
events: 'dispatchesEvents'
Expand Down
2 changes: 1 addition & 1 deletion config/set/laravel/laravel56.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
Illuminate\Contracts\Validation\ValidatesWhenResolved:
validate: 'validateResolved'

Rector\Rector\Visibility\ChangeMethodVisibilityRector:
Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector:
$methodToVisibilityByClass:
Illuminate\Routing\Router:
addRoute: 'public'
Expand Down
6 changes: 3 additions & 3 deletions config/set/laravel/laravel57.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# see: https://laravel.com/docs/5.7/upgrade
services:
Rector\Rector\Visibility\ChangeMethodVisibilityRector:
Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector:
$methodToVisibilityByClass:
Illuminate\Routing\Router:
addRoute: 'public'
Illuminate\Contracts\Auth\Access\Gate:
raw: 'public'

Rector\Rector\Argument\ArgumentAdderRector:
Rector\Core\Rector\Argument\ArgumentAdderRector:
$positionWithDefaultValueByMethodNamesByClassTypes:
Illuminate\Auth\Middleware\Authenticate:
authenticate:
Expand All @@ -23,7 +23,7 @@ services:

Rector\Laravel\Rector\StaticCall\Redirect301ToPermanentRedirectRector: null

Rector\Rector\Argument\ArgumentRemoverRector:
Rector\Core\Rector\Argument\ArgumentRemoverRector:
$positionsByMethodNameByClassType:
Illuminate\Foundation\Application:
register:
Expand Down
4 changes: 2 additions & 2 deletions config/set/laravel/laravel58.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ imports:
services:
Rector\Laravel\Rector\StaticCall\MinutesToSecondsInCacheRector: null

Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector:
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
Illuminate\Contracts\Cache\Repository:
put: 'bool'
Expand All @@ -17,7 +17,7 @@ services:
putMany: 'bool'
forever: 'bool'

Rector\Rector\Property\RenamePropertyRector:
Rector\Core\Rector\Property\RenamePropertyRector:
$oldToNewPropertyByTypes:
Illuminate\Routing\UrlGenerator:
cachedSchema: 'cachedScheme'

0 comments on commit 9e152e7

Please sign in to comment.