From e4630108edae149c558f3dbfe90b5e67b4a11da0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 23 Sep 2018 18:44:14 +0200 Subject: [PATCH] add method renames --- config/level/cakephp/cakephp34.yml | 47 +++++++++++++++++-- .../MethodCall/MethodNameReplacerRector.php | 3 +- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/config/level/cakephp/cakephp34.yml b/config/level/cakephp/cakephp34.yml index 3f9b3330fab..7d570568ff9 100644 --- a/config/level/cakephp/cakephp34.yml +++ b/config/level/cakephp/cakephp34.yml @@ -20,7 +20,7 @@ services: - 'autoQuoting' # (now enableAutoQuoting()/isAutoQuotingEnabled(' Cake\Database\Expression\FunctionExpression: - 'name' - Cake\Database\Expression\QueryExpression: + #Cake\Database\Expression\QueryExpression: #- 'tieWith' #() (now setConjunction()/getConjunction(' Cake\Database\Expression\ValuesExpression: - 'columns' @@ -67,7 +67,7 @@ services: Cake\ORM\EagerLoadable: - 'config' #- 'setter part of canBeJoined() (now setCanBeJoined(' - Cake\ORM\EagerLoader: +# Cake\ORM\EagerLoader: #- 'matching' #() (getMatching() will have to be called after setMatching() to keep the old behavio' #- 'autoFields' #() (now enableAutoFields()/isAutoFieldsEnabled(' Cake\ORM\Locator\TableLocator: @@ -125,4 +125,45 @@ services: - 'options' - 'name' - 'className' - #- 'autoLayout' #() (now enableAutoLayout()/isAutoLayoutEnabled(' \ No newline at end of file + #- 'autoLayout' #() (now enableAutoLayout()/isAutoLayoutEnabled(' + + Rector\Rector\MethodCall\MethodNameReplacerRector: + $perClassOldToNewMethods: + 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' + + Cake\Event\Event: + 'name': 'getName' + 'subject': 'getSubject' + 'result': 'getResult' + 'data': 'getData' + + Cake\View\Helper\FormHelper: + input: 'control' + inputs: 'controls' + allInputs: 'allControls' diff --git a/src/Rector/MethodCall/MethodNameReplacerRector.php b/src/Rector/MethodCall/MethodNameReplacerRector.php index c4e32b6fffe..b7740fec28c 100644 --- a/src/Rector/MethodCall/MethodNameReplacerRector.php +++ b/src/Rector/MethodCall/MethodNameReplacerRector.php @@ -12,7 +12,6 @@ use Rector\NodeTypeResolver\Node\Attribute; use Rector\Rector\AbstractRector; use Rector\RectorDefinition\ConfiguredCodeSample; use Rector\RectorDefinition\RectorDefinition; -use SomeClass; final class MethodNameReplacerRector extends AbstractRector { @@ -76,7 +75,7 @@ CODE_SAMPLE , [ '$perClassOldToNewMethods' => [ - SomeClass::class => [ + 'SomeClass' => [ 'oldMethod' => 'newMethod', ], ],