from YAML to PHP sets

This commit is contained in:
TomasVotruba 2020-07-18 18:57:24 +02:00
parent 7fc58e8da1
commit bc0d9b3675
288 changed files with 7882 additions and 5403 deletions

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
# trailing whitespaces
#see https://stackoverflow.com/questions/2320564/sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd-osx
if sed --version >/dev/null 2>&1; then
#GNU sed (common to linux)
sed -i -E 's#\s+$##g' config/set/*/*.yaml docs/*.md README.md;
else
#BSD sed (common to osX)
sed -i '' -E 's#\\s+$##g' config/set/*/*.yaml docs/*.md README.md
fi

View File

@ -264,10 +264,7 @@
"bin/rector check-static-type-mappers"
],
"check-cs": "vendor/bin/ecs check --ansi",
"fix-cs": [
"vendor/bin/ecs check --fix --ansi",
"ci/clean_trailing_spaces.sh"
],
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
"changelog": [
"vendor/bin/changelog-linker dump-merges --in-categories --ansi",

View File

@ -14,6 +14,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/parameters/parameter_name_guard.php');
# @todo convert
$containerConfigurator->import(__DIR__ . '/../utils/**/config/config.yaml', null, true);
$parameters = $containerConfigurator->parameters();

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Architecture\DependencyInjection\ActionInjectionToConstructorInjectionRector;
use Rector\Core\Rector\Architecture\DependencyInjection\ReplaceVariableByPropertyFetchRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ActionInjectionToConstructorInjectionRector::class);
$services->set(ReplaceVariableByPropertyFetchRector::class);
};

View File

@ -1,3 +0,0 @@
services:
Rector\Core\Rector\Architecture\DependencyInjection\ActionInjectionToConstructorInjectionRector: null
Rector\Core\Rector\Architecture\DependencyInjection\ReplaceVariableByPropertyFetchRector: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\Architecture\Rector\Class_\ConstructorInjectionToActionInjectionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ConstructorInjectionToActionInjectionRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\Architecture\Rector\Class_\ConstructorInjectionToActionInjectionRector: null

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
use Rector\Architecture\Rector\Class_\MoveRepositoryFromParentToConstructorRector;
use Rector\Architecture\Rector\MethodCall\ReplaceParentRepositoryCallsByRepositoryPropertyRector;
use Rector\Architecture\Rector\MethodCall\ServiceLocatorToDIRector;
use Rector\Doctrine\Rector\Class_\RemoveRepositoryFromEntityAnnotationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# order matters, this needs to be first to correctly detect parent repository
$services->set(MoveRepositoryFromParentToConstructorRector::class);
$services->set(ServiceLocatorToDIRector::class);
$services->set(ReplaceParentRepositoryCallsByRepositoryPropertyRector::class);
$services->set(RemoveRepositoryFromEntityAnnotationRector::class);
};

View File

@ -1,7 +0,0 @@
services:
# order matters, this needs to be first to correctly detect parent repository
Rector\Architecture\Rector\Class_\MoveRepositoryFromParentToConstructorRector: null
Rector\Architecture\Rector\MethodCall\ServiceLocatorToDIRector: null
Rector\Architecture\Rector\MethodCall\ReplaceParentRepositoryCallsByRepositoryPropertyRector: null
Rector\Doctrine\Rector\Class_\RemoveRepositoryFromEntityAnnotationRector: null

View File

@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
use Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ArrayToFluentCallRector::class)
->arg('$configurableClasses', [
'Cake\ORM\Association' => [
'bindingKey' => 'setBindingKey',
'cascadeCallbacks' => 'setCascadeCallbacks',
'className' => 'setClassName',
'conditions' => 'setConditions',
'dependent' => 'setDependent',
'finder' => 'setFinder',
'foreignKey' => 'setForeignKey',
'joinType' => 'setJoinType',
'propertyName' => 'setProperty',
'sourceTable' => 'setSource',
'strategy' => 'setStrategy',
'targetTable' => 'setTarget',
# BelongsToMany and HasMany only
'saveStrategy' => 'setSaveStrategy',
'sort' => 'setSort',
# BelongsToMany only
'targetForeignKey' => 'setTargetForeignKey',
'through' => 'setThrough',
],
'Cake\ORM\Query' => [
'fields' => 'select',
'conditions' => 'where',
'join' => 'join',
'order' => 'order',
'limit' => 'limit',
'offset' => 'offset',
'group' => 'group',
'having' => 'having',
'contain' => 'contain',
'page' => 'page',
],
])
->arg('$factoryMethods', [
'Cake\ORM\Table' => [
'belongsTo' => [
'argumentPosition' => 2,
'class' => 'Cake\ORM\Association',
],
'belongsToMany' => [
'argumentPosition' => 2,
'class' => 'Cake\ORM\Association',
],
'hasMany' => [
'argumentPosition' => 2,
'class' => 'Cake\ORM\Association',
],
'hasOne' => [
'argumentPosition' => 2,
'class' => 'Cake\ORM\Association',
],
'find' => [
'argumentPosition' => 2,
'class' => 'Cake\ORM\Query',
],
],
]);
};

View File

@ -1,54 +0,0 @@
services:
Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector:
$configurableClasses:
'Cake\ORM\Association':
bindingKey: setBindingKey
cascadeCallbacks: setCascadeCallbacks
className: setClassName
conditions: setConditions
dependent: setDependent
finder: setFinder
foreignKey: setForeignKey
joinType: setJoinType
propertyName: setProperty
sourceTable: setSource
strategy: setStrategy
targetTable: setTarget
# BelongsToMany and HasMany only
saveStrategy: setSaveStrategy
sort: setSort
# BelongsToMany only
targetForeignKey: setTargetForeignKey
through: setThrough
'Cake\ORM\Query':
fields: select
conditions: where
join: join
order: order
limit: limit
offset: offset
group: group
having: having
contain: contain
page: page
$factoryMethods:
'Cake\ORM\Table':
belongsTo:
argumentPosition: 2
class: 'Cake\ORM\Association'
belongsToMany:
argumentPosition: 2
class: 'Cake\ORM\Association'
hasMany:
argumentPosition: 2
class: 'Cake\ORM\Association'
hasOne:
argumentPosition: 2
class: 'Cake\ORM\Association'
find:
argumentPosition: 2
class: 'Cake\ORM\Query'

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
use Rector\CakePHP\Rector\Name\ImplicitShortClassNameUseStatementRector;
use Rector\CakePHP\Rector\StaticCall\AppUsesStaticCallToUseStatementRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# @see https://github.com/cakephp/upgrade/tree/master/src/Shell/Task
$services->set(AppUsesStaticCallToUseStatementRector::class);
$services->set(ImplicitShortClassNameUseStatementRector::class);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
#L37
# see https://github.com/cakephp/upgrade/blob/756410c8b7d5aff9daec3fa1fe750a3858d422ac/src/Shell/Task/RenameClassesTask.php
'Cake\Network\Http\HttpSocket' => 'Cake\Network\Http\Client',
'Cake\Model\ConnectionManager' => 'Cake\Database\ConnectionManager',
'Cake\TestSuite\CakeTestCase' => 'Cake\TestSuite\TestCase',
'Cake\TestSuite\Fixture\CakeTestFixture' => 'Cake\TestSuite\Fixture\TestFixture',
'Cake\Utility\String' => 'Cake\Utility\Text',
'CakePlugin' => 'Plugin',
'CakeException' => 'Exception',
#configure
# see https://book.cakephp.org/3/en/appendices/3-0-migration-guide.html
'Cake\Configure\PhpReader' => 'Cake\Core\Configure\EnginePhpConfig',
'Cake\Configure\IniReader' => 'Cake\Core\Configure\EngineIniConfig',
'Cake\Configure\ConfigReaderInterface' => 'Cake\Core\Configure\ConfigEngineInterface',
#request
# https://book.cakephp.org/3/en/appendices/3-0-migration-guide.html
'CakeRequest' => 'Cake\Network\Request',
]);
};

View File

@ -1,23 +0,0 @@
services:
# @see https://github.com/cakephp/upgrade/tree/master/src/Shell/Task
Rector\CakePHP\Rector\StaticCall\AppUsesStaticCallToUseStatementRector: null
Rector\CakePHP\Rector\Name\ImplicitShortClassNameUseStatementRector: null
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
# see https://github.com/cakephp/upgrade/blob/756410c8b7d5aff9daec3fa1fe750a3858d422ac/src/Shell/Task/RenameClassesTask.php#L37
'Cake\Network\Http\HttpSocket': 'Cake\Network\Http\Client'
'Cake\Model\ConnectionManager': 'Cake\Database\ConnectionManager'
'Cake\TestSuite\CakeTestCase': 'Cake\TestSuite\TestCase'
'Cake\TestSuite\Fixture\CakeTestFixture': 'Cake\TestSuite\Fixture\TestFixture'
'Cake\Utility\String': 'Cake\Utility\Text'
'CakePlugin': 'Plugin'
'CakeException': 'Exception'
# see https://book.cakephp.org/3/en/appendices/3-0-migration-guide.html#configure
'Cake\Configure\PhpReader': 'Cake\Core\Configure\EnginePhpConfig'
'Cake\Configure\IniReader': 'Cake\Core\Configure\EngineIniConfig'
'Cake\Configure\ConfigReaderInterface': 'Cake\Core\Configure\ConfigEngineInterface'
# https://book.cakephp.org/3/en/appendices/3-0-migration-guide.html#request
'CakeRequest': 'Cake\Network\Request'

View File

@ -0,0 +1,356 @@
<?php
declare(strict_types=1);
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
use Rector\Core\Rector\MethodBody\NormalToFluentRector;
use Rector\Core\Rector\Property\PropertyToMethodRector;
use Rector\Core\Rector\Property\RenamePropertyRector;
use Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(PropertyToMethodRector::class)
->arg('$perClassPropertyToMethods', [
'Cake\Network\Request' => [
'params' => [
'get' => [
# source: https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html
'method' => 'getAttribute',
'arguments' => ['params'],
],
],
'data' => [
'get' => 'getData',
],
'query' => [
'get' => 'getQueryParams',
],
'cookies' => [
'get' => 'getCookie',
],
'base' => [
'get' => [
'method' => 'getAttribute',
'arguments' => ['base'],
],
],
'webroot' => [
'get' => [
'method' => 'getAttribute',
'arguments' => ['webroot'],
],
],
'here' => [
'get' => [
'method' => 'getAttribute',
'arguments' => ['here'],
],
],
],
]);
$services->set(RenamePropertyRector::class)
->arg('$oldToNewPropertyByTypes', [
'Cake\Network\Request' => [
'_session' => 'session',
],
]);
$services->set(ModalToGetSetRector::class)
->arg('$methodNamesByTypes', [
'Cake\Core\InstanceConfigTrait' => [
'config' => [
'minimal_argument_count' => 2,
'first_argument_type_to_set' => 'array',
],
],
'Cake\Core\StaticConfigTrait' => [
'config' => [
'minimal_argument_count' => 2,
'first_argument_type_to_set' => 'array',
],
'dsnClassMap' => null,
],
'Cake\Console\ConsoleOptionParser' => [
'command' => null,
'description' => null,
'epilog' => null,
],
'Cake\Database\Connection' => [
'driver' => null,
'schemaCollection' => null,
'useSavePoints' => [
'set' => 'enableSavePoints',
'get' => 'isSavePointsEnabled',
],
],
'Cake\Database\Driver' => [
'autoQuoting' => [
'set' => 'enableAutoQuoting',
'get' => 'isAutoQuotingEnabled',
],
],
'Cake\Database\Expression\FunctionExpression' => [
'name' => null,
],
'Cake\Database\Expression\QueryExpression' => [
'tieWith' => [
'set' => 'setConjunction',
'get' => 'getConjunction',
],
],
'Cake\Database\Expression\ValuesExpression' => [
'columns' => null,
'values' => null,
'query' => null,
],
'Cake\Database\Query' => [
'connection' => null,
'selectTypeMap' => null,
'bufferResults' => [
'set' => 'enableBufferedResults',
'get' => 'isBufferedResultsEnabled',
],
],
'Cake\Database\Schema\CachedCollection' => [
'cacheMetadata' => null,
],
'Cake\Database\Schema\TableSchema' => [
'options' => null,
'temporary' => [
'set' => 'setTemporary',
'get' => 'isTemporary',
],
],
'Cake\Database\TypeMap' => [
'defaults' => null,
'types' => null,
],
'Cake\Database\TypeMapTrait' => [
'typeMap' => null,
'defaultTypes' => null,
],
'Cake\ORM\Association' => [
'name' => null,
'cascadeCallbacks' => null,
'source' => null,
'target' => null,
'conditions' => null,
'bindingKey' => null,
'foreignKey' => null,
'dependent' => null,
'joinType' => null,
'property' => null,
'strategy' => null,
'finder' => null,
],
'Cake\ORM\Association\BelongsToMany' => [
'targetForeignKey' => null,
'saveStrategy' => null,
'conditions' => null,
],
'Cake\ORM\Association\HasMany' => [
'saveStrategy' => null,
'foreignKey' => null,
'sort' => null,
],
'Cake\ORM\Association\HasOne' => [
'foreignKey' => null,
],
'Cake\ORM\EagerLoadable' => [
'config' => null,
'canBeJoined' => [
'set' => 'setCanBeJoined',
'get' => 'canBeJoined',
],
],
'Cake\ORM\EagerLoader' => [
# note: will have to be called after setMatching() to keep the old behavior
#L330
# ref: https://github.com/cakephp/cakephp/blob/4feee5463641e05c068b4d1d31dc5ee882b4240f/src/ORM/EagerLoader.php
'matching' => [
'set' => 'setMatching',
'get' => 'getMatching',
],
'autoFields' => [
'set' => 'enableAutoFields',
'get' => 'isAutoFieldsEnabled',
],
],
'Cake\ORM\Locator\TableLocator' => [
'config' => null,
],
'Cake\ORM\Query' => [
'eagerLoader' => null,
'hydrate' => [
'set' => 'enableHydration',
'get' => 'isHydrationEnabled',
],
'autoFields' => [
'set' => 'enableAutoFields',
'get' => 'isAutoFieldsEnabled',
],
],
'Cake\ORM\Table' => [
'table' => null,
'alias' => null,
'registryAlias' => null,
'connection' => null,
'schema' => null,
'primaryKey' => null,
'displayField' => null,
'entityClass' => null,
],
'Cake\Mailer\Email' => [
'from' => null,
'sender' => null,
'replyTo' => null,
'readReceipt' => null,
'returnPath' => null,
'to' => null,
'cc' => null,
'bcc' => null,
'charset' => null,
'headerCharset' => null,
'emailPattern' => null,
'subject' => null,
'viewRender' => [
# template: have to be changed manually, non A → B change + array case
'set' => 'setViewRenderer',
'get' => 'getViewRenderer',
],
'viewVars' => null,
'theme' => null,
'helpers' => null,
'emailFormat' => null,
'transport' => null,
'messageId' => null,
'domain' => null,
'attachments' => null,
'configTransport' => null,
'profile' => null,
],
'Cake\Validation\Validator' => [
'provider' => null,
],
'Cake\View\StringTemplateTrait' => [
'templates' => null,
],
'Cake\View\ViewBuilder' => [
'templatePath' => null,
'layoutPath' => null,
'plugin' => null,
'helpers' => null,
'theme' => null,
'template' => null,
'layout' => null,
'options' => null,
'name' => null,
'className' => null,
'autoLayout' => [
'set' => 'enableAutoLayout',
'get' => 'isAutoLayoutEnabled',
],
],
]);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Cake\Network\Request' => [
'param' => 'getParam',
'data' => 'getData',
'query' => 'getQuery',
'cookie' => 'getCookie',
'method' => 'getMethod',
'setInput' => 'withBody',
],
'Cake\Network\Response' => [
'location' => 'withLocation',
'disableCache' => 'withDisabledCache',
'type' => 'withType',
'charset' => 'withCharset',
'cache' => 'withCache',
'modified' => 'withModified',
'expires' => 'withExpires',
'sharable' => 'withSharable',
'maxAge' => 'withMaxAge',
'vary' => 'withVary',
'etag' => 'withEtag',
'compress' => 'withCompression',
'length' => 'withLength',
'mustRevalidate' => 'withMustRevalidate',
'notModified' => 'withNotModified',
'cookie' => 'withCookie',
'file' => 'withFile',
'download' => 'withDownload',
# psr-7
'header' => 'getHeader',
'body' => 'withBody',
'statusCode' => 'getStatusCode',
'protocol' => 'getProtocolVersion',
],
'Cake\Event\Event' => [
'name' => 'getName',
'subject' => 'getSubject',
'result' => 'getResult',
'data' => 'getData',
],
'Cake\View\Helper\FormHelper' => [
'input' => 'control',
'inputs' => 'controls',
'allInputs' => 'allControls',
],
'Cake\Mailer\Mailer' => [
'layout' => 'setLayout',
],
'Cake\Routing\Route\Route' => [
'parse' => 'parseRequest',
],
'Cake\Routing\Router' => [
'parse' => 'parseRequest',
],
]);
$services->set(ChangeMethodVisibilityRector::class)
->arg('$methodToVisibilityByClass', [
'Cake\Mailer\MailerAwareTrait' => [
'getMailer' => 'protected',
],
'Cake\View\CellTrait' => [
'cell' => 'protected',
],
]);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', ['Cake\Database\Schema\Table' => 'Cake\Database\Schema\TableSchema']);
$services->set(NormalToFluentRector::class)
->arg('$fluentMethodsByType', [
'Cake\Network\Response' => [
'withLocation',
'withHeader',
'withDisabledCache',
'withType',
'withCharset',
'withCache',
'withModified',
'withExpires',
'withSharable',
'withMaxAge',
'withVary',
'withEtag',
'withCompression',
'withLength',
'withMustRevalidate',
'withNotModified',
'withCookie',
'withFile',
'withDownload',
],
]);
};

View File

@ -1,274 +0,0 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html
services:
Rector\Core\Rector\Property\PropertyToMethodRector:
$perClassPropertyToMethods:
Cake\Network\Request:
params:
get:
method: 'getAttribute'
arguments: ['params']
data:
get: 'getData'
query:
get: 'getQueryParams'
cookies:
get: 'getCookie'
base:
get:
method: 'getAttribute'
arguments: ['base']
webroot:
get:
method: 'getAttribute'
arguments: ['webroot']
here:
get:
method: 'getAttribute'
arguments: ['here']
Rector\Core\Rector\Property\RenamePropertyRector:
$oldToNewPropertyByTypes:
Cake\Network\Request:
_session: 'session'
Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector:
$methodNamesByTypes:
Cake\Core\InstanceConfigTrait:
config:
minimal_argument_count: 2
first_argument_type_to_set: array
Cake\Core\StaticConfigTrait:
config:
minimal_argument_count: 2
first_argument_type_to_set: array
dsnClassMap: null
Cake\Console\ConsoleOptionParser:
command: null
description: null
epilog: null
Cake\Database\Connection:
driver: null
schemaCollection: null
useSavePoints:
set: 'enableSavePoints'
get: 'isSavePointsEnabled'
Cake\Database\Driver:
autoQuoting:
set: 'enableAutoQuoting'
get: 'isAutoQuotingEnabled'
Cake\Database\Expression\FunctionExpression:
name: null
Cake\Database\Expression\QueryExpression:
tieWith:
set: 'setConjunction'
get: 'getConjunction'
Cake\Database\Expression\ValuesExpression:
columns: null
values: null
query: null
Cake\Database\Query:
connection: null
selectTypeMap: null
bufferResults:
set: 'enableBufferedResults'
get: 'isBufferedResultsEnabled'
Cake\Database\Schema\CachedCollection:
cacheMetadata: null
Cake\Database\Schema\TableSchema:
options: null
temporary:
set: 'setTemporary'
get: 'isTemporary'
Cake\Database\TypeMap:
defaults: null
types: null
Cake\Database\TypeMapTrait:
typeMap: null
defaultTypes: null
Cake\ORM\Association:
name: null
cascadeCallbacks: null
source: null
target: null
conditions: null
bindingKey: null
foreignKey: null
dependent: null
joinType: null
property: null
strategy: null
finder: null
Cake\ORM\Association\BelongsToMany:
targetForeignKey: null
saveStrategy: null
conditions: null
Cake\ORM\Association\HasMany:
saveStrategy: null
foreignKey: null
sort: null
Cake\ORM\Association\HasOne:
foreignKey: null
Cake\ORM\EagerLoadable:
config: null
canBeJoined:
set: 'setCanBeJoined'
get: 'canBeJoined'
Cake\ORM\EagerLoader:
matching:
set: 'setMatching'
get: 'getMatching'
# note: will have to be called after setMatching() to keep the old behavior
# ref: https://github.com/cakephp/cakephp/blob/4feee5463641e05c068b4d1d31dc5ee882b4240f/src/ORM/EagerLoader.php#L330
autoFields:
set: 'enableAutoFields'
get: 'isAutoFieldsEnabled'
Cake\ORM\Locator\TableLocator:
config: null
Cake\ORM\Query:
eagerLoader: null
hydrate:
set: 'enableHydration'
get: 'isHydrationEnabled'
autoFields:
set: 'enableAutoFields'
get: 'isAutoFieldsEnabled'
Cake\ORM\Table:
table: null
alias: null
registryAlias: null
connection: null
schema: null
primaryKey: null
displayField: null
entityClass: null
Cake\Mailer\Email:
from: null
sender: null
replyTo: null
readReceipt: null
returnPath: null
to: null
cc: null
bcc: null
charset: null
headerCharset: null
emailPattern: null
subject: null
# template: have to be changed manually, non A → B change + array case
viewRender:
set: 'setViewRenderer'
get: 'getViewRenderer'
viewVars: null
theme: null
helpers: null
emailFormat: null
transport: null
messageId: null
domain: null
attachments: null
configTransport: null
profile: null
Cake\Validation\Validator:
provider: null
Cake\View\StringTemplateTrait:
templates: null
Cake\View\ViewBuilder:
templatePath: null
layoutPath: null
plugin: null
helpers: null
theme: null
template: null
layout: null
options: null
name: null
className: null
autoLayout:
set: 'enableAutoLayout'
get: 'isAutoLayoutEnabled'
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Cake\Network\Request':
param: 'getParam'
data: 'getData'
query: 'getQuery'
cookie: 'getCookie'
method: 'getMethod'
setInput: 'withBody'
'Cake\Network\Response':
location: 'withLocation'
disableCache: 'withDisabledCache'
type: 'withType'
charset: 'withCharset'
cache: 'withCache'
modified: 'withModified'
expires: 'withExpires'
sharable: 'withSharable'
maxAge: 'withMaxAge'
vary: 'withVary'
etag: 'withEtag'
compress: 'withCompression'
length: 'withLength'
mustRevalidate: 'withMustRevalidate'
notModified: 'withNotModified'
cookie: 'withCookie'
file: 'withFile'
download: 'withDownload'
# psr-7
header: 'getHeader'
body: 'withBody'
statusCode: 'getStatusCode'
protocol: 'getProtocolVersion'
'Cake\Event\Event':
'name': 'getName'
'subject': 'getSubject'
'result': 'getResult'
'data': 'getData'
'Cake\View\Helper\FormHelper':
input: 'control'
inputs: 'controls'
allInputs: 'allControls'
'Cake\Mailer\Mailer':
layout: 'setLayout'
'Cake\Routing\Route\Route':
parse: 'parseRequest'
'Cake\Routing\Router':
parse: 'parseRequest'
Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector:
$methodToVisibilityByClass:
'Cake\Mailer\MailerAwareTrait':
getMailer: 'protected'
'Cake\View\CellTrait':
cell: 'protected'
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Cake\Database\Schema\Table': 'Cake\Database\Schema\TableSchema'
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
# renames are done by RenameMethodRector above
- 'withLocation'
- 'withHeader'
- 'withDisabledCache'
- 'withType'
- 'withCharset'
- 'withCache'
- 'withModified'
- 'withExpires'
- 'withSharable'
- 'withMaxAge'
- 'withVary'
- 'withEtag'
- 'withCompression'
- 'withLength'
- 'withMustRevalidate'
- 'withNotModified'
- 'withCookie'
- 'withFile'
- 'withDownload'

View File

@ -0,0 +1,136 @@
<?php
declare(strict_types=1);
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# source: https://book.cakephp.org/3.0/en/appendices/3-5-migration-guide.html
'Cake\Http\Client\CookieCollection' => 'Cake\Http\Cookie\CookieCollection',
'Cake\Console\ShellDispatcher' => 'Cake\Console\CommandRunner',
]);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Cake\Database\Schema\TableSchema' => [
'column' => 'getColumn',
'constraint' => 'getConstraint',
'index' => 'getIndex',
],
]);
$services->set(ModalToGetSetRector::class)
->arg('$methodNamesByTypes', [
'Cake\Cache\Cache' => [
'config' => null,
'registry' => null,
],
'Cake\Console\Shell' => [
'io' => null,
],
'Cake\Console\ConsoleIo' => [
'outputAs' => null,
],
'Cake\Console\ConsoleOutput' => [
'outputAs' => null,
],
'Cake\Database\Connection' => [
'logger' => null,
],
'Cake\Database\TypedResultInterface' => [
'returnType' => null,
],
'Cake\Database\TypedResultTrait' => [
'returnType' => null,
],
'Cake\Database\Log\LoggingStatement' => [
'logger' => null,
],
'Cake\Datasource\ModelAwareTrait' => [
'modelType' => null,
],
'Cake\Database\Query' => [
'valueBinder' => [
'get' => 'getValueBinder',
'set' => 'valueBinder',
],
],
'Cake\Database\Schema\TableSchema' => [
'columnType' => null,
],
'Cake\Datasource\QueryTrait' => [
'eagerLoaded' => [
'get' => 'isEagerLoaded',
'set' => 'eagerLoaded',
],
],
'Cake\Event\EventDispatcherInterface' => [
'eventManager' => null,
],
'Cake\Event\EventDispatcherTrait' => [
'eventManager' => null,
],
'Cake\Error\Debugger' => [
'outputAs' => [
'get' => 'getOutputFormat',
'set' => 'setOutputFormat',
],
],
'Cake\Http\ServerRequest' => [
'env' => [
'get' => 'getEnv',
'set' => 'withEnv',
],
'charset' => [
'get' => 'getCharset',
'set' => 'withCharset',
],
],
'Cake\I18n\I18n' => [
'locale' => null,
'translator' => null,
'defaultLocale' => null,
'defaultFormatter' => null,
],
'Cake\ORM\Association\BelongsToMany' => [
'sort' => null,
],
'Cake\ORM\LocatorAwareTrait' => [
'tableLocator' => null,
],
'Cake\ORM\Table' => [
'validator' => null,
],
'Cake\Routing\RouteBuilder' => [
'extensions' => null,
'routeClass' => null,
],
'Cake\Routing\RouteCollection' => [
'extensions' => null,
],
'Cake\TestSuite\TestFixture' => [
'schema' => null,
],
'Cake\Utility\Security' => [
'salt' => null,
],
'Cake\View\View' => [
'template' => null,
'layout' => null,
'theme' => null,
'templatePath' => null,
'layoutPath' => null,
'autoLayout' => [
'get' => 'isAutoLayoutEnabled',
'set' => 'enableAutoLayout',
],
],
]);
};

View File

@ -1,90 +0,0 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-5-migration-guide.html
services:
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Cake\Http\Client\CookieCollection': 'Cake\Http\Cookie\CookieCollection'
'Cake\Console\ShellDispatcher': 'Cake\Console\CommandRunner'
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Cake\Database\Schema\TableSchema':
column: 'getColumn'
constraint: 'getConstraint'
index: 'getIndex'
Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector:
$methodNamesByTypes:
'Cake\Cache\Cache':
config: null
registry: null
'Cake\Console\Shell':
io: null
'Cake\Console\ConsoleIo':
outputAs: null
'Cake\Console\ConsoleOutput':
outputAs: null
'Cake\Database\Connection':
logger: null
'Cake\Database\TypedResultInterface':
returnType: null
'Cake\Database\TypedResultTrait':
returnType: null
'Cake\Database\Log\LoggingStatement':
logger: null
'Cake\Datasource\ModelAwareTrait':
modelType: null
'Cake\Database\Query':
'valueBinder':
get: 'getValueBinder'
set: 'valueBinder'
'Cake\Database\Schema\TableSchema':
columnType: null
'Cake\Datasource\QueryTrait':
'eagerLoaded':
get: 'isEagerLoaded'
set: 'eagerLoaded'
'Cake\Event\EventDispatcherInterface':
eventManager: null
'Cake\Event\EventDispatcherTrait':
eventManager: null
'Cake\Error\Debugger':
'outputAs':
get: 'getOutputFormat'
set: 'setOutputFormat'
'Cake\Http\ServerRequest':
'env':
get: 'getEnv'
set: 'withEnv'
'charset':
get: 'getCharset'
set: 'withCharset'
'Cake\I18n\I18n':
locale: null
translator: null
defaultLocale: null
defaultFormatter: null
'Cake\ORM\Association\BelongsToMany':
sort: null
'Cake\ORM\LocatorAwareTrait':
tableLocator: null
'Cake\ORM\Table':
validator: null
'Cake\Routing\RouteBuilder':
extensions: null
routeClass: null
'Cake\Routing\RouteCollection':
extensions: null
'Cake\TestSuite\TestFixture':
schema: null
'Cake\Utility\Security':
salt: null
'Cake\View\View':
template: null
layout: null
theme: null
templatePath: null
layoutPath: null
autoLayout:
get: 'isAutoLayoutEnabled'
set: 'enableAutoLayout'

View File

@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Property\PropertyToMethodRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Cake\ORM\Table' => [
# source: https://book.cakephp.org/3.0/en/appendices/3-6-migration-guide.html
'association' => 'getAssociation',
],
'Cake\Validation\ValidationSet' => [
'isPresenceRequired' => 'requirePresence',
'isEmptyAllowed' => 'allowEmpty',
],
]);
$services->set(PropertyToMethodRector::class)
->arg('$perClassPropertyToMethods', [
'Cake\Controller\Controller' => [
'name' => [
'get' => 'getName',
'set' => 'setName',
],
'plugin' => [
'get' => 'getPlugin',
'set' => 'setPlugin',
],
],
'Cake\Form\Form' => [
'validator' => [
'get' => 'getValidator',
'set' => 'setValidator',
],
],
]);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
'Cake\Cache\Engine\ApcEngine' => 'Cake\Cache\Engine\ApcuEngine',
'Cake\Network\Exception\BadRequestException' => 'Cake\Http\Exception\BadRequestException',
'Cake\Network\Exception\ConflictException' => 'Cake\Http\Exception\ConflictException',
'Cake\Network\Exception\ForbiddenException' => 'Cake\Http\Exception\ForbiddenException',
'Cake\Network\Exception\GoneException' => 'Cake\Http\Exception\GoneException',
'Cake\Network\Exception\HttpException' => 'Cake\Http\Exception\HttpException',
'Cake\Network\Exception\InternalErrorException' => 'Cake\Http\Exception\InternalErrorException',
'Cake\Network\Exception\InvalidCsrfTokenException' => 'Cake\Http\Exception\InvalidCsrfTokenException',
'Cake\Network\Exception\MethodNotAllowedException' => 'Cake\Http\Exception\MethodNotAllowedException',
'Cake\Network\Exception\NotAcceptableException' => 'Cake\Http\Exception\NotAcceptableException',
'Cake\Network\Exception\NotFoundException' => 'Cake\Http\Exception\NotFoundException',
'Cake\Network\Exception\NotImplementedException' => 'Cake\Http\Exception\NotImplementedException',
'Cake\Network\Exception\ServiceUnavailableException' => 'Cake\Http\Exception\ServiceUnavailableException',
'Cake\Network\Exception\UnauthorizedException' => 'Cake\Http\Exception\UnauthorizedException',
'Cake\Network\Exception\UnavailableForLegalReasonsException' => 'Cake\Http\Exception\UnavailableForLegalReasonsException',
'Cake\Network\Session' => 'Cake\Http\Session',
'Cake\Network\Session\DatabaseSession' => 'Cake\Http\Session\DatabaseSession',
'Cake\Network\Session\CacheSession' => 'Cake\Http\Session\CacheSession',
'Cake\Network\CorsBuilder' => 'Cake\Http\CorsBuilder',
'Cake\View\Widget\WidgetRegistry' => 'Cake\View\Widget\WidgetLocator',
]);
};

View File

@ -1,47 +0,0 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-6-migration-guide.html
services:
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Cake\ORM\Table':
'association': 'getAssociation'
'Cake\Validation\ValidationSet':
'isPresenceRequired': 'requirePresence'
'isEmptyAllowed': 'allowEmpty'
Rector\Core\Rector\Property\PropertyToMethodRector:
$perClassPropertyToMethods:
'Cake\Controller\Controller':
'name':
'get': 'getName'
'set': 'setName'
'plugin':
'get': 'getPlugin'
'set': 'setPlugin'
'Cake\Form\Form':
'validator':
'get': 'getValidator'
'set': 'setValidator'
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Cake\Cache\Engine\ApcEngine': 'Cake\Cache\Engine\ApcuEngine'
'Cake\Network\Exception\BadRequestException': 'Cake\Http\Exception\BadRequestException'
'Cake\Network\Exception\ConflictException': 'Cake\Http\Exception\ConflictException'
'Cake\Network\Exception\ForbiddenException': 'Cake\Http\Exception\ForbiddenException'
'Cake\Network\Exception\GoneException': 'Cake\Http\Exception\GoneException'
'Cake\Network\Exception\HttpException': 'Cake\Http\Exception\HttpException'
'Cake\Network\Exception\InternalErrorException': 'Cake\Http\Exception\InternalErrorException'
'Cake\Network\Exception\InvalidCsrfTokenException': 'Cake\Http\Exception\InvalidCsrfTokenException'
'Cake\Network\Exception\MethodNotAllowedException': 'Cake\Http\Exception\MethodNotAllowedException'
'Cake\Network\Exception\NotAcceptableException': 'Cake\Http\Exception\NotAcceptableException'
'Cake\Network\Exception\NotFoundException': 'Cake\Http\Exception\NotFoundException'
'Cake\Network\Exception\NotImplementedException': 'Cake\Http\Exception\NotImplementedException'
'Cake\Network\Exception\ServiceUnavailableException': 'Cake\Http\Exception\ServiceUnavailableException'
'Cake\Network\Exception\UnauthorizedException': 'Cake\Http\Exception\UnauthorizedException'
'Cake\Network\Exception\UnavailableForLegalReasonsException': 'Cake\Http\Exception\UnavailableForLegalReasonsException'
'Cake\Network\Session': 'Cake\Http\Session'
'Cake\Network\Session\DatabaseSession': 'Cake\Http\Session\DatabaseSession'
'Cake\Network\Session\CacheSession': 'Cake\Http\Session\CacheSession'
'Cake\Network\CorsBuilder': 'Cake\Http\CorsBuilder'
'Cake\View\Widget\WidgetRegistry': 'Cake\View\Widget\WidgetLocator'

View File

@ -0,0 +1,134 @@
<?php
declare(strict_types=1);
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
use Rector\CakePHP\Rector\Name\ChangeSnakedFixtureNameToCamelRector;
use Rector\Core\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector;
use Rector\Core\Rector\Property\PropertyToMethodRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Cake\Form\Form' => [
# source: https://book.cakephp.org/3.0/en/appendices/3-7-migration-guide.html
'errors' => 'getErrors',
],
'Cake\Validation\Validation' => [
'cc' => 'creditCard',
],
'Cake\Filesystem\Folder' => [
'normalizePath' => 'correctSlashFor',
],
'Cake\Http\Client\Response' => [
'body' => 'getStringBody',
],
'Cake\Core\Plugin' => [
'unload' => 'clear',
],
]);
$services->set(PropertyToMethodRector::class)
->arg('$perClassPropertyToMethods', [
'Cake\Http\Client\Response' => [
'body' => [
'get' => 'getStringBody',
],
'json' => [
'get' => 'getJson',
],
'xml' => [
'get' => 'getXml',
],
'cookies' => [
'get' => 'getCookies',
],
'code' => [
'get' => 'getStatusCode',
],
],
'Cake\View\View' => [
'request' => [
'get' => 'getRequest',
'set' => 'setRequest',
],
'response' => [
'get' => 'getResponse',
'set' => 'setResponse',
],
'templatePath' => [
'get' => 'getTemplatePath',
'set' => 'setTemplatePath',
],
'template' => [
'get' => 'getTemplate',
'set' => 'setTemplate',
],
'layout' => [
'get' => 'getLayout',
'set' => 'setLayout',
],
'layoutPath' => [
'get' => 'getLayoutPath',
'set' => 'setLayoutPath',
],
'autoLayout' => [
'get' => 'enableAutoLayout',
'set' => 'isAutoLayoutEnabled',
],
'theme' => [
'get' => 'getTheme',
'set' => 'setTheme',
],
'subDir' => [
'get' => 'getSubDir',
'set' => 'setSubDir',
],
'plugin' => [
'get' => 'getPlugin',
'set' => 'setPlugin',
],
'name' => [
'get' => 'getName',
'set' => 'setName',
],
'elementCache' => [
'get' => 'getElementCache',
'set' => 'setElementCache',
],
'helpers' => [
'get' => 'helpers',
],
],
]);
$services->set(MethodCallToAnotherMethodCallWithArgumentsRector::class)
->arg('$oldMethodsToNewMethodsWithArgsByType', [
'Cake\Database\Query' => [
'join' => ['clause', ['join']],
'from' => ['clause', ['from']],
],
]);
$services->set(ModalToGetSetRector::class)
->arg('$methodNamesByTypes', [
'Cake\Database\Connection' => [
'logQueries' => [
'set' => 'enableQueryLogging',
'get' => 'isQueryLoggingEnabled',
],
],
'Cake\ORM\Association' => [
'className' => [
'set' => 'setClassName',
'get' => 'getClassName',
],
],
]);
$services->set(ChangeSnakedFixtureNameToCamelRector::class);
};

View File

@ -1,87 +0,0 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-7-migration-guide.html
services:
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Cake\Form\Form':
'errors': 'getErrors'
'Cake\Validation\Validation':
cc: 'creditCard'
'Cake\Filesystem\Folder':
normalizePath: 'correctSlashFor'
'Cake\Http\Client\Response':
body: 'getStringBody'
'Cake\Core\Plugin':
unload: 'clear'
Rector\Core\Rector\Property\PropertyToMethodRector:
$perClassPropertyToMethods:
'Cake\Http\Client\Response':
body:
get: 'getStringBody'
json:
get: 'getJson'
xml:
get: 'getXml'
cookies:
get: 'getCookies'
code:
get: 'getStatusCode'
'Cake\View\View':
request:
get: 'getRequest'
set: 'setRequest'
response:
get: 'getResponse'
set: 'setResponse'
templatePath:
get: 'getTemplatePath'
set: 'setTemplatePath'
template:
get: 'getTemplate'
set: 'setTemplate'
layout:
get: 'getLayout'
set: 'setLayout'
layoutPath:
get: 'getLayoutPath'
set: 'setLayoutPath'
autoLayout:
get: 'enableAutoLayout'
set: 'isAutoLayoutEnabled'
theme:
get: 'getTheme'
set: 'setTheme'
subDir:
get: 'getSubDir'
set: 'setSubDir'
plugin:
get: 'getPlugin'
set: 'setPlugin'
name:
get: 'getName'
set: 'setName'
elementCache:
get: 'getElementCache'
set: 'setElementCache'
helpers:
get: 'helpers'
Rector\Core\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector:
$oldMethodsToNewMethodsWithArgsByType:
'Cake\Database\Query':
join: ['clause', ['join']]
from: ['clause', ['from']]
Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector:
$methodNamesByTypes:
'Cake\Database\Connection':
logQueries:
set: 'enableQueryLogging'
get: 'isQueryLoggingEnabled'
'Cake\ORM\Association':
className:
set: 'setClassName'
get: 'getClassName'
Rector\CakePHP\Rector\Name\ChangeSnakedFixtureNameToCamelRector: null

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Cake\ORM\Entity' => [
# source: https://book.cakephp.org/3.0/en/appendices/3-8-migration-guide.html
'visibleProperties' => 'getVisible',
],
]);
};

View File

@ -1,7 +0,0 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-8-migration-guide.html
services:
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Cake\ORM\Entity':
'visibleProperties': 'getVisible'

View File

@ -0,0 +1,190 @@
<?php
declare(strict_types=1);
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
use Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector;
use Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\Core\Rector\Property\RenamePropertyRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\Constant\RenameClassConstantRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\MethodCall\RenameStaticMethodRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# source: https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html
'Cake\Database\Type' => 'Cake\Database\TypeFactory',
'Cake\Console\ConsoleErrorHandler' => 'Cake\Error\ConsoleErrorHandler',
]);
$services->set(RenameClassConstantRector::class)
->arg('$oldToNewConstantsByClass', [
'Cake\View\View' => [
'NAME_ELEMENT' => 'TYPE_ELEMENT',
'NAME_LAYOUT' => 'TYPE_LAYOUT',
],
'Cake\Mailer\Email' => [
'MESSAGE_HTML' => 'Cake\Mailer\Message::MESSAGE_HTML',
'MESSAGE_TEXT' => 'Cake\Mailer\Message::MESSAGE_TEXT',
'MESSAGE_BOTH' => 'Cake\Mailer\Message::MESSAGE_BOTH',
'EMAIL_PATTERN' => 'Cake\Mailer\Message::EMAIL_PATTERN',
],
]);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Cake\Form\Form' => [
'errors' => 'getErrors',
],
'Cake\Mailer\Email' => [
'set' => 'setViewVars',
],
'Cake\ORM\EntityInterface' => [
'unsetProperty' => 'unset',
],
'Cake\Cache\Cache' => [
'engine' => 'pool',
],
'Cake\Http\Cookie\Cookie' => [
'getStringValue' => 'getScalarValue',
],
'Cake\Validation\Validator' => [
'containsNonAlphaNumeric' => 'notAlphaNumeric',
'errors' => 'validate',
],
]);
$services->set(RenameStaticMethodRector::class)
->arg('$oldToNewMethodByClasses', [
'Router' => [
'pushRequest' => 'setRequest',
'setRequestInfo' => 'setRequest',
'setRequestContext' => 'setRequest',
],
]);
$services->set(RenamePropertyRector::class)
->arg('$oldToNewPropertyByTypes', [
'Cake\ORM\Entity' => [
'_properties' => '_fields',
],
]);
$services->set(AddReturnTypeDeclarationRector::class)
->arg('$typehintForMethodByClass', [
'Cake\Http\BaseApplication' => [
'bootstrap' => 'void',
'bootstrapCli' => 'void',
'middleware' => 'Cake\Http\MiddlewareQueue',
],
'Cake\Console\Shell' => [
'initialize' => 'void',
],
'Cake\Controller\Component' => [
'initialize' => 'void',
],
'Cake\Controller\Controller' => [
'initialize' => 'void',
'render' => 'Cake\Http\Response',
],
'Cake\Form\Form' => [
'validate' => 'bool',
'_buildSchema' => 'Cake\Form\Schema',
],
'Cake\ORM\Behavior' => [
'initialize' => 'void',
],
'Cake\ORM\Table' => [
'initialize' => 'void',
'updateAll' => 'int',
'deleteAll' => 'int',
'validationDefault' => 'Cake\Validation\Validator',
'buildRules' => 'Cake\ORM\RulesChecker',
],
'Cake\View\Helper' => [
'initialize' => 'void',
],
]);
$services->set(AddParamTypeDeclarationRector::class)
->arg('$typehintForParameterByMethodByClass', [
'Cake\Form\Form' => [
'getData' => ['?string'],
],
'Cake\ORM\Behavior' => [
'beforeFind' => ['Cake\Event\EventInterface'],
'buildValidator' => ['Cake\Event\EventInterface'],
'buildRules' => ['Cake\Event\EventInterface'],
'beforeRules' => ['Cake\Event\EventInterface'],
'afterRules' => ['Cake\Event\EventInterface'],
'beforeSave' => ['Cake\Event\EventInterface'],
'afterSave' => ['Cake\Event\EventInterface'],
'beforeDelete' => ['Cake\Event\EventInterface'],
'afterDelete' => ['Cake\Event\EventInterface'],
],
'Cake\ORM\Table' => [
'beforeFind' => ['Cake\Event\EventInterface'],
'buildValidator' => ['Cake\Event\EventInterface'],
'buildRules' => ['Cake\ORM\RulesChecker'],
'beforeRules' => ['Cake\Event\EventInterface'],
'afterRules' => ['Cake\Event\EventInterface'],
'beforeSave' => ['Cake\Event\EventInterface'],
'afterSave' => ['Cake\Event\EventInterface'],
'beforeDelete' => ['Cake\Event\EventInterface'],
'afterDelete' => ['Cake\Event\EventInterface'],
],
'Cake\Controller\Controller' => [
'beforeFilter' => ['Cake\Event\EventInterface'],
'afterFilter' => ['Cake\Event\EventInterface'],
'beforeRender' => ['Cake\Event\EventInterface'],
'beforeRedirect' => ['Cake\Event\EventInterface'],
],
'Cake\Controller\Component' => [
'shutdown' => ['Cake\Event\EventInterface'],
'startup' => ['Cake\Event\EventInterface'],
'beforeFilter' => ['Cake\Event\EventInterface'],
'beforeRender' => ['Cake\Event\EventInterface'],
'beforeRedirect' => ['Cake\Event\EventInterface'],
],
]);
$services->set(RenameMethodCallBasedOnParameterRector::class)
->arg('$methodNamesByTypes', [
'getParam' => [
'match_parameter' => 'paging',
'replace_with' => 'getAttribute',
],
'withParam' => [
'match_parameter' => 'paging',
'replace_with' => 'withAttribute',
],
]);
$services->set(ModalToGetSetRector::class)
->arg('$methodNamesByTypes', [
'Cake\Console\ConsoleIo' => [
'styles' => [
'set' => 'setStyle',
'get' => 'getStyle',
],
],
'Cake\Console\ConsoleOutput' => [
'styles' => [
'set' => 'setStyle',
'get' => 'getStyle',
],
],
'Cake\ORM\EntityInterface' => [
'isNew' => [
'set' => 'setNew',
'get' => 'isNew',
],
],
]);
};

View File

@ -1,161 +0,0 @@
# source: https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html
services:
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Cake\Database\Type': 'Cake\Database\TypeFactory'
'Cake\Console\ConsoleErrorHandler': 'Cake\Error\ConsoleErrorHandler'
Rector\Renaming\Rector\Constant\RenameClassConstantRector:
$oldToNewConstantsByClass:
'Cake\View\View':
NAME_ELEMENT: 'TYPE_ELEMENT'
NAME_LAYOUT: 'TYPE_LAYOUT'
'Cake\Mailer\Email':
MESSAGE_HTML: 'Cake\Mailer\Message::MESSAGE_HTML'
MESSAGE_TEXT: 'Cake\Mailer\Message::MESSAGE_TEXT'
MESSAGE_BOTH: 'Cake\Mailer\Message::MESSAGE_BOTH'
EMAIL_PATTERN: 'Cake\Mailer\Message::EMAIL_PATTERN'
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Cake\Form\Form':
errors: 'getErrors'
'Cake\Mailer\Email':
set: 'setViewVars'
'Cake\ORM\EntityInterface':
unsetProperty: 'unset'
'Cake\Cache\Cache':
engine: 'pool'
'Cake\Http\Cookie\Cookie':
getStringValue: 'getScalarValue'
'Cake\Validation\Validator':
containsNonAlphaNumeric: 'notAlphaNumeric'
errors: 'validate'
Rector\Renaming\Rector\MethodCall\RenameStaticMethodRector:
$oldToNewMethodByClasses:
'Router':
pushRequest: setRequest
setRequestInfo: setRequest
setRequestContext: setRequest
Rector\Core\Rector\Property\RenamePropertyRector:
$oldToNewPropertyByTypes:
'Cake\ORM\Entity':
_properties: _fields
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
'Cake\Http\BaseApplication':
bootstrap: 'void'
bootstrapCli: 'void'
middleware: 'Cake\Http\MiddlewareQueue'
'Cake\Console\Shell':
initialize: 'void'
'Cake\Controller\Component':
initialize: 'void'
'Cake\Controller\Controller':
initialize: 'void'
render: 'Cake\Http\Response'
'Cake\Form\Form':
validate: 'bool'
_buildSchema: 'Cake\Form\Schema'
'Cake\ORM\Behavior':
initialize: 'void'
'Cake\ORM\Table':
initialize: 'void'
updateAll: 'int'
deleteAll: 'int'
validationDefault: 'Cake\Validation\Validator'
buildRules: 'Cake\ORM\RulesChecker'
'Cake\View\Helper':
initialize: 'void'
Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector:
$typehintForParameterByMethodByClass:
'Cake\Form\Form':
getData:
0: '?string'
'Cake\ORM\Behavior':
beforeFind:
0: 'Cake\Event\EventInterface'
buildValidator:
0: 'Cake\Event\EventInterface'
buildRules:
0: 'Cake\Event\EventInterface'
beforeRules:
0: 'Cake\Event\EventInterface'
afterRules:
0: 'Cake\Event\EventInterface'
beforeSave:
0: 'Cake\Event\EventInterface'
afterSave:
0: 'Cake\Event\EventInterface'
beforeDelete:
0: 'Cake\Event\EventInterface'
afterDelete:
0: 'Cake\Event\EventInterface'
'Cake\ORM\Table':
beforeFind:
0: 'Cake\Event\EventInterface'
buildValidator:
0: 'Cake\Event\EventInterface'
buildRules:
0: 'Cake\ORM\RulesChecker'
beforeRules:
0: 'Cake\Event\EventInterface'
afterRules:
0: 'Cake\Event\EventInterface'
beforeSave:
0: 'Cake\Event\EventInterface'
afterSave:
0: 'Cake\Event\EventInterface'
beforeDelete:
0: 'Cake\Event\EventInterface'
afterDelete:
0: 'Cake\Event\EventInterface'
'Cake\Controller\Controller':
beforeFilter:
0: 'Cake\Event\EventInterface'
afterFilter:
0: 'Cake\Event\EventInterface'
beforeRender:
0: 'Cake\Event\EventInterface'
beforeRedirect:
0: 'Cake\Event\EventInterface'
'Cake\Controller\Component':
shutdown:
0: 'Cake\Event\EventInterface'
startup:
0: 'Cake\Event\EventInterface'
beforeFilter:
0: 'Cake\Event\EventInterface'
beforeRender:
0: 'Cake\Event\EventInterface'
beforeRedirect:
0: 'Cake\Event\EventInterface'
Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector:
$methodNamesByTypes:
getParam:
match_parameter: 'paging'
replace_with: 'getAttribute'
withParam:
match_parameter: 'paging'
replace_with: 'withAttribute'
Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector:
$methodNamesByTypes:
'Cake\Console\ConsoleIo':
styles:
set: 'setStyle'
get: 'getStyle'
'Cake\Console\ConsoleOutput':
styles:
set: 'setStyle'
get: 'getStyle'
'Cake\ORM\EntityInterface':
isNew:
set: 'setNew'
get: 'isNew'

View File

@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
use Rector\Celebrity\Rector\BooleanOp\LogicalToBooleanRector;
use Rector\Celebrity\Rector\FuncCall\SetTypeToCastRector;
use Rector\Celebrity\Rector\NotEqual\CommonNotEqualRector;
use Rector\Php52\Rector\Property\VarToPublicPropertyRector;
use Rector\Renaming\Rector\Function_\RenameFunctionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(CommonNotEqualRector::class);
$services->set(RenameFunctionRector::class)
->arg('$oldFunctionToNewFunction', [
'split' => 'explode',
'join' => 'implode',
'sizeof' => 'count',
# https://www.php.net/manual/en/aliases.php
'chop' => 'rtrim',
'doubleval' => 'floatval',
'gzputs' => 'gzwrites',
'fputs' => 'fwrite',
'ini_alter' => 'ini_set',
'is_double' => 'is_float',
'is_integer' => 'is_int',
'is_long' => 'is_int',
'is_real' => 'is_float',
'is_writeable' => 'is_writable',
'key_exists' => 'array_key_exists',
'pos' => 'current',
'strchr' => 'strstr',
# mb
'mbstrcut' => 'mb_strcut',
'mbstrlen' => 'mb_strlen',
'mbstrpos' => 'mb_strpos',
'mbstrrpos' => 'mb_strrpos',
'mbsubstr' => 'mb_substr',
]);
$services->set(SetTypeToCastRector::class);
$services->set(LogicalToBooleanRector::class);
$services->set(VarToPublicPropertyRector::class);
};

View File

@ -1,33 +0,0 @@
services:
Rector\Celebrity\Rector\NotEqual\CommonNotEqualRector: null
Rector\Renaming\Rector\Function_\RenameFunctionRector:
$oldFunctionToNewFunction:
split: 'explode'
join: 'implode'
sizeof: 'count'
# https://www.php.net/manual/en/aliases.php
chop: 'rtrim'
doubleval: 'floatval'
gzputs: 'gzwrites'
fputs: 'fwrite'
ini_alter: 'ini_set'
is_double: 'is_float'
is_integer: 'is_int'
is_long: 'is_int'
is_real: 'is_float'
is_writeable: 'is_writable'
key_exists: 'array_key_exists'
pos: 'current'
strchr: 'strstr'
# mb
mbstrcut: 'mb_strcut'
mbstrlen: 'mb_strlen'
mbstrpos: 'mb_strpos'
mbstrrpos: 'mb_strrpos'
mbsubstr: 'mb_substr'
Rector\Celebrity\Rector\FuncCall\SetTypeToCastRector: null
Rector\Celebrity\Rector\BooleanOp\LogicalToBooleanRector: null
Rector\Php52\Rector\Property\VarToPublicPropertyRector: null

View File

@ -0,0 +1,177 @@
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Array_\ArrayThisCallToThisMethodCallRector;
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
use Rector\CodeQuality\Rector\Assign\CombinedAssignRector;
use Rector\CodeQuality\Rector\Assign\SplitListAssignToSeparateLineRector;
use Rector\CodeQuality\Rector\BinaryOp\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\BinaryOp\SimplifyDeMorganBinaryRector;
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
use Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector;
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
use Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector;
use Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector;
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToArrayFilterRector;
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
use Rector\CodeQuality\Rector\FuncCall\AddPregQuoteDelimiterRector;
use Rector\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector;
use Rector\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector;
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
use Rector\CodeQuality\Rector\FuncCall\InArrayAndArrayKeysToArrayKeyExistsRector;
use Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector;
use Rector\CodeQuality\Rector\FuncCall\IsAWithStringWithThirdArgumentRector;
use Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyFuncGetArgsCountRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyInArrayValuesRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector;
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
use Rector\CodeQuality\Rector\FuncCall\StrlenZeroToIdenticalEmptyStringRector;
use Rector\CodeQuality\Rector\Identical\BooleanNotIdenticalToNotIdenticalRector;
use Rector\CodeQuality\Rector\Identical\GetClassToInstanceOfRector;
use Rector\CodeQuality\Rector\Identical\SimplifyArraySearchRector;
use Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector;
use Rector\CodeQuality\Rector\Identical\SimplifyConditionsRector;
use Rector\CodeQuality\Rector\If_\CombineIfRector;
use Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\If_\RemoveAlwaysTrueConditionSetInConstructorRector;
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfIssetToNullCoalescingRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\CodeQuality\Rector\Include_\AbsolutizeRequireAndIncludePathRector;
use Rector\CodeQuality\Rector\LogicalAnd\AndAssignsToSeparateLinesRector;
use Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector;
use Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector;
use Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector;
use Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector;
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\SOLID\Rector\ClassMethod\UseInterfaceOverImplementationInConstructorRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(CombinedAssignRector::class);
$services->set(SimplifyEmptyArrayCheckRector::class);
$services->set(ForeachToInArrayRector::class);
$services->set(SimplifyForeachToCoalescingRector::class);
$services->set(InArrayAndArrayKeysToArrayKeyExistsRector::class);
$services->set(SimplifyFuncGetArgsCountRector::class);
$services->set(SimplifyInArrayValuesRector::class);
$services->set(SimplifyStrposLowerRector::class);
$services->set(GetClassToInstanceOfRector::class);
$services->set(SimplifyArraySearchRector::class);
$services->set(SimplifyConditionsRector::class);
$services->set(SimplifyIfNotNullReturnRector::class);
$services->set(SimplifyIfReturnBoolRector::class);
$services->set(SimplifyUselessVariableRector::class);
$services->set(UnnecessaryTernaryExpressionRector::class);
$services->set(RemoveExtraParametersRector::class);
$services->set(SimplifyDeMorganBinaryRector::class);
$services->set(SimplifyTautologyTernaryRector::class);
$services->set(SimplifyForeachToArrayFilterRector::class);
$services->set(SingleInArrayToCompareRector::class);
$services->set(SimplifyIfElseToTernaryRector::class);
$services->set(JoinStringConcatRector::class);
$services->set(ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class);
$services->set(SimplifyIfIssetToNullCoalescingRector::class);
$services->set(ExplicitBoolCompareRector::class);
$services->set(CombineIfRector::class);
$services->set(UseIdenticalOverEqualWithSameTypeRector::class);
$services->set(SimplifyDuplicatedTernaryRector::class);
$services->set(SimplifyBoolIdenticalTrueRector::class);
$services->set(SimplifyRegexPatternRector::class);
$services->set(BooleanNotIdenticalToNotIdenticalRector::class);
$services->set(CallableThisArrayToAnonymousFunctionRector::class);
$services->set(AndAssignsToSeparateLinesRector::class);
$services->set(ForToForeachRector::class);
$services->set(CompactToVariablesRector::class);
$services->set(CompleteDynamicPropertiesRector::class);
$services->set(IsAWithStringWithThirdArgumentRector::class);
$services->set(StrlenZeroToIdenticalEmptyStringRector::class);
$services->set(RemoveAlwaysTrueConditionSetInConstructorRector::class);
$services->set(ThrowWithPreviousExceptionRector::class);
$services->set(RemoveSoleValueSprintfRector::class);
$services->set(ShortenElseIfRector::class);
$services->set(UseInterfaceOverImplementationInConstructorRector::class);
$services->set(AddPregQuoteDelimiterRector::class);
$services->set(ArrayMergeOfNonArraysToSimpleArrayRector::class);
$services->set(IntvalToTypeCastRector::class);
$services->set(ArrayKeyExistsTernaryThenValueToCoalescingRector::class);
$services->set(AbsolutizeRequireAndIncludePathRector::class);
$services->set(ChangeArrayPushToArrayAssignRector::class);
$services->set(ForRepeatedCountToOwnVariableRector::class);
$services->set(ForeachItemsAssignToEmptyArrayToAssignRector::class);
$services->set(InlineIfToExplicitIfRector::class);
$services->set(ArrayKeysAndInArrayToArrayKeyExistsRector::class);
$services->set(SplitListAssignToSeparateLineRector::class);
$services->set(UnusedForeachValueToArrayKeysRector::class);
$services->set(ArrayThisCallToThisMethodCallRector::class);
};

View File

@ -1,59 +0,0 @@
services:
Rector\CodeQuality\Rector\Assign\CombinedAssignRector: null
Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector: null
Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector: null
Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector: null
Rector\CodeQuality\Rector\FuncCall\InArrayAndArrayKeysToArrayKeyExistsRector: null
Rector\CodeQuality\Rector\FuncCall\SimplifyFuncGetArgsCountRector: null
Rector\CodeQuality\Rector\FuncCall\SimplifyInArrayValuesRector: null
Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector: null
Rector\CodeQuality\Rector\Identical\GetClassToInstanceOfRector: null
Rector\CodeQuality\Rector\Identical\SimplifyArraySearchRector: null
Rector\CodeQuality\Rector\Identical\SimplifyConditionsRector: null
Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector: null
Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector: null
Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector: null
Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector: null
Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector: null
Rector\CodeQuality\Rector\BinaryOp\SimplifyDeMorganBinaryRector: null
Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector: null
Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToArrayFilterRector: null
Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector: null
Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector: null
Rector\CodeQuality\Rector\Concat\JoinStringConcatRector: null
Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector: null
Rector\CodeQuality\Rector\If_\SimplifyIfIssetToNullCoalescingRector: null
Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector: null
Rector\CodeQuality\Rector\If_\CombineIfRector: null
Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector: null
Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector: null
Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector: null
Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector: null
Rector\CodeQuality\Rector\Identical\BooleanNotIdenticalToNotIdenticalRector: null
Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector: null
Rector\CodeQuality\Rector\LogicalAnd\AndAssignsToSeparateLinesRector: null
Rector\CodeQuality\Rector\For_\ForToForeachRector: null
Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector: null
Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector: null
Rector\CodeQuality\Rector\FuncCall\IsAWithStringWithThirdArgumentRector: null
Rector\CodeQuality\Rector\FuncCall\StrlenZeroToIdenticalEmptyStringRector: null
Rector\CodeQuality\Rector\If_\RemoveAlwaysTrueConditionSetInConstructorRector: null
Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector: null
Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector: null
Rector\CodeQuality\Rector\If_\ShortenElseIfRector: null
Rector\SOLID\Rector\ClassMethod\UseInterfaceOverImplementationInConstructorRector: null
Rector\CodeQuality\Rector\FuncCall\AddPregQuoteDelimiterRector: null
Rector\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector: null
Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector: null
Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector: null
Rector\CodeQuality\Rector\Include_\AbsolutizeRequireAndIncludePathRector: null
Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector: null
Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector: null
Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector: null
Rector\CodeQuality\Rector\BinaryOp\InlineIfToExplicitIfRector: null
Rector\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector: null
Rector\CodeQuality\Rector\Assign\SplitListAssignToSeparateLineRector: null
Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector: null
Rector\CodeQuality\Rector\Array_\ArrayThisCallToThisMethodCallRector: null

View File

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
'CI_Controller' => 'CodeIgniter\Controller',
'CI_Model' => 'CodeIgniter\Model',
]);
};

View File

@ -1,5 +0,0 @@
services:
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'CI_Controller': 'CodeIgniter\Controller'
'CI_Model': 'CodeIgniter\Model'

View File

@ -0,0 +1,103 @@
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
use Rector\CodingStyle\Rector\Assign\UseIncrementAssignRector;
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
use Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector;
use Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector;
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\FuncCall\CallUserFuncCallToVariadicRector;
use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
use Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionCallToConstantRector;
use Rector\CodingStyle\Rector\FuncCall\SimpleArrayCallableToStringRector;
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
use Rector\CodingStyle\Rector\Function_\CamelCaseFunctionNamingToUnderscoreRector;
use Rector\CodingStyle\Rector\Identical\IdenticalFalseToBooleanNotRector;
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
use Rector\CodingStyle\Rector\Include_\FollowRequireByDirRector;
use Rector\CodingStyle\Rector\Property\UnderscoreToPascalCasePropertyNameRector;
use Rector\CodingStyle\Rector\String_\ManualJsonStringToJsonEncodeArrayRector;
use Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchRector;
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
use Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector;
use Rector\CodingStyle\Rector\Use_\SplitGroupedUseImportsRector;
use Rector\CodingStyle\Rector\Variable\UnderscoreToPascalCaseVariableNameRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(NullableCompareToNullRector::class);
$services->set(SimpleArrayCallableToStringRector::class);
$services->set(IdenticalFalseToBooleanNotRector::class);
$services->set(BinarySwitchToIfElseRector::class);
$services->set(ConsistentImplodeRector::class);
$services->set(TernaryConditionVariableAssignmentRector::class);
$services->set(RemoveUnusedAliasRector::class);
$services->set(SymplifyQuoteEscapeRector::class);
$services->set(SplitGroupedConstantsAndPropertiesRector::class);
$services->set(SplitStringClassConstantToClassConstFetchRector::class);
$services->set(StringClassNameToClassConstantRector::class);
$services->set(ConsistentPregDelimiterRector::class);
$services->set(FollowRequireByDirRector::class);
$services->set(CatchExceptionNameMatchingTypeRector::class);
$services->set(UseIncrementAssignRector::class);
$services->set(SplitDoubleAssignRector::class);
$services->set(VarConstantCommentRector::class);
$services->set(EncapsedStringsToSprintfRector::class);
$services->set(NewlineBeforeNewAssignSetRector::class);
$services->set(ManualJsonStringToJsonEncodeArrayRector::class);
$services->set(AddArrayDefaultToArrayPropertyRector::class);
$services->set(MakeInheritedMethodVisibilitySameAsParentRector::class);
$services->set(CallUserFuncCallToVariadicRector::class);
$services->set(VersionCompareFuncCallToConstantRector::class);
$services->set(FunctionCallToConstantRector::class)
->arg('$functionsToConstants', [
'php_sapi_name' => 'PHP_SAPI',
'pi' => 'M_PI',
]);
$services->set(CamelCaseFunctionNamingToUnderscoreRector::class);
$services->set(SplitGroupedUseImportsRector::class);
$services->set(UnderscoreToPascalCasePropertyNameRector::class);
$services->set(UnderscoreToPascalCaseVariableNameRector::class);
$services->set(RemoveDoubleUnderscoreInMethodNameRector::class);
};

View File

@ -1,39 +0,0 @@
services:
Rector\CodingStyle\Rector\If_\NullableCompareToNullRector: null
Rector\CodingStyle\Rector\FuncCall\SimpleArrayCallableToStringRector: null
Rector\CodingStyle\Rector\Identical\IdenticalFalseToBooleanNotRector: null
Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector: null
Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector: null
Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector: null
Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector: null
Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector: null
Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector: null
Rector\CodingStyle\Rector\String_\SplitStringClassConstantToClassConstFetchRector: null
Rector\Php55\Rector\String_\StringClassNameToClassConstantRector: null
Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector: null
Rector\CodingStyle\Rector\Include_\FollowRequireByDirRector: null
Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector: null
Rector\CodingStyle\Rector\Assign\UseIncrementAssignRector: null
Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector: null
Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector: null
Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector: null
Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector: null
Rector\CodingStyle\Rector\String_\ManualJsonStringToJsonEncodeArrayRector: null
Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector: null
Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector: null
Rector\CodingStyle\Rector\FuncCall\CallUserFuncCallToVariadicRector: null
Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector: null
Rector\CodingStyle\Rector\FuncCall\FunctionCallToConstantRector:
$functionsToConstants:
php_sapi_name: PHP_SAPI
pi: M_PI
Rector\CodingStyle\Rector\Function_\CamelCaseFunctionNamingToUnderscoreRector: null
Rector\CodingStyle\Rector\Use_\SplitGroupedUseImportsRector: null
Rector\CodingStyle\Rector\Property\UnderscoreToPascalCasePropertyNameRector: null
Rector\CodingStyle\Rector\Variable\UnderscoreToPascalCaseVariableNameRector: null
Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector: null

View File

@ -0,0 +1,89 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Argument\SwapFuncCallArgumentsRector;
use Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector;
use Rector\MysqlToMysqli\Rector\FuncCall\MysqlFuncCallToMysqliRector;
use Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector;
use Rector\MysqlToMysqli\Rector\FuncCall\MysqlQueryMysqlErrorWithLinkRector;
use Rector\Renaming\Rector\ConstFetch\RenameConstantRector;
use Rector\Renaming\Rector\Function_\RenameFunctionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# https://stackoverflow.com/a/1390625/1348344
# https://github.com/philip/MySQLConverterTool/blob/master/Converter.php
# https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html
$services->set(MysqlAssignToMysqliRector::class);
$services->set(MysqlFuncCallToMysqliRector::class);
$services->set(MysqlPConnectToMysqliConnectRector::class);
$services->set(SwapFuncCallArgumentsRector::class)
->arg('$newArgumentPositionsByFunctionName', [
'mysql_real_escape_string' => [
# first swap arguments, then rename
1,
0,
],
'mysql_select_db' => [1, 0],
'mysql_set_charset' => [1, 0],
'mysql_query' => [1, 0],
'mysql_fetch_row' => [1, 0],
]);
$services->set(RenameFunctionRector::class)
->arg('$oldFunctionToNewFunction', [
'mysql_affected_rows' => 'mysqli_affected_rows',
'mysql_close' => 'mysqli_close',
'mysql_data_seek' => 'mysqli_data_seek',
'mysql_errno' => 'mysqli_errno',
'mysql_fetch_array' => 'mysqli_fetch_array',
'mysql_fetch_assoc' => 'mysqli_fetch_assoc',
'mysql_fetch_lengths' => 'mysqli_fetch_lengths',
'mysql_fetch_object' => 'mysqli_fetch_object',
'mysql_fetch_row' => 'mysqli_fetch_row',
'mysql_field_seek' => 'mysqli_field_seek',
'mysql_free_result' => 'mysqli_free_result',
'mysql_get_client_info' => 'mysqli_get_client_info',
'mysql_get_host_info' => 'mysqli_get_host_info',
'mysql_get_proto_info' => 'mysqli_get_proto_info',
'mysql_get_server_info' => 'mysqli_get_server_info',
'mysql_info' => 'mysqli_info',
'mysql_insert_id' => 'mysqli_insert_id',
'mysql_num_rows' => 'mysqli_num_rows',
'mysql_ping' => 'mysqli_ping',
'mysql_real_escape_string' => 'mysqli_real_escape_string',
'mysql_select_db' => 'mysqli_select_db',
'mysql_set_charset' => 'mysqli_set_charset',
'mysql_stat' => 'mysqli_stat',
'mysql_thread_id' => 'mysqli_thread_id',
'mysql_numfields' => 'mysqli_num_fields',
'mysql_escape_string' => 'mysqli_real_escape_string',
'mysql_client_encoding' => 'mysqli_character_set_name',
'mysql_numrows' => 'mysqli_num_rows',
'mysql_list_processes' => 'mysqli_thread_id',
'mysql_num_fields' => 'mysqli_field_count',
'mysql_connect' => 'mysqli_connect',
]);
$services->set(RenameConstantRector::class)
->arg('$oldToNewConstants', [
# http://php.net/manual/en/mysql.constants.php ↓
# http://php.net/manual/en/mysqli.constants.php
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
'MYSQL_NUM' => 'MYSQLI_NUM',
'MYSQL_BOTH' => 'MYSQLI_BOTH',
'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS',
'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE',
'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE',
'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL',
'MYSQL_PRIMARY_KEY_FLAG' => 'MYSQLI_PRI_KEY_FLAG',
]);
$services->set(MysqlQueryMysqlErrorWithLinkRector::class);
};

View File

@ -1,64 +0,0 @@
# https://stackoverflow.com/a/1390625/1348344
# https://github.com/philip/MySQLConverterTool/blob/master/Converter.php
# https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html
services:
Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector: null
Rector\MysqlToMysqli\Rector\FuncCall\MysqlFuncCallToMysqliRector: null
Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector: null
# first swap arguments, then rename
Rector\Core\Rector\Argument\SwapFuncCallArgumentsRector:
$newArgumentPositionsByFunctionName:
mysql_real_escape_string: [1, 0]
mysql_select_db: [1, 0]
mysql_set_charset: [1, 0]
mysql_query: [1, 0]
mysql_fetch_row: [1, 0]
Rector\Renaming\Rector\Function_\RenameFunctionRector:
$oldFunctionToNewFunction:
mysql_affected_rows: 'mysqli_affected_rows'
mysql_close: 'mysqli_close'
mysql_data_seek: 'mysqli_data_seek'
mysql_errno: 'mysqli_errno'
mysql_fetch_array: 'mysqli_fetch_array'
mysql_fetch_assoc: 'mysqli_fetch_assoc'
mysql_fetch_lengths: 'mysqli_fetch_lengths'
mysql_fetch_object: 'mysqli_fetch_object'
mysql_fetch_row: 'mysqli_fetch_row'
mysql_field_seek: 'mysqli_field_seek'
mysql_free_result: 'mysqli_free_result'
mysql_get_client_info: 'mysqli_get_client_info'
mysql_get_host_info: 'mysqli_get_host_info'
mysql_get_proto_info: 'mysqli_get_proto_info'
mysql_get_server_info: 'mysqli_get_server_info'
mysql_info: 'mysqli_info'
mysql_insert_id: 'mysqli_insert_id'
mysql_num_rows: 'mysqli_num_rows'
mysql_ping: 'mysqli_ping'
mysql_real_escape_string: 'mysqli_real_escape_string'
mysql_select_db: 'mysqli_select_db'
mysql_set_charset: 'mysqli_set_charset'
mysql_stat: 'mysqli_stat'
mysql_thread_id: 'mysqli_thread_id'
mysql_numfields: 'mysqli_num_fields'
mysql_escape_string: 'mysqli_real_escape_string'
mysql_client_encoding: 'mysqli_character_set_name'
mysql_numrows: 'mysqli_num_rows'
mysql_list_processes: 'mysqli_thread_id'
mysql_num_fields: 'mysqli_field_count'
mysql_connect: 'mysqli_connect'
# http://php.net/manual/en/mysql.constants.php ↓
# http://php.net/manual/en/mysqli.constants.php
Rector\Renaming\Rector\ConstFetch\RenameConstantRector:
$oldToNewConstants:
MYSQL_ASSOC: 'MYSQLI_ASSOC'
MYSQL_NUM: 'MYSQLI_NUM'
MYSQL_BOTH: 'MYSQLI_BOTH'
MYSQL_CLIENT_COMPRESS: 'MYSQLI_CLIENT_COMPRESS'
MYSQL_CLIENT_IGNORE_SPACE: 'MYSQLI_CLIENT_IGNORE_SPACE'
MYSQL_CLIENT_INTERACTIVE: 'MYSQLI_CLIENT_INTERACTIVE'
MYSQL_CLIENT_SSL: 'MYSQLI_CLIENT_SSL'
MYSQL_PRIMARY_KEY_FLAG: 'MYSQLI_PRI_KEY_FLAG'
Rector\MysqlToMysqli\Rector\FuncCall\MysqlQueryMysqlErrorWithLinkRector: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\DeadCode\Rector\Class_\RemoveUnusedClassesRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RemoveUnusedClassesRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\DeadCode\Rector\Class_\RemoveUnusedClassesRector: null

View File

@ -0,0 +1,123 @@
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector;
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
use Rector\DeadCode\Rector\Assign\RemoveAssignOfVoidReturnFunctionRector;
use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector;
use Rector\DeadCode\Rector\Class_\RemoveSetterOnlyPropertyAndMethodCallRector;
use Rector\DeadCode\Rector\Class_\RemoveUnusedDoctrineEntityMethodAndPropertyRector;
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedClassConstantRector;
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateConstantRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveDeadConstructorRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveDeadRecursiveClassMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveDelegatingParentCallRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveOverriddenValuesRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedParameterRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
use Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector;
use Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
use Rector\DeadCode\Rector\Function_\RemoveUnusedFunctionRector;
use Rector\DeadCode\Rector\FunctionLike\RemoveCodeAfterReturnRector;
use Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector;
use Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector;
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
use Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
use Rector\DeadCode\Rector\Instanceof_\RemoveDuplicatedInstanceOfRector;
use Rector\DeadCode\Rector\MethodCall\RemoveDefaultArgumentValueRector;
use Rector\DeadCode\Rector\Property\RemoveNullPropertyInitializationRector;
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\DeadCode\Rector\Stmt\RemoveDeadStmtRector;
use Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
use Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector;
use Rector\PHPUnit\Rector\ClassMethod\RemoveEmptyTestMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RemoveDeadStmtRector::class);
$services->set(RemoveDuplicatedArrayKeyRector::class);
$services->set(RemoveUnusedForeachKeyRector::class);
$services->set(RemoveParentCallWithoutParentRector::class);
$services->set(RemoveEmptyClassMethodRector::class);
$services->set(RemoveUnusedPrivatePropertyRector::class);
$services->set(RemoveDoubleAssignRector::class);
$services->set(RemoveUnusedParameterRector::class);
$services->set(SimplifyMirrorAssignRector::class);
$services->set(RemoveOverriddenValuesRector::class);
$services->set(RemoveUnusedPrivateConstantRector::class);
$services->set(RemoveUnusedPrivateMethodRector::class);
$services->set(RemoveCodeAfterReturnRector::class);
$services->set(RemoveDeadConstructorRector::class);
$services->set(RemoveDeadReturnRector::class);
$services->set(RemoveDeadIfForeachForRector::class);
$services->set(RemoveAndTrueRector::class);
$services->set(RemoveDefaultArgumentValueRector::class);
$services->set(RemoveConcatAutocastRector::class);
$services->set(SimplifyUselessVariableRector::class);
$services->set(RemoveDelegatingParentCallRector::class);
$services->set(RemoveDuplicatedInstanceOfRector::class);
$services->set(RemoveDuplicatedCaseInSwitchRector::class);
$services->set(RemoveUnusedDoctrineEntityMethodAndPropertyRector::class);
$services->set(RemoveSetterOnlyPropertyAndMethodCallRector::class);
$services->set(RemoveNullPropertyInitializationRector::class);
$services->set(RemoveUnreachableStatementRector::class);
$services->set(SimplifyIfElseWithSameContentRector::class);
$services->set(TernaryToBooleanOrFalseToBooleanAndRector::class);
$services->set(RemoveEmptyTestMethodRector::class);
$services->set(RemoveDeadTryCatchRector::class);
$services->set(RemoveUnusedClassConstantRector::class);
$services->set(RemoveUnusedVariableAssignRector::class);
$services->set(RemoveDuplicatedIfReturnRector::class);
$services->set(RemoveUnusedFunctionRector::class);
$services->set(RemoveUnusedNonEmptyArrayBeforeForeachRector::class);
$services->set(RemoveAssignOfVoidReturnFunctionRector::class);
$services->set(RemoveDeadRecursiveClassMethodRector::class);
};

View File

@ -1,41 +0,0 @@
services:
Rector\DeadCode\Rector\Stmt\RemoveDeadStmtRector: null
Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector: null
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector: null
Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector: null
Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector: null
Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedParameterRector: null
Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveOverriddenValuesRector: null
Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateConstantRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector: null
Rector\DeadCode\Rector\FunctionLike\RemoveCodeAfterReturnRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveDeadConstructorRector: null
Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector: null
Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector: null
Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector: null
Rector\DeadCode\Rector\MethodCall\RemoveDefaultArgumentValueRector: null
Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector: null
Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveDelegatingParentCallRector: null
Rector\DeadCode\Rector\Instanceof_\RemoveDuplicatedInstanceOfRector: null
Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector: null
Rector\DeadCode\Rector\Class_\RemoveUnusedDoctrineEntityMethodAndPropertyRector: null
Rector\DeadCode\Rector\Class_\RemoveSetterOnlyPropertyAndMethodCallRector: null
Rector\DeadCode\Rector\Property\RemoveNullPropertyInitializationRector: null
Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector: null
Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector: null
Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector: null
Rector\PHPUnit\Rector\ClassMethod\RemoveEmptyTestMethodRector: null
Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector: null
Rector\DeadCode\Rector\ClassConst\RemoveUnusedClassConstantRector: null
Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector: null
Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector: null
Rector\DeadCode\Rector\Function_\RemoveUnusedFunctionRector: null
Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector: null
Rector\DeadCode\Rector\Assign\RemoveAssignOfVoidReturnFunctionRector: null
Rector\DeadCode\Rector\ClassMethod\RemoveDeadRecursiveClassMethodRector: null

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
use Rector\Doctrine\Rector\Class_\ManagerRegistryGetManagerToEntityManagerRector;
use Rector\DoctrineCodeQuality\Rector\Class_\InitializeDefaultEntityCollectionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ManagerRegistryGetManagerToEntityManagerRector::class);
$services->set(InitializeDefaultEntityCollectionRector::class);
};

View File

@ -1,3 +0,0 @@
services:
Rector\Doctrine\Rector\Class_\ManagerRegistryGetManagerToEntityManagerRector: null
Rector\DoctrineCodeQuality\Rector\Class_\InitializeDefaultEntityCollectionRector: null

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# see https://github.com/doctrine/persistence/pull/71
'Doctrine\Common\Persistence\Event\LifecycleEventArgs' => 'Doctrine\Persistence\Event\LifecycleEventArgs',
'Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs' => 'Doctrine\Persistence\Event\LoadClassMetadataEventArgs',
'Doctrine\Common\Persistence\Event\ManagerEventArgs' => 'Doctrine\Persistence\Event\ManagerEventArgs',
'Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory' => 'Doctrine\Persistence\Mapping\AbstractClassMetadataFactory',
'Doctrine\Common\Persistence\Mapping\ClassMetadata' => 'Doctrine\Persistence\Mapping\ClassMetadata',
'Doctrine\Common\Persistence\Mapping\ClassMetadataFactory' => 'Doctrine\Persistence\Mapping\ClassMetadataFactory',
'Doctrine\Common\Persistence\Mapping\Driver\FileDriver' => 'Doctrine\Persistence\Mapping\Driver\FileDriver',
'Doctrine\Common\Persistence\Mapping\Driver\MappingDriver' => 'Doctrine\Persistence\Mapping\Driver\MappingDriver',
'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain' => 'Doctrine\Persistence\Mapping\Driver\MappingDriverChain',
'Doctrine\Common\Persistence\Mapping\Driver\PHPDriver' => 'Doctrine\Persistence\Mapping\Driver\PHPDriver',
'Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver' => 'Doctrine\Persistence\Mapping\Driver\StaticPHPDriver',
'Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator' => 'Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator',
'Doctrine\Common\Persistence\Mapping\MappingException' => 'Doctrine\Persistence\Mapping\MappingException',
'Doctrine\Common\Persistence\Mapping\ReflectionService' => 'Doctrine\Persistence\Mapping\ReflectionService',
'Doctrine\Common\Persistence\Mapping\RuntimeReflectionService' => 'Doctrine\Persistence\Mapping\RuntimeReflectionService',
'Doctrine\Common\Persistence\Mapping\StaticReflectionService' => 'Doctrine\Persistence\Mapping\StaticReflectionService',
'Doctrine\Common\Persistence\ObjectManager' => 'Doctrine\Persistence\ObjectManager',
'Doctrine\Common\Persistence\ObjectManagerDecorator' => 'Doctrine\Persistence\ObjectManagerDecorator',
'Doctrine\Common\Persistence\ObjectRepository' => 'Doctrine\Persistence\ObjectRepository',
'Doctrine\Common\Persistence\Proxy' => 'Doctrine\Persistence\Proxy',
'Doctrine\Common\Persistence\AbstractManagerRegistry' => 'Doctrine\Persistence\AbstractManagerRegistry',
'Doctrine\Common\Persistence\Mapping\Driver\DefaultFileLocator' => 'Doctrine\Persistence\Mapping\Driver\DefaultFileLocator',
'Doctrine\Common\Persistence\ManagerRegistry' => 'Doctrine\Persistence\ManagerRegistry',
]);
};

View File

@ -1,27 +0,0 @@
services:
Rector\Renaming\Rector\Class_\RenameClassRector:
# see https://github.com/doctrine/persistence/pull/71
$oldToNewClasses:
'Doctrine\Common\Persistence\Event\LifecycleEventArgs': 'Doctrine\Persistence\Event\LifecycleEventArgs'
'Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs': 'Doctrine\Persistence\Event\LoadClassMetadataEventArgs'
'Doctrine\Common\Persistence\Event\ManagerEventArgs': 'Doctrine\Persistence\Event\ManagerEventArgs'
'Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory': 'Doctrine\Persistence\Mapping\AbstractClassMetadataFactory'
'Doctrine\Common\Persistence\Mapping\ClassMetadata': 'Doctrine\Persistence\Mapping\ClassMetadata'
'Doctrine\Common\Persistence\Mapping\ClassMetadataFactory': 'Doctrine\Persistence\Mapping\ClassMetadataFactory'
'Doctrine\Common\Persistence\Mapping\Driver\FileDriver': 'Doctrine\Persistence\Mapping\Driver\FileDriver'
'Doctrine\Common\Persistence\Mapping\Driver\MappingDriver': 'Doctrine\Persistence\Mapping\Driver\MappingDriver'
'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain': 'Doctrine\Persistence\Mapping\Driver\MappingDriverChain'
'Doctrine\Common\Persistence\Mapping\Driver\PHPDriver': 'Doctrine\Persistence\Mapping\Driver\PHPDriver'
'Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver': 'Doctrine\Persistence\Mapping\Driver\StaticPHPDriver'
'Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator': 'Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator'
'Doctrine\Common\Persistence\Mapping\MappingException': 'Doctrine\Persistence\Mapping\MappingException'
'Doctrine\Common\Persistence\Mapping\ReflectionService': 'Doctrine\Persistence\Mapping\ReflectionService'
'Doctrine\Common\Persistence\Mapping\RuntimeReflectionService': 'Doctrine\Persistence\Mapping\RuntimeReflectionService'
'Doctrine\Common\Persistence\Mapping\StaticReflectionService': 'Doctrine\Persistence\Mapping\StaticReflectionService'
'Doctrine\Common\Persistence\ObjectManager': 'Doctrine\Persistence\ObjectManager'
'Doctrine\Common\Persistence\ObjectManagerDecorator': 'Doctrine\Persistence\ObjectManagerDecorator'
'Doctrine\Common\Persistence\ObjectRepository': 'Doctrine\Persistence\ObjectRepository'
'Doctrine\Common\Persistence\Proxy': 'Doctrine\Persistence\Proxy'
'Doctrine\Common\Persistence\AbstractManagerRegistry': 'Doctrine\Persistence\AbstractManagerRegistry'
'Doctrine\Common\Persistence\Mapping\Driver\DefaultFileLocator': 'Doctrine\Persistence\Mapping\Driver\DefaultFileLocator'
'Doctrine\Common\Persistence\ManagerRegistry': 'Doctrine\Persistence\ManagerRegistry'

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
#deprecated-type-constants
# https://github.com/doctrine/dbal/blob/master/UPGRADE.md
'Doctrine\DBAL\Types\Type' => 'Doctrine\DBAL\Types\Types',
]);
};

View File

@ -1,5 +0,0 @@
services:
# https://github.com/doctrine/dbal/blob/master/UPGRADE.md#deprecated-type-constants
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Doctrine\DBAL\Types\Type': 'Doctrine\DBAL\Types\Types'

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'DBAL\Platforms\AbstractPlatform' => [
#bc-break-changes-in-handling-string-and-binary-columns
# https://github.com/doctrine/dbal/blob/master/UPGRADE.md
'getVarcharTypeDeclarationSQL' => 'getStringTypeDeclarationSQL',
],
'Doctrine\DBAL\Driver\DriverException' => [
'getErrorCode' => 'getCode',
],
]);
$services->set(AddReturnTypeDeclarationRector::class)
->arg('$typehintForMethodByClass', [
'Doctrine\DBAL\Connection' => [
'ping' => 'void',
],
]);
};

View File

@ -1,14 +0,0 @@
services:
# https://github.com/doctrine/dbal/blob/master/UPGRADE.md#bc-break-changes-in-handling-string-and-binary-columns
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'DBAL\Platforms\AbstractPlatform':
getVarcharTypeDeclarationSQL: 'getStringTypeDeclarationSQL'
'Doctrine\DBAL\Driver\DriverException':
getErrorCode: 'getCode'
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
'Doctrine\DBAL\Connection':
ping: 'void'

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use Rector\Doctrine\Rector\Class_\AddUuidToEntityWhereMissingRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# add uuid id property
$services->set(AddUuidToEntityWhereMissingRector::class);
};

View File

@ -1,3 +0,0 @@
services:
# add uuid id property
Rector\Doctrine\Rector\Class_\AddUuidToEntityWhereMissingRector: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\Doctrine\Rector\Class_\AlwaysInitializeUuidInEntityRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(AlwaysInitializeUuidInEntityRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\Doctrine\Rector\Class_\AlwaysInitializeUuidInEntityRector: null

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use Rector\Doctrine\Rector\Class_\AddUuidMirrorForRelationPropertyRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# add relations uuid properties
$services->set(AddUuidMirrorForRelationPropertyRector::class);
};

View File

@ -1,3 +0,0 @@
services:
# add relations uuid properties
Rector\Doctrine\Rector\Class_\AddUuidMirrorForRelationPropertyRector: null

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
use Rector\Doctrine\Rector\ClassMethod\ChangeGetIdTypeToUuidRector;
use Rector\Doctrine\Rector\ClassMethod\ChangeSetIdTypeToUuidRector;
use Rector\Doctrine\Rector\Property\AddUuidAnnotationsToIdPropertyRector;
use Rector\Doctrine\Rector\Property\RemoveTemporaryUuidColumnPropertyRector;
use Rector\Doctrine\Rector\Property\RemoveTemporaryUuidRelationPropertyRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# properties
$services->set(AddUuidAnnotationsToIdPropertyRector::class);
$services->set(RemoveTemporaryUuidColumnPropertyRector::class);
$services->set(RemoveTemporaryUuidRelationPropertyRector::class);
# methods
$services->set(ChangeGetIdTypeToUuidRector::class);
$services->set(ChangeSetIdTypeToUuidRector::class);
};

View File

@ -1,9 +0,0 @@
services:
# properties
Rector\Doctrine\Rector\Property\AddUuidAnnotationsToIdPropertyRector: null
Rector\Doctrine\Rector\Property\RemoveTemporaryUuidColumnPropertyRector: null
Rector\Doctrine\Rector\Property\RemoveTemporaryUuidRelationPropertyRector: null
# methods
Rector\Doctrine\Rector\ClassMethod\ChangeGetIdTypeToUuidRector: null
Rector\Doctrine\Rector\ClassMethod\ChangeSetIdTypeToUuidRector: null

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
use Rector\Doctrine\Rector\ClassMethod\ChangeReturnTypeOfClassMethodWithGetIdRector;
use Rector\Doctrine\Rector\Identical\ChangeIdenticalUuidToEqualsMethodCallRector;
use Rector\Doctrine\Rector\MethodCall\ChangeGetUuidMethodCallToGetIdRector;
use Rector\Doctrine\Rector\MethodCall\ChangeSetIdToUuidValueRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedParamTypeRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeSetIdToUuidValueRector::class);
$services->set(ChangeGetUuidMethodCallToGetIdRector::class);
$services->set(ChangeReturnTypeOfClassMethodWithGetIdRector::class);
$services->set(ChangeIdenticalUuidToEqualsMethodCallRector::class);
# add Uuid type declarations
$services->set(AddMethodCallBasedParamTypeRector::class);
$services->set(AddArrayReturnDocTypeRector::class);
};

View File

@ -1,9 +0,0 @@
services:
Rector\Doctrine\Rector\MethodCall\ChangeSetIdToUuidValueRector: null
Rector\Doctrine\Rector\MethodCall\ChangeGetUuidMethodCallToGetIdRector: null
Rector\Doctrine\Rector\ClassMethod\ChangeReturnTypeOfClassMethodWithGetIdRector: null
Rector\Doctrine\Rector\Identical\ChangeIdenticalUuidToEqualsMethodCallRector: null
# add Uuid type declarations
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedParamTypeRector: null
Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector: null

View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\MethodCall\ServiceGetterToConstructorInjectionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ServiceGetterToConstructorInjectionRector::class)
->arg('$methodNamesByTypesToServiceTypes', [
'Doctrine\Common\Persistence\ManagerRegistry' => [
'getConnection' => 'Doctrine\DBAL\Connection',
],
'Doctrine\ORM\EntityManagerInterface' => [
'getConfiguration' => 'Doctrine\ORM\Configuration',
],
]);
};

View File

@ -1,7 +0,0 @@
services:
Rector\Core\Rector\MethodCall\ServiceGetterToConstructorInjectionRector:
$methodNamesByTypesToServiceTypes:
'Doctrine\Common\Persistence\ManagerRegistry':
'getConnection': 'Doctrine\DBAL\Connection'
'Doctrine\ORM\EntityManagerInterface':
'getConfiguration': 'Doctrine\ORM\Configuration'

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Argument\ArgumentRemoverRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(AddParamTypeDeclarationRector::class)
->arg('$typehintForParameterByMethodByClass', [
'Doctrine\ORM\Mapping\ClassMetadataFactory' => [
'setEntityManager' => ['Doctrine\ORM\EntityManagerInterface'],
],
'Doctrine\ORM\Tools\DebugUnitOfWorkListener' => [
'dumpIdentityMap' => ['Doctrine\ORM\EntityManagerInterface'],
],
]);
$services->set(ArgumentRemoverRector::class)
->arg('$positionsByMethodNameByClassType', [
'Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister' => [
'getSelectJoinColumnSQL' => [
4 => null,
],
],
]);
};

View File

@ -1,15 +0,0 @@
services:
Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector:
$typehintForParameterByMethodByClass:
'Doctrine\ORM\Mapping\ClassMetadataFactory':
setEntityManager:
0: 'Doctrine\ORM\EntityManagerInterface'
'Doctrine\ORM\Tools\DebugUnitOfWorkListener':
dumpIdentityMap:
0: 'Doctrine\ORM\EntityManagerInterface'
Rector\Core\Rector\Argument\ArgumentRemoverRector:
$positionsByMethodNameByClassType:
'Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister':
getSelectJoinColumnSQL:
4: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\Downgrade\Rector\Property\TypedPropertyRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(TypedPropertyRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\Downgrade\Rector\Property\TypedPropertyRector: null

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Symfony\Rector\FrameworkBundle\GetToConstructorInjectionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(GetToConstructorInjectionRector::class)
->arg('$getMethodAwareTypes', [
# https://github.com/EasyCorp/EasyAdminBundle/blob/master/UPGRADE-2.0.md
# first replace ->get("...") by constructor injection in every child of "EasyCorp\Bundle\EasyAdminBundle\AdminController"
'EasyCorp\Bundle\EasyAdminBundle\AdminController',
]);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# then rename the "EasyCorp\Bundle\EasyAdminBundle\AdminController" class
'EasyCorp\Bundle\EasyAdminBundle\AdminController' => 'EasyCorp\Bundle\EasyAdminBundle\EasyAdminController',
]);
};

View File

@ -1,11 +0,0 @@
# https://github.com/EasyCorp/EasyAdminBundle/blob/master/UPGRADE-2.0.md
services:
# first replace ->get("...") by constructor injection in every child of "EasyCorp\Bundle\EasyAdminBundle\AdminController"
Rector\Symfony\Rector\FrameworkBundle\GetToConstructorInjectionRector:
$getMethodAwareTypes:
- 'EasyCorp\Bundle\EasyAdminBundle\AdminController'
# then rename the "EasyCorp\Bundle\EasyAdminBundle\AdminController" class
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'EasyCorp\Bundle\EasyAdminBundle\AdminController': 'EasyCorp\Bundle\EasyAdminBundle\EasyAdminController'

View File

@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# https://github.com/ongr-io/ElasticsearchDSL/blob/5.x/CHANGELOG.md
'ONGR\ElasticsearchDSL\Query\BoolQuery' => 'ONGR\ElasticsearchDSL\Query\Compound\BoolQuery',
'ONGR\ElasticsearchDSL\Query\BoostingQuery' => 'ONGR\ElasticsearchDSL\Query\Compound\BoostingQuery',
'ONGR\ElasticsearchDSL\Query\ConstantScoreQuery' => 'ONGR\ElasticsearchDSL\Query\Compound\ConstantScoreQuery',
'ONGR\ElasticsearchDSL\Query\DisMaxQuery' => 'ONGR\ElasticsearchDSL\Query\Compound\DisMaxQuery',
'ONGR\ElasticsearchDSL\Query\FunctionScoreQuery' => 'ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery',
'ONGR\ElasticsearchDSL\Query\IndicesQuery' => 'ONGR\ElasticsearchDSL\Query\Compound\IndicesQuery',
'ONGR\ElasticsearchDSL\Query\MatchQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\MatchQuery',
'ONGR\ElasticsearchDSL\Query\CommonTermsQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\CommonTermsQuery',
'ONGR\ElasticsearchDSL\Query\MatchPhrasePrefixQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\MatchPhrasePrefixQuery',
'ONGR\ElasticsearchDSL\Query\MatchPhraseQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\MatchPhraseQuery',
'ONGR\ElasticsearchDSL\Query\MultiMatchQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\MultiMatchQuery',
'ONGR\ElasticsearchDSL\Query\QueryStringQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\QueryStringQuery',
'ONGR\ElasticsearchDSL\Query\SimpleQueryStringQuery' => 'ONGR\ElasticsearchDSL\Query\FullText\SimpleQueryStringQuery',
'ONGR\ElasticsearchDSL\Query\ExistsQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\ExistsQuery',
'ONGR\ElasticsearchDSL\Query\PrefixQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\PrefixQuery',
'ONGR\ElasticsearchDSL\Query\RangeQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\RangeQuery',
'ONGR\ElasticsearchDSL\Query\TermQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery',
'ONGR\ElasticsearchDSL\Query\TermsQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\TermsQuery',
'ONGR\ElasticsearchDSL\Query\WildcardQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\WildcardQuery',
'ONGR\ElasticsearchDSL\Query\FuzzyQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\FuzzyQuery',
'ONGR\ElasticsearchDSL\Query\RegexpQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\RegexpQuery',
'ONGR\ElasticsearchDSL\Query\TypeQuery' => 'ONGR\ElasticsearchDSL\Query\TermLevel\TypeQuery',
'ONGR\ElasticsearchDSL\Query\GeoBoundingBoxQuery' => 'ONGR\ElasticsearchDSL\Query\Geo\GeoBoundingBoxQuery',
'ONGR\ElasticsearchDSL\Query\GeoDistanceQuery' => 'ONGR\ElasticsearchDSL\Query\Geo\GeoDistanceQuery',
'ONGR\ElasticsearchDSL\Query\GeoDistanceRangeQuery' => 'ONGR\ElasticsearchDSL\Query\Geo\GeoDistanceRangeQuery',
'ONGR\ElasticsearchDSL\Query\GeoPolygonQuery' => 'ONGR\ElasticsearchDSL\Query\Geo\GeoPolygonQuery',
'ONGR\ElasticsearchDSL\Query\GeoShapeQuery' => 'ONGR\ElasticsearchDSL\Query\Geo\GeoShapeQuery',
'ONGR\ElasticsearchDSL\Query\HasChildQuery' => 'ONGR\ElasticsearchDSL\Query\Joining\HasChildQuery',
'ONGR\ElasticsearchDSL\Query\HasParentQuery' => 'ONGR\ElasticsearchDSL\Query\Joining\HasParentQuery',
'ONGR\ElasticsearchDSL\Query\NestedQuery' => 'ONGR\ElasticsearchDSL\Query\Joining\NestedQuery',
'ONGR\ElasticsearchDSL\Query\SpanContainingQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanContainingQuery',
'ONGR\ElasticsearchDSL\Query\SpanFirstQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanFirstQuery',
'ONGR\ElasticsearchDSL\Query\SpanMultiTermQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanMultiTermQuery',
'ONGR\ElasticsearchDSL\Query\SpanNearQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanNearQuery',
'ONGR\ElasticsearchDSL\Query\SpanNotQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanNotQuery',
'ONGR\ElasticsearchDSL\Query\SpanOrQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanOrQuery',
'ONGR\ElasticsearchDSL\Query\SpanWithinQuery' => 'ONGR\ElasticsearchDSL\Query\Span\SpanWithinQuery',
'ONGR\ElasticsearchDSL\Query\MoreLikeThisQuery' => 'ONGR\ElasticsearchDSL\Query\Specialized\MoreLikeThisQuery',
'ONGR\ElasticsearchDSL\Query\ScriptQuery' => 'ONGR\ElasticsearchDSL\Query\Specialized\ScriptQuery',
'ONGR\ElasticsearchDSL\Query\TemplateQuery' => 'ONGR\ElasticsearchDSL\Query\Specialized\TemplateQuery',
]);
};

View File

@ -1,44 +0,0 @@
# https://github.com/ongr-io/ElasticsearchDSL/blob/5.x/CHANGELOG.md
services:
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'ONGR\ElasticsearchDSL\Query\BoolQuery': 'ONGR\ElasticsearchDSL\Query\Compound\BoolQuery'
'ONGR\ElasticsearchDSL\Query\BoostingQuery': 'ONGR\ElasticsearchDSL\Query\Compound\BoostingQuery'
'ONGR\ElasticsearchDSL\Query\ConstantScoreQuery': 'ONGR\ElasticsearchDSL\Query\Compound\ConstantScoreQuery'
'ONGR\ElasticsearchDSL\Query\DisMaxQuery': 'ONGR\ElasticsearchDSL\Query\Compound\DisMaxQuery'
'ONGR\ElasticsearchDSL\Query\FunctionScoreQuery': 'ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery'
'ONGR\ElasticsearchDSL\Query\IndicesQuery': 'ONGR\ElasticsearchDSL\Query\Compound\IndicesQuery'
'ONGR\ElasticsearchDSL\Query\MatchQuery': 'ONGR\ElasticsearchDSL\Query\FullText\MatchQuery'
'ONGR\ElasticsearchDSL\Query\CommonTermsQuery': 'ONGR\ElasticsearchDSL\Query\FullText\CommonTermsQuery'
'ONGR\ElasticsearchDSL\Query\MatchPhrasePrefixQuery': 'ONGR\ElasticsearchDSL\Query\FullText\MatchPhrasePrefixQuery'
'ONGR\ElasticsearchDSL\Query\MatchPhraseQuery': 'ONGR\ElasticsearchDSL\Query\FullText\MatchPhraseQuery'
'ONGR\ElasticsearchDSL\Query\MultiMatchQuery': 'ONGR\ElasticsearchDSL\Query\FullText\MultiMatchQuery'
'ONGR\ElasticsearchDSL\Query\QueryStringQuery': 'ONGR\ElasticsearchDSL\Query\FullText\QueryStringQuery'
'ONGR\ElasticsearchDSL\Query\SimpleQueryStringQuery': 'ONGR\ElasticsearchDSL\Query\FullText\SimpleQueryStringQuery'
'ONGR\ElasticsearchDSL\Query\ExistsQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\ExistsQuery'
'ONGR\ElasticsearchDSL\Query\PrefixQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\PrefixQuery'
'ONGR\ElasticsearchDSL\Query\RangeQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\RangeQuery'
'ONGR\ElasticsearchDSL\Query\TermQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery'
'ONGR\ElasticsearchDSL\Query\TermsQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\TermsQuery'
'ONGR\ElasticsearchDSL\Query\WildcardQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\WildcardQuery'
'ONGR\ElasticsearchDSL\Query\FuzzyQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\FuzzyQuery'
'ONGR\ElasticsearchDSL\Query\RegexpQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\RegexpQuery'
'ONGR\ElasticsearchDSL\Query\TypeQuery': 'ONGR\ElasticsearchDSL\Query\TermLevel\TypeQuery'
'ONGR\ElasticsearchDSL\Query\GeoBoundingBoxQuery': 'ONGR\ElasticsearchDSL\Query\Geo\GeoBoundingBoxQuery'
'ONGR\ElasticsearchDSL\Query\GeoDistanceQuery': 'ONGR\ElasticsearchDSL\Query\Geo\GeoDistanceQuery'
'ONGR\ElasticsearchDSL\Query\GeoDistanceRangeQuery': 'ONGR\ElasticsearchDSL\Query\Geo\GeoDistanceRangeQuery'
'ONGR\ElasticsearchDSL\Query\GeoPolygonQuery': 'ONGR\ElasticsearchDSL\Query\Geo\GeoPolygonQuery'
'ONGR\ElasticsearchDSL\Query\GeoShapeQuery': 'ONGR\ElasticsearchDSL\Query\Geo\GeoShapeQuery'
'ONGR\ElasticsearchDSL\Query\HasChildQuery': 'ONGR\ElasticsearchDSL\Query\Joining\HasChildQuery'
'ONGR\ElasticsearchDSL\Query\HasParentQuery': 'ONGR\ElasticsearchDSL\Query\Joining\HasParentQuery'
'ONGR\ElasticsearchDSL\Query\NestedQuery': 'ONGR\ElasticsearchDSL\Query\Joining\NestedQuery'
'ONGR\ElasticsearchDSL\Query\SpanContainingQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanContainingQuery'
'ONGR\ElasticsearchDSL\Query\SpanFirstQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanFirstQuery'
'ONGR\ElasticsearchDSL\Query\SpanMultiTermQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanMultiTermQuery'
'ONGR\ElasticsearchDSL\Query\SpanNearQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanNearQuery'
'ONGR\ElasticsearchDSL\Query\SpanNotQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanNotQuery'
'ONGR\ElasticsearchDSL\Query\SpanOrQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanOrQuery'
'ONGR\ElasticsearchDSL\Query\SpanWithinQuery': 'ONGR\ElasticsearchDSL\Query\Span\SpanWithinQuery'
'ONGR\ElasticsearchDSL\Query\MoreLikeThisQuery': 'ONGR\ElasticsearchDSL\Query\Specialized\MoreLikeThisQuery'
'ONGR\ElasticsearchDSL\Query\ScriptQuery': 'ONGR\ElasticsearchDSL\Query\Specialized\ScriptQuery'
'ONGR\ElasticsearchDSL\Query\TemplateQuery': 'ONGR\ElasticsearchDSL\Query\Specialized\TemplateQuery'

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
use Rector\MockistaToMockery\Rector\Class_\MockeryTearDownRector;
use Rector\MockistaToMockery\Rector\ClassMethod\MockistaMockToMockeryMockRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(MockeryTearDownRector::class);
$services->set(MockistaMockToMockeryMockRector::class);
};

View File

@ -1,3 +0,0 @@
services:
Rector\MockistaToMockery\Rector\Class_\MockeryTearDownRector: null
Rector\MockistaToMockery\Rector\ClassMethod\MockistaMockToMockeryMockRector: null

View File

@ -0,0 +1,147 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\Core\Rector\Interface_\RemoveInterfacesRector;
use Rector\NetteToSymfony\Rector\Assign\FormControlToControllerAndFormTypeRector;
use Rector\NetteToSymfony\Rector\ClassMethod\RouterListToControllerAnnotationsRector;
use Rector\NetteToSymfony\Rector\FileSystem\DeleteFactoryInterfaceRector;
use Rector\NetteToSymfony\Rector\MethodCall\FromHttpRequestGetHeaderToHeadersGetRector;
use Rector\NetteToSymfony\Rector\MethodCall\FromRequestGetParameterToAttributesGetRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\Constant\RenameClassConstantRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/nette-to-symfony/*.php');
$services = $containerConfigurator->services();
$services->set(DeleteFactoryInterfaceRector::class);
$services->set(FromHttpRequestGetHeaderToHeadersGetRector::class);
$services->set(FromRequestGetParameterToAttributesGetRector::class);
$services->set(RouterListToControllerAnnotationsRector::class);
$services->set(AddReturnTypeDeclarationRector::class)
->arg('$typehintForMethodByClass', [
'Nette\Application\IPresenter' => [
# run(Request $appRequest): IResponse -> run(Request $appRequest): \Symfony\Component\HttpFoundation\Response
'run' => 'Symfony\Component\HttpFoundation\Response',
],
]);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# run(Request $appRequest) -> run(\Symfony\Component\HttpFoundation\Request $appRequest)
'Nette\Application\Request' => 'Symfony\Component\HttpFoundation\Request',
'Nette\Http\Request' => 'Symfony\Component\HttpFoundation\Request',
'Nette\Http\IRequest' => 'Symfony\Component\HttpFoundation\Request',
# extends Nette\Application\UI\Presenter -> extends Symfony\Bundle\FrameworkBundle\Controller\AbstractController
'Nette\Application\UI\Presenter' => 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController',
# Nette\Application\IResponse-> Symfony\Component\HttpFoundation\Response
'Nette\Application\IResponse' => 'Symfony\Component\HttpFoundation\Response',
]);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Nette\Application\IPresenter' => [
# IPresenter::run() -> IPresenter->__invoke
'run' => '__invoke',
],
'Nette\DI\Container' => [
'getByType' => 'get',
],
'Nette\Configurator' => [
# load configs
'addConfig' => 'load',
],
'Symfony\Component\Config\Loader\LoaderInterface' => [
'addConfig' => 'load',
],
]);
$services->set(RemoveInterfacesRector::class)
->arg('$interfacesToRemove', ['Nette\Application\IPresenter']);
$services->set(RenameClassConstantRector::class)
->arg('$oldToNewConstantsByClass', [
'Nette\Http\*Response' => [
'S100_CONTINUE' => 'Symfony\Component\HttpFoundation\Response::HTTP_CONTINUE',
'S101_SWITCHING_PROTOCOLS' => 'Symfony\Component\HttpFoundation\Response::HTTP_SWITCHING_PROTOCOLS',
'S102_PROCESSING' => 'Symfony\Component\HttpFoundation\Response::HTTP_PROCESSING',
'S200_OK' => 'Symfony\Component\HttpFoundation\Response::HTTP_OK',
'S201_CREATED' => 'Symfony\Component\HttpFoundation\Response::HTTP_CREATED',
'S202_ACCEPTED' => 'Symfony\Component\HttpFoundation\Response::HTTP_ACCEPTED',
'S203_NON_AUTHORITATIVE_INFORMATION' => 'Symfony\Component\HttpFoundation\Response::HTTP_NON_AUTHORITATIVE_INFORMATION',
'S204_NO_CONTENT' => 'Symfony\Component\HttpFoundation\Response::HTTP_NO_CONTENT',
'S205_RESET_CONTENT' => 'Symfony\Component\HttpFoundation\Response::HTTP_RESET_CONTENT',
'S206_PARTIAL_CONTENT' => 'Symfony\Component\HttpFoundation\Response::HTTP_PARTIAL_CONTENT',
'S207_MULTI_STATUS' => 'Symfony\Component\HttpFoundation\Response::HTTP_MULTI_STATUS',
'S208_ALREADY_REPORTED' => 'Symfony\Component\HttpFoundation\Response::HTTP_ALREADY_REPORTED',
'S226_IM_USED' => 'Symfony\Component\HttpFoundation\Response::HTTP_IM_USED',
'S300_MULTIPLE_CHOICES' => 'Symfony\Component\HttpFoundation\Response::HTTP_MULTIPLE_CHOICES',
'S301_MOVED_PERMANENTLY' => 'Symfony\Component\HttpFoundation\Response::HTTP_MOVED_PERMANENTLY',
'S302_FOUND' => 'Symfony\Component\HttpFoundation\Response::HTTP_FOUND',
'S303_SEE_OTHER' => 'Symfony\Component\HttpFoundation\Response::HTTP_SEE_OTHER',
'S303_POST_GET' => 'Symfony\Component\HttpFoundation\Response::HTTP_SEE_OTHER',
'S304_NOT_MODIFIED' => 'Symfony\Component\HttpFoundation\Response::HTTP_NOT_MODIFIED',
'S305_USE_PROXY' => 'Symfony\Component\HttpFoundation\Response::HTTP_USE_PROXY',
'S307_TEMPORARY_REDIRECT' => 'Symfony\Component\HttpFoundation\Response::HTTP_TEMPORARY_REDIRECT',
'S308_PERMANENT_REDIRECT' => 'Symfony\Component\HttpFoundation\Response::HTTP_PERMANENTLY_REDIRECT',
'S400_BAD_REQUEST' => 'Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST',
'S401_UNAUTHORIZED' => 'Symfony\Component\HttpFoundation\Response::HTTP_UNAUTHORIZED',
'S402_PAYMENT_REQUIRED' => 'Symfony\Component\HttpFoundation\Response::HTTP_PAYMENT_REQUIRED',
'S403_FORBIDDEN' => 'Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN',
'S404_NOT_FOUND' => 'Symfony\Component\HttpFoundation\Response::HTTP_NOT_FOUND',
'S405_METHOD_NOT_ALLOWED' => 'Symfony\Component\HttpFoundation\Response::HTTP_METHOD_NOT_ALLOWED',
'S406_NOT_ACCEPTABLE' => 'Symfony\Component\HttpFoundation\Response::HTTP_NOT_ACCEPTABLE',
'S407_PROXY_AUTHENTICATION_REQUIRED' => 'Symfony\Component\HttpFoundation\Response::HTTP_PROXY_AUTHENTICATION_REQUIRED',
'S408_REQUEST_TIMEOUT' => 'Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_TIMEOUT',
'S409_CONFLICT' => 'Symfony\Component\HttpFoundation\Response::HTTP_CONFLICT',
'S410_GONE' => 'Symfony\Component\HttpFoundation\Response::HTTP_GONE',
'S411_LENGTH_REQUIRED' => 'Symfony\Component\HttpFoundation\Response::HTTP_LENGTH_REQUIRED',
'S412_PRECONDITION_FAILED' => 'Symfony\Component\HttpFoundation\Response::HTTP_PRECONDITION_FAILED',
'S413_REQUEST_ENTITY_TOO_LARGE' => 'Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_ENTITY_TOO_LARGE',
'S414_REQUEST_URI_TOO_LONG' => 'Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_URI_TOO_LONG',
'S415_UNSUPPORTED_MEDIA_TYPE' => 'Symfony\Component\HttpFoundation\Response::HTTP_UNSUPPORTED_MEDIA_TYPE',
'S416_REQUESTED_RANGE_NOT_SATISFIABLE' => 'Symfony\Component\HttpFoundation\Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE',
'S417_EXPECTATION_FAILED' => 'Symfony\Component\HttpFoundation\Response::HTTP_EXPECTATION_FAILED',
'S421_MISDIRECTED_REQUEST' => 'Symfony\Component\HttpFoundation\Response::HTTP_MISDIRECTED_REQUEST',
'S422_UNPROCESSABLE_ENTITY' => 'Symfony\Component\HttpFoundation\Response::HTTP_UNPROCESSABLE_ENTITY',
'S423_LOCKED' => 'Symfony\Component\HttpFoundation\Response::HTTP_LOCKED',
'S424_FAILED_DEPENDENCY' => 'Symfony\Component\HttpFoundation\Response::HTTP_FAILED_DEPENDENCY',
'S426_UPGRADE_REQUIRED' => 'Symfony\Component\HttpFoundation\Response::HTTP_UPGRADE_REQUIRED',
'S428_PRECONDITION_REQUIRED' => 'Symfony\Component\HttpFoundation\Response::HTTP_PRECONDITION_REQUIRED',
'S429_TOO_MANY_REQUESTS' => 'Symfony\Component\HttpFoundation\Response::HTTP_TOO_MANY_REQUESTS',
'S431_REQUEST_HEADER_FIELDS_TOO_LARGE' => 'Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE',
'S451_UNAVAILABLE_FOR_LEGAL_REASONS' => 'Symfony\Component\HttpFoundation\Response::HTTP_UNAVAILABLE_FOR_LEGAL_REASONS',
'S500_INTERNAL_SERVER_ERROR' => 'Symfony\Component\HttpFoundation\Response::HTTP_INTERNAL_SERVER_ERROR',
'S501_NOT_IMPLEMENTED' => 'Symfony\Component\HttpFoundation\Response::HTTP_NOT_IMPLEMENTED',
'S502_BAD_GATEWAY' => 'Symfony\Component\HttpFoundation\Response::HTTP_BAD_GATEWAY',
'S503_SERVICE_UNAVAILABLE' => 'Symfony\Component\HttpFoundation\Response::HTTP_SERVICE_UNAVAILABLE',
'S504_GATEWAY_TIMEOUT' => 'Symfony\Component\HttpFoundation\Response::HTTP_GATEWAY_TIMEOUT',
'S505_HTTP_VERSION_NOT_SUPPORTED' => 'Symfony\Component\HttpFoundation\Response::HTTP_VERSION_NOT_SUPPORTED',
'S506_VARIANT_ALSO_NEGOTIATES' => 'Symfony\Component\HttpFoundation\Response::HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL',
'S507_INSUFFICIENT_STORAGE' => 'Symfony\Component\HttpFoundation\Response::HTTP_INSUFFICIENT_STORAGE',
'S508_LOOP_DETECTED' => 'Symfony\Component\HttpFoundation\Response::HTTP_LOOP_DETECTED',
'S510_NOT_EXTENDED' => 'Symfony\Component\HttpFoundation\Response::HTTP_NOT_EXTENDED',
'S511_NETWORK_AUTHENTICATION_REQUIRED' => 'Symfony\Component\HttpFoundation\Response::HTTP_NETWORK_AUTHENTICATION_REQUIRED',
],
'Nette\Http\*Request' => [
'GET' => 'Symfony\Component\HttpFoundation\Request::METHOD_GET',
'POST' => 'Symfony\Component\HttpFoundation\Request::METHOD_POST',
'HEAD' => 'Symfony\Component\HttpFoundation\Request::METHOD_HEAD',
'PUT' => 'Symfony\Component\HttpFoundation\Request::METHOD_PUT',
'DELETE' => 'Symfony\Component\HttpFoundation\Request::METHOD_DELETE',
'PATCH' => 'Symfony\Component\HttpFoundation\Request::METHOD_PATCH',
'OPTIONS' => 'Symfony\Component\HttpFoundation\Request::METHOD_OPTIONS',
],
]);
$services->set(FormControlToControllerAndFormTypeRector::class);
};

View File

@ -1,124 +0,0 @@
imports:
- { resource: 'nette-to-symfony/*.yaml' }
services:
Rector\NetteToSymfony\Rector\FileSystem\DeleteFactoryInterfaceRector: null
Rector\NetteToSymfony\Rector\MethodCall\FromHttpRequestGetHeaderToHeadersGetRector: null
Rector\NetteToSymfony\Rector\MethodCall\FromRequestGetParameterToAttributesGetRector: null
Rector\NetteToSymfony\Rector\ClassMethod\RouterListToControllerAnnotationsRector: null
# run(Request $appRequest): IResponse -> run(Request $appRequest): \Symfony\Component\HttpFoundation\Response
Rector\Core\Rector\ClassMethod\AddReturnTypeDeclarationRector:
$typehintForMethodByClass:
Nette\Application\IPresenter:
run: 'Symfony\Component\HttpFoundation\Response'
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
# run(Request $appRequest) -> run(\Symfony\Component\HttpFoundation\Request $appRequest)
'Nette\Application\Request': 'Symfony\Component\HttpFoundation\Request'
'Nette\Http\Request': 'Symfony\Component\HttpFoundation\Request'
'Nette\Http\IRequest': 'Symfony\Component\HttpFoundation\Request'
# extends Nette\Application\UI\Presenter -> extends Symfony\Bundle\FrameworkBundle\Controller\AbstractController
'Nette\Application\UI\Presenter': 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController'
# Nette\Application\IResponse-> Symfony\Component\HttpFoundation\Response
'Nette\Application\IResponse': 'Symfony\Component\HttpFoundation\Response'
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
# IPresenter::run() -> IPresenter->__invoke
'Nette\Application\IPresenter':
run: __invoke
'Nette\DI\Container':
getByType: get
# load configs
'Nette\Configurator':
addConfig: load
'Symfony\Component\Config\Loader\LoaderInterface':
addConfig: load
Rector\Core\Rector\Interface_\RemoveInterfacesRector:
$interfacesToRemove:
# Removes "implements IPresenter"
- 'Nette\Application\IPresenter'
Rector\Renaming\Rector\Constant\RenameClassConstantRector:
$oldToNewConstantsByClass:
Nette\Http\*Response:
S100_CONTINUE: Symfony\Component\HttpFoundation\Response::HTTP_CONTINUE
S101_SWITCHING_PROTOCOLS: Symfony\Component\HttpFoundation\Response::HTTP_SWITCHING_PROTOCOLS
S102_PROCESSING: Symfony\Component\HttpFoundation\Response::HTTP_PROCESSING
S200_OK: Symfony\Component\HttpFoundation\Response::HTTP_OK
S201_CREATED: Symfony\Component\HttpFoundation\Response::HTTP_CREATED
S202_ACCEPTED: Symfony\Component\HttpFoundation\Response::HTTP_ACCEPTED
S203_NON_AUTHORITATIVE_INFORMATION: Symfony\Component\HttpFoundation\Response::HTTP_NON_AUTHORITATIVE_INFORMATION
S204_NO_CONTENT: Symfony\Component\HttpFoundation\Response::HTTP_NO_CONTENT
S205_RESET_CONTENT: Symfony\Component\HttpFoundation\Response::HTTP_RESET_CONTENT
S206_PARTIAL_CONTENT: Symfony\Component\HttpFoundation\Response::HTTP_PARTIAL_CONTENT
S207_MULTI_STATUS: Symfony\Component\HttpFoundation\Response::HTTP_MULTI_STATUS
S208_ALREADY_REPORTED: Symfony\Component\HttpFoundation\Response::HTTP_ALREADY_REPORTED
S226_IM_USED: Symfony\Component\HttpFoundation\Response::HTTP_IM_USED
S300_MULTIPLE_CHOICES: Symfony\Component\HttpFoundation\Response::HTTP_MULTIPLE_CHOICES
S301_MOVED_PERMANENTLY: Symfony\Component\HttpFoundation\Response::HTTP_MOVED_PERMANENTLY
S302_FOUND: Symfony\Component\HttpFoundation\Response::HTTP_FOUND
S303_SEE_OTHER: Symfony\Component\HttpFoundation\Response::HTTP_SEE_OTHER
S303_POST_GET: Symfony\Component\HttpFoundation\Response::HTTP_SEE_OTHER
S304_NOT_MODIFIED: Symfony\Component\HttpFoundation\Response::HTTP_NOT_MODIFIED
S305_USE_PROXY: Symfony\Component\HttpFoundation\Response::HTTP_USE_PROXY
S307_TEMPORARY_REDIRECT: Symfony\Component\HttpFoundation\Response::HTTP_TEMPORARY_REDIRECT
S308_PERMANENT_REDIRECT: Symfony\Component\HttpFoundation\Response::HTTP_PERMANENTLY_REDIRECT
S400_BAD_REQUEST: Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
S401_UNAUTHORIZED: Symfony\Component\HttpFoundation\Response::HTTP_UNAUTHORIZED
S402_PAYMENT_REQUIRED: Symfony\Component\HttpFoundation\Response::HTTP_PAYMENT_REQUIRED
S403_FORBIDDEN: Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN
S404_NOT_FOUND: Symfony\Component\HttpFoundation\Response::HTTP_NOT_FOUND
S405_METHOD_NOT_ALLOWED: Symfony\Component\HttpFoundation\Response::HTTP_METHOD_NOT_ALLOWED
S406_NOT_ACCEPTABLE: Symfony\Component\HttpFoundation\Response::HTTP_NOT_ACCEPTABLE
S407_PROXY_AUTHENTICATION_REQUIRED: Symfony\Component\HttpFoundation\Response::HTTP_PROXY_AUTHENTICATION_REQUIRED
S408_REQUEST_TIMEOUT: Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_TIMEOUT
S409_CONFLICT: Symfony\Component\HttpFoundation\Response::HTTP_CONFLICT
S410_GONE: Symfony\Component\HttpFoundation\Response::HTTP_GONE
S411_LENGTH_REQUIRED: Symfony\Component\HttpFoundation\Response::HTTP_LENGTH_REQUIRED
S412_PRECONDITION_FAILED: Symfony\Component\HttpFoundation\Response::HTTP_PRECONDITION_FAILED
S413_REQUEST_ENTITY_TOO_LARGE: Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_ENTITY_TOO_LARGE
S414_REQUEST_URI_TOO_LONG: Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_URI_TOO_LONG
S415_UNSUPPORTED_MEDIA_TYPE: Symfony\Component\HttpFoundation\Response::HTTP_UNSUPPORTED_MEDIA_TYPE
S416_REQUESTED_RANGE_NOT_SATISFIABLE: Symfony\Component\HttpFoundation\Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
S417_EXPECTATION_FAILED: Symfony\Component\HttpFoundation\Response::HTTP_EXPECTATION_FAILED
S421_MISDIRECTED_REQUEST: Symfony\Component\HttpFoundation\Response::HTTP_MISDIRECTED_REQUEST
S422_UNPROCESSABLE_ENTITY: Symfony\Component\HttpFoundation\Response::HTTP_UNPROCESSABLE_ENTITY
S423_LOCKED: Symfony\Component\HttpFoundation\Response::HTTP_LOCKED
S424_FAILED_DEPENDENCY: Symfony\Component\HttpFoundation\Response::HTTP_FAILED_DEPENDENCY
S426_UPGRADE_REQUIRED: Symfony\Component\HttpFoundation\Response::HTTP_UPGRADE_REQUIRED
S428_PRECONDITION_REQUIRED: Symfony\Component\HttpFoundation\Response::HTTP_PRECONDITION_REQUIRED
S429_TOO_MANY_REQUESTS: Symfony\Component\HttpFoundation\Response::HTTP_TOO_MANY_REQUESTS
S431_REQUEST_HEADER_FIELDS_TOO_LARGE: Symfony\Component\HttpFoundation\Response::HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
S451_UNAVAILABLE_FOR_LEGAL_REASONS: Symfony\Component\HttpFoundation\Response::HTTP_UNAVAILABLE_FOR_LEGAL_REASONS
S500_INTERNAL_SERVER_ERROR: Symfony\Component\HttpFoundation\Response::HTTP_INTERNAL_SERVER_ERROR
S501_NOT_IMPLEMENTED: Symfony\Component\HttpFoundation\Response::HTTP_NOT_IMPLEMENTED
S502_BAD_GATEWAY: Symfony\Component\HttpFoundation\Response::HTTP_BAD_GATEWAY
S503_SERVICE_UNAVAILABLE: Symfony\Component\HttpFoundation\Response::HTTP_SERVICE_UNAVAILABLE
S504_GATEWAY_TIMEOUT: Symfony\Component\HttpFoundation\Response::HTTP_GATEWAY_TIMEOUT
S505_HTTP_VERSION_NOT_SUPPORTED: Symfony\Component\HttpFoundation\Response::HTTP_VERSION_NOT_SUPPORTED
S506_VARIANT_ALSO_NEGOTIATES: Symfony\Component\HttpFoundation\Response::HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL
S507_INSUFFICIENT_STORAGE: Symfony\Component\HttpFoundation\Response::HTTP_INSUFFICIENT_STORAGE
S508_LOOP_DETECTED: Symfony\Component\HttpFoundation\Response::HTTP_LOOP_DETECTED
S510_NOT_EXTENDED: Symfony\Component\HttpFoundation\Response::HTTP_NOT_EXTENDED
S511_NETWORK_AUTHENTICATION_REQUIRED: Symfony\Component\HttpFoundation\Response::HTTP_NETWORK_AUTHENTICATION_REQUIRED
Nette\Http\*Request:
GET: Symfony\Component\HttpFoundation\Request::METHOD_GET
POST: Symfony\Component\HttpFoundation\Request::METHOD_POST
HEAD: Symfony\Component\HttpFoundation\Request::METHOD_HEAD
PUT: Symfony\Component\HttpFoundation\Request::METHOD_PUT
DELETE: Symfony\Component\HttpFoundation\Request::METHOD_DELETE
PATCH: Symfony\Component\HttpFoundation\Request::METHOD_PATCH
OPTIONS: Symfony\Component\HttpFoundation\Request::METHOD_OPTIONS
Rector\NetteToSymfony\Rector\Assign\FormControlToControllerAndFormTypeRector: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\NetteToSymfony\Rector\ClassMethod\RenameEventNamesInEventSubscriberRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameEventNamesInEventSubscriberRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\NetteToSymfony\Rector\ClassMethod\RenameEventNamesInEventSubscriberRector: null

View File

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg(
'$oldToNewClasses',
['Doctrine\Common\DataFixtures\AbstractFixture' => 'Doctrine\Bundle\FixturesBundle\Fixture']
);
};

View File

@ -1,4 +0,0 @@
services:
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Doctrine\Common\DataFixtures\AbstractFixture': 'Doctrine\Bundle\FixturesBundle\Fixture'

View File

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector;
use Rector\NetteToSymfony\Rector\MethodCall\WrapTransParameterNameRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeMethodVisibilityRector::class)
->arg('$methodToVisibilityByClass', [
'Kdyby\Events\Subscriber' => [
'getSubscribedEvents' => 'static',
],
]);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Kdyby\Translation\Translator' => [
'translate' => 'trans',
],
'Kdyby\RabbitMq\IConsumer' => [
'process' => 'execute',
],
]);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
'Kdyby\RabbitMq\IConsumer' => 'OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface',
'Kdyby\RabbitMq\IProducer' => 'OldSound\RabbitMqBundle\RabbitMq\ProducerInterface',
'Kdyby\Monolog\Logger' => 'Psr\Log\LoggerInterface',
'Kdyby\Events\Subscriber' => 'Symfony\Component\EventDispatcher\EventSubscriberInterface',
'Kdyby\Translation\Translator' => 'Symfony\Contracts\Translation\TranslatorInterface',
]);
$services->set(WrapTransParameterNameRector::class);
};

View File

@ -1,22 +0,0 @@
services:
Rector\Core\Rector\Visibility\ChangeMethodVisibilityRector:
$methodToVisibilityByClass:
'Kdyby\Events\Subscriber':
getSubscribedEvents: 'static'
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'Kdyby\Translation\Translator':
translate: 'trans'
'Kdyby\RabbitMq\IConsumer':
process: 'execute'
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
'Kdyby\RabbitMq\IConsumer': 'OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface'
'Kdyby\RabbitMq\IProducer': 'OldSound\RabbitMqBundle\RabbitMq\ProducerInterface'
'Kdyby\Monolog\Logger': 'Psr\Log\LoggerInterface'
'Kdyby\Events\Subscriber': 'Symfony\Component\EventDispatcher\EventSubscriberInterface'
'Kdyby\Translation\Translator': 'Symfony\Contracts\Translation\TranslatorInterface'
Rector\NetteToSymfony\Rector\MethodCall\WrapTransParameterNameRector: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\NetteToSymfony\Rector\Class_\NetteControlToSymfonyControllerRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(NetteControlToSymfonyControllerRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\NetteToSymfony\Rector\Class_\NetteControlToSymfonyControllerRector: null

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Rector\NetteToSymfony\Rector\Class_\NetteFormToSymfonyFormRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(NetteFormToSymfonyFormRector::class);
};

View File

@ -1,2 +0,0 @@
services:
Rector\NetteToSymfony\Rector\Class_\NetteFormToSymfonyFormRector: null

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
use Rector\NetteTesterToPHPUnit\Rector\Class_\NetteTesterClassToPHPUnitClassRector;
use Rector\NetteTesterToPHPUnit\Rector\RenameTesterTestToPHPUnitToTestFileRector;
use Rector\NetteTesterToPHPUnit\Rector\StaticCall\NetteAssertToPHPUnitAssertRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(NetteTesterClassToPHPUnitClassRector::class);
$services->set(NetteAssertToPHPUnitAssertRector::class);
$services->set(RenameTesterTestToPHPUnitToTestFileRector::class);
};

View File

@ -1,6 +0,0 @@
services:
Rector\NetteTesterToPHPUnit\Rector\Class_\NetteTesterClassToPHPUnitClassRector: null
Rector\NetteTesterToPHPUnit\Rector\StaticCall\NetteAssertToPHPUnitAssertRector: null
Rector\NetteTesterToPHPUnit\Rector\RenameTesterTestToPHPUnitToTestFileRector: null

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
use Rector\PhpSpecToPHPUnit\Rector\Class_\AddMockPropertiesRector;
use Rector\PhpSpecToPHPUnit\Rector\Class_\PhpSpecClassToPHPUnitClassRector;
use Rector\PhpSpecToPHPUnit\Rector\ClassMethod\MockVariableToPropertyFetchRector;
use Rector\PhpSpecToPHPUnit\Rector\ClassMethod\PhpSpecMethodToPHPUnitMethodRector;
use Rector\PhpSpecToPHPUnit\Rector\FileSystem\RenameSpecFileToTestFileRector;
use Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecMocksToPHPUnitMocksRector;
use Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecPromisesToPHPUnitAssertRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# see: https://gnugat.github.io/2015/09/23/phpunit-with-phpspec.html
# 1. first convert mocks
$services->set(PhpSpecMocksToPHPUnitMocksRector::class);
$services->set(PhpSpecPromisesToPHPUnitAssertRector::class);
# 2. then methods
$services->set(PhpSpecMethodToPHPUnitMethodRector::class);
# 3. then the class itself
$services->set(PhpSpecClassToPHPUnitClassRector::class);
$services->set(AddMockPropertiesRector::class);
$services->set(MockVariableToPropertyFetchRector::class);
$services->set(RenameSpecFileToTestFileRector::class);
};

View File

@ -1,16 +0,0 @@
# see: https://gnugat.github.io/2015/09/23/phpunit-with-phpspec.html
services:
# 1. first convert mocks
Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecMocksToPHPUnitMocksRector: null
Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecPromisesToPHPUnitAssertRector: null
# 2. then methods
Rector\PhpSpecToPHPUnit\Rector\ClassMethod\PhpSpecMethodToPHPUnitMethodRector: null
# 3. then the class itself
Rector\PhpSpecToPHPUnit\Rector\Class_\PhpSpecClassToPHPUnitClassRector: null
Rector\PhpSpecToPHPUnit\Rector\Class_\AddMockPropertiesRector: null
Rector\PhpSpecToPHPUnit\Rector\ClassMethod\MockVariableToPropertyFetchRector: null
Rector\PhpSpecToPHPUnit\Rector\FileSystem\RenameSpecFileToTestFileRector: null

View File

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
use GuzzleHttp\Cookie\SetCookie;
use Rector\Core\Rector\Function_\FunctionToMethodCallRector;
use Rector\Core\Rector\StaticCall\StaticCallToFunctionRector;
use Rector\Guzzle\Rector\MethodCall\MessageAsArrayRector;
use Rector\MagicDisclosure\Rector\ClassMethod\ReturnThisRemoveRector;
use Rector\MagicDisclosure\Rector\MethodCall\DefluentMethodCallRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(
'classes_to_defluent',
['GuzzleHttp\Collection', 'GuzzleHttp\Url', 'GuzzleHttp\Query', 'GuzzleHttp\Post\PostBody', SetCookie::class]
);
$services = $containerConfigurator->services();
# both uses "%classes_to_defluent%
#diff-810cdcfdd8a6b9e1fc0d1e96d7786874
# covers https://github.com/guzzle/guzzle/commit/668209c895049759377593eed129e0949d9565b7
$services->set(ReturnThisRemoveRector::class)
->arg('$classesToDefluent', '%classes_to_defluent%');
$services->set(DefluentMethodCallRector::class)
->arg('$namesToDefluent', '%classes_to_defluent%');
$services->set(FunctionToMethodCallRector::class)
->arg('$functionToMethodCall', [
'GuzzleHttp\json_decode' => ['GuzzleHttp\Utils', 'jsonDecode'],
'GuzzleHttp\get_path' => ['GuzzleHttp\Utils', 'getPath'],
]);
$services->set(StaticCallToFunctionRector::class)
->arg('$staticCallToFunctionByType', [
'GuzzleHttp\Utils' => [
'setPath' => 'GuzzleHttp\set_path',
],
'GuzzleHttp\Pool' => [
'batch' => 'GuzzleHttp\Pool\batch',
],
]);
$services->set(MessageAsArrayRector::class);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'GuzzleHttp\Message\MessageInterface' => [
'getHeaderLines' => 'getHeaderAsArray',
],
]);
};

View File

@ -1,35 +0,0 @@
parameters:
classes_to_defluent:
- 'GuzzleHttp\Collection'
- 'GuzzleHttp\Url'
- 'GuzzleHttp\Query'
- 'GuzzleHttp\Post\PostBody'
- 'GuzzleHttp\Cookie\SetCookie'
services:
# both uses "%classes_to_defluent%
# covers https://github.com/guzzle/guzzle/commit/668209c895049759377593eed129e0949d9565b7#diff-810cdcfdd8a6b9e1fc0d1e96d7786874
Rector\MagicDisclosure\Rector\ClassMethod\ReturnThisRemoveRector:
$classesToDefluent: '%classes_to_defluent%'
Rector\MagicDisclosure\Rector\MethodCall\DefluentMethodCallRector:
$namesToDefluent: '%classes_to_defluent%'
Rector\Core\Rector\Function_\FunctionToMethodCallRector:
$functionToMethodCall:
'GuzzleHttp\json_decode': ['GuzzleHttp\Utils', 'jsonDecode']
'GuzzleHttp\get_path': ['GuzzleHttp\Utils', 'getPath']
Rector\Core\Rector\StaticCall\StaticCallToFunctionRector:
$staticCallToFunctionByType:
'GuzzleHttp\Utils':
setPath: 'GuzzleHttp\set_path'
'GuzzleHttp\Pool':
batch: 'GuzzleHttp\Pool\batch'
Rector\Guzzle\Rector\MethodCall\MessageAsArrayRector: null
Rector\Renaming\Rector\MethodCall\RenameMethodRector:
$oldToNewMethodsByClass:
'GuzzleHttp\Message\MessageInterface':
getHeaderLines: 'getHeaderAsArray'

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Property\InjectAnnotationClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(InjectAnnotationClassRector::class)
->arg('$annotationClasses', ['JMS\DiExtraBundle\Annotation\Inject']);
};

View File

@ -1,4 +0,0 @@
services:
Rector\Core\Rector\Property\InjectAnnotationClassRector:
$annotationClasses:
- 'JMS\DiExtraBundle\Annotation\Inject'

View File

@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\Class_\AddInterfaceByTraitRector;
use Rector\Doctrine\Rector\Class_\AddEntityIdByConditionRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(AddInterfaceByTraitRector::class)
->arg('$interfaceByTrait', [
# inspiration https://github.com/cpliakas/git-wrapper/tree/master/upgrade/rector
'Knp\DoctrineBehaviors\Model\Timestampable\Timestampable' => 'Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface',
'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableMethods' => 'Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface',
'Knp\DoctrineBehaviors\Model\Blameable\Blameable' => 'Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface',
'Knp\DoctrineBehaviors\Model\Blameable\BlameableMethods' => 'Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface',
'Knp\DoctrineBehaviors\Model\Loggable\Loggable' => 'Knp\DoctrineBehaviors\Contract\Entity\LoggableInterface',
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable' => 'Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface',
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableMethodsTrait' => 'Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface',
'Knp\DoctrineBehaviors\Model\Translatable\Translatable' => 'Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface',
'Knp\DoctrineBehaviors\Model\Translatable\TranslatableMethods' => 'Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface',
'Knp\DoctrineBehaviors\Model\Translatable\Translation' => 'Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface',
'Knp\DoctrineBehaviors\Model\Translatable\TranslationMethods' => 'Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface',
'Knp\DoctrineBehaviors\Model\Uuidable\Uuidable' => 'Knp\DoctrineBehaviors\Contract\Entity\UuidableInterface',
'Knp\DoctrineBehaviors\Model\Uuidable\UuidableMethods' => 'Knp\DoctrineBehaviors\Contract\Entity\UuidableInterface',
]);
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# move interface to "Contract"
'Knp\DoctrineBehaviors\Model\Tree\NodeInterface' => 'Knp\DoctrineBehaviors\Contract\Entity\TreeNodeInterface',
# suffix "Trait" for traits
'Knp\DoctrineBehaviors\Model\Blameable\BlameableMethods' => 'Knp\DoctrineBehaviors\Model\Blameable\BlameableMethodsTrait',
'Knp\DoctrineBehaviors\Model\Blameable\BlameableProperties' => 'Knp\DoctrineBehaviors\Model\Blameable\BlameablePropertiesTrait',
'Knp\DoctrineBehaviors\Model\Blameable\Blameable' => 'Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait',
'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableMethods' => 'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableMethodsTrait',
'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableProperties' => 'Knp\DoctrineBehaviors\Model\Geocodable\GeocodablePropertiesTrait',
'Knp\DoctrineBehaviors\Model\Geocodable\Geocodable' => 'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableTrait',
'Knp\DoctrineBehaviors\Model\Loggable\Loggable' => 'Knp\DoctrineBehaviors\Model\Loggable\LoggableTrait',
'Knp\DoctrineBehaviors\Model\Sluggable\SluggableMethods' => 'Knp\DoctrineBehaviors\Model\Sluggable\SluggableMethodsTrait',
'Knp\DoctrineBehaviors\Model\Sluggable\SluggableProperties' => 'Knp\DoctrineBehaviors\Model\Sluggable\SluggablePropertiesTrait',
'Knp\DoctrineBehaviors\Model\Sluggable\Sluggable' => 'Knp\DoctrineBehaviors\Model\Sluggable\SluggableTrait',
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableMethods' => 'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableMethodsTrait',
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableProperties' => 'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletablePropertiesTrait',
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable' => 'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait',
'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableMethods' => 'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableMethodsTrait',
'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableProperties' => 'Knp\DoctrineBehaviors\Model\Timestampable\TimestampablePropertiesTrait',
'Knp\DoctrineBehaviors\Model\Timestampable\Timestampable' => 'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait',
'Knp\DoctrineBehaviors\Model\Translatable\TranslatableMethods' => 'Knp\DoctrineBehaviors\Model\Translatable\TranslatableMethodsTrait',
'Knp\DoctrineBehaviors\Model\Translatable\TranslatableProperties' => 'Knp\DoctrineBehaviors\Model\Translatable\TranslatablePropertiesTrait',
'Knp\DoctrineBehaviors\Model\Translatable\Translatable' => 'Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait',
'Knp\DoctrineBehaviors\Model\Translatable\TranslationMethods' => 'Knp\DoctrineBehaviors\Model\Translatable\TranslationMethodsTrait',
'Knp\DoctrineBehaviors\Model\Translatable\TranslationProperties' => 'Knp\DoctrineBehaviors\Model\Translatable\TranslationPropertiesTrait',
'Knp\DoctrineBehaviors\Model\Translatable\Translation' => 'Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait',
# tree
'Knp\DoctrineBehaviors\Model\Tree\Node' => 'Knp\DoctrineBehaviors\Model\Tree\TreeNodeTrait',
]);
$services->set(AddEntityIdByConditionRector::class)
->arg(
'$detectedTraits',
[
'Knp\DoctrineBehaviors\Model\Translatable\Translation',
'Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait',
]
);
};

View File

@ -1,67 +0,0 @@
# inspiration https://github.com/cpliakas/git-wrapper/tree/master/upgrade/rector
services:
Rector\Core\Rector\Class_\AddInterfaceByTraitRector:
$interfaceByTrait:
'Knp\DoctrineBehaviors\Model\Timestampable\Timestampable': 'Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface'
'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableMethods': 'Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface'
'Knp\DoctrineBehaviors\Model\Blameable\Blameable': 'Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface'
'Knp\DoctrineBehaviors\Model\Blameable\BlameableMethods': 'Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface'
'Knp\DoctrineBehaviors\Model\Loggable\Loggable': 'Knp\DoctrineBehaviors\Contract\Entity\LoggableInterface'
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable': 'Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface'
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableMethodsTrait': 'Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface'
'Knp\DoctrineBehaviors\Model\Translatable\Translatable': 'Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface'
'Knp\DoctrineBehaviors\Model\Translatable\TranslatableMethods': 'Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface'
'Knp\DoctrineBehaviors\Model\Translatable\Translation': 'Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface'
'Knp\DoctrineBehaviors\Model\Translatable\TranslationMethods': 'Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface'
'Knp\DoctrineBehaviors\Model\Uuidable\Uuidable': 'Knp\DoctrineBehaviors\Contract\Entity\UuidableInterface'
'Knp\DoctrineBehaviors\Model\Uuidable\UuidableMethods': 'Knp\DoctrineBehaviors\Contract\Entity\UuidableInterface'
Rector\Renaming\Rector\Class_\RenameClassRector:
$oldToNewClasses:
# move interface to "Contract"
'Knp\DoctrineBehaviors\Model\Tree\NodeInterface': 'Knp\DoctrineBehaviors\Contract\Entity\TreeNodeInterface'
# suffix "Trait" for traits
'Knp\DoctrineBehaviors\Model\Blameable\BlameableMethods': 'Knp\DoctrineBehaviors\Model\Blameable\BlameableMethodsTrait'
'Knp\DoctrineBehaviors\Model\Blameable\BlameableProperties': 'Knp\DoctrineBehaviors\Model\Blameable\BlameablePropertiesTrait'
'Knp\DoctrineBehaviors\Model\Blameable\Blameable': 'Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait'
'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableMethods': 'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableMethodsTrait'
'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableProperties': 'Knp\DoctrineBehaviors\Model\Geocodable\GeocodablePropertiesTrait'
'Knp\DoctrineBehaviors\Model\Geocodable\Geocodable': 'Knp\DoctrineBehaviors\Model\Geocodable\GeocodableTrait'
'Knp\DoctrineBehaviors\Model\Loggable\Loggable': 'Knp\DoctrineBehaviors\Model\Loggable\LoggableTrait'
'Knp\DoctrineBehaviors\Model\Sluggable\SluggableMethods': 'Knp\DoctrineBehaviors\Model\Sluggable\SluggableMethodsTrait'
'Knp\DoctrineBehaviors\Model\Sluggable\SluggableProperties': 'Knp\DoctrineBehaviors\Model\Sluggable\SluggablePropertiesTrait'
'Knp\DoctrineBehaviors\Model\Sluggable\Sluggable': 'Knp\DoctrineBehaviors\Model\Sluggable\SluggableTrait'
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableMethods': 'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableMethodsTrait'
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableProperties': 'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletablePropertiesTrait'
'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable': 'Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait'
'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableMethods': 'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableMethodsTrait'
'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableProperties': 'Knp\DoctrineBehaviors\Model\Timestampable\TimestampablePropertiesTrait'
'Knp\DoctrineBehaviors\Model\Timestampable\Timestampable': 'Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait'
'Knp\DoctrineBehaviors\Model\Translatable\TranslatableMethods': 'Knp\DoctrineBehaviors\Model\Translatable\TranslatableMethodsTrait'
'Knp\DoctrineBehaviors\Model\Translatable\TranslatableProperties': 'Knp\DoctrineBehaviors\Model\Translatable\TranslatablePropertiesTrait'
'Knp\DoctrineBehaviors\Model\Translatable\Translatable': 'Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait'
'Knp\DoctrineBehaviors\Model\Translatable\TranslationMethods': 'Knp\DoctrineBehaviors\Model\Translatable\TranslationMethodsTrait'
'Knp\DoctrineBehaviors\Model\Translatable\TranslationProperties': 'Knp\DoctrineBehaviors\Model\Translatable\TranslationPropertiesTrait'
'Knp\DoctrineBehaviors\Model\Translatable\Translation': 'Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait'
# tree
'Knp\DoctrineBehaviors\Model\Tree\Node': 'Knp\DoctrineBehaviors\Model\Tree\TreeNodeTrait'
Rector\Doctrine\Rector\Class_\AddEntityIdByConditionRector:
$detectedTraits:
- 'Knp\DoctrineBehaviors\Model\Translatable\Translation'
- 'Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait'

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\BlameableBehaviorRector;
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\LoggableBehaviorRector;
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\SluggableBehaviorRector;
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\SoftDeletableBehaviorRector;
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\TimestampableBehaviorRector;
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\TranslationBehaviorRector;
use Rector\DoctrineGedmoToKnplabs\Rector\Class_\TreeBehaviorRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# version gedmo/doctrine-extensions 2.x to knplabs/doctrine-behaviors 2.0
$services->set(TimestampableBehaviorRector::class);
$services->set(SluggableBehaviorRector::class);
$services->set(TreeBehaviorRector::class);
$services->set(TranslationBehaviorRector::class);
$services->set(SoftDeletableBehaviorRector::class);
$services->set(BlameableBehaviorRector::class);
$services->set(LoggableBehaviorRector::class);
};

View File

@ -1,9 +0,0 @@
# version gedmo/doctrine-extensions 2.x to knplabs/doctrine-behaviors 2.0
services:
Rector\DoctrineGedmoToKnplabs\Rector\Class_\TimestampableBehaviorRector: null
Rector\DoctrineGedmoToKnplabs\Rector\Class_\SluggableBehaviorRector: null
Rector\DoctrineGedmoToKnplabs\Rector\Class_\TreeBehaviorRector: null
Rector\DoctrineGedmoToKnplabs\Rector\Class_\TranslationBehaviorRector: null
Rector\DoctrineGedmoToKnplabs\Rector\Class_\SoftDeletableBehaviorRector: null
Rector\DoctrineGedmoToKnplabs\Rector\Class_\BlameableBehaviorRector: null
Rector\DoctrineGedmoToKnplabs\Rector\Class_\LoggableBehaviorRector: null

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\FuncCall\FunctionToNewRector;
use Rector\Laravel\Rector\FuncCall\HelperFunctionToConstructorInjectionRector;
use Rector\Laravel\Rector\StaticCall\FacadeStaticCallToConstructorInjectionRector;
use Rector\Laravel\Rector\StaticCall\RequestStaticValidateToInjectRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/static/array-str-functions-to-static-call.php');
$services = $containerConfigurator->services();
$services->set(FacadeStaticCallToConstructorInjectionRector::class);
$services->set(RequestStaticValidateToInjectRector::class);
$services->set(HelperFunctionToConstructorInjectionRector::class);
$services->set(FunctionToNewRector::class)
->arg('$functionToNew', ['collect' => 'Illuminate\Support\Collection']);
};

View File

@ -1,12 +0,0 @@
imports:
# from https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/helpers.php to direct static calls
- { resource: 'static/array-str-functions-to-static-call.yaml'}
services:
Rector\Laravel\Rector\StaticCall\FacadeStaticCallToConstructorInjectionRector: null
Rector\Laravel\Rector\StaticCall\RequestStaticValidateToInjectRector: null
Rector\Laravel\Rector\FuncCall\HelperFunctionToConstructorInjectionRector: null
Rector\Core\Rector\FuncCall\FunctionToNewRector:
$functionToNew:
collect: 'Illuminate\Support\Collection'

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# see: https://laravel.com/docs/5.0/upgrade
'Illuminate\Cache\CacheManager' => 'Illuminate\Contracts\Cache\Repository',
# https://stackoverflow.com/a/24949656/1348344
'Illuminate\Database\Eloquent\SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletes',
]);
$services->set(RenameMethodRector::class)
->arg('$oldToNewMethodsByClass', [
'Illuminate\Contracts\Pagination\Paginator' => [
'links' => 'render',
'getFrom' => 'firstItem',
'getTo' => 'lastItem',
'getPerPage' => 'perPage',
'getCurrentPage' => 'currentPage',
'getLastPage' => 'lastPage',
'getTotal' => 'total',
],
]);
};

View File

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

View File

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# see: https://laravel.com/docs/5.1/upgrade
'Illuminate\Validation\Validator' => 'Illuminate\Contracts\Validation\Validator',
]);
};

View File

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

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
use Rector\Core\Rector\String_\StringToClassConstantRector;
use Rector\Renaming\Rector\Class_\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->arg('$oldToNewClasses', [
# see: https://laravel.com/docs/5.2/upgrade
'Illuminate\Auth\Access\UnauthorizedException' => 'Illuminate\Auth\Access\AuthorizationException',
'Illuminate\Http\Exception\HttpResponseException' => 'Illuminate\Foundation\Validation\ValidationException',
'Illuminate\Foundation\Composer' => 'Illuminate\Support\Composer',
]);
$services->set(StringToClassConstantRector::class)
->arg('$stringsToClassConstants', [
'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'],
]);
};

Some files were not shown because too many files have changed in this diff Show More