diff --git a/config/set/cakephp34.php b/config/set/cakephp34.php index 329a9b1836d..973d660b358 100644 --- a/config/set/cakephp34.php +++ b/config/set/cakephp34.php @@ -309,7 +309,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { ]; $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects($configuration), + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects($configuration), ]]); $services->set(ChangeMethodVisibilityRector::class) diff --git a/config/set/cakephp35.php b/config/set/cakephp35.php index 355d4d4dcb8..a3bab3641c7 100644 --- a/config/set/cakephp35.php +++ b/config/set/cakephp35.php @@ -23,7 +23,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Cake\Database\Schema\TableSchema', 'column', 'getColumn'), new MethodCallRename('Cake\Database\Schema\TableSchema', 'constraint', 'getConstraint'), new MethodCallRename('Cake\Database\Schema\TableSchema', 'index', 'getIndex'), diff --git a/config/set/cakephp36.php b/config/set/cakephp36.php index 15c099d0f13..7a5f0d3c550 100644 --- a/config/set/cakephp36.php +++ b/config/set/cakephp36.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { # source: https://book.cakephp.org/3.0/en/appendices/3-6-migration-guide.html $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Cake\ORM\Table', 'association', 'getAssociation'), new MethodCallRename('Cake\Validation\ValidationSet', 'isPresenceRequired', 'requirePresence'), new MethodCallRename('Cake\Validation\ValidationSet', 'isEmptyAllowed', 'allowEmpty'), diff --git a/config/set/cakephp37.php b/config/set/cakephp37.php index e1bf603df7c..ddd30c0fbee 100644 --- a/config/set/cakephp37.php +++ b/config/set/cakephp37.php @@ -17,7 +17,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Cake\Form\Form', 'errors', 'getErrors'), new MethodCallRename('Cake\Validation\Validation', 'cc', 'creditCard'), new MethodCallRename('Cake\Filesystem\Folder', 'normalizePath', 'correctSlashFor'), diff --git a/config/set/cakephp38.php b/config/set/cakephp38.php index 16cfdebf9f7..ca1a8f0cccb 100644 --- a/config/set/cakephp38.php +++ b/config/set/cakephp38.php @@ -14,7 +14,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Cake\ORM\Entity', 'visibleProperties', 'getVisible'), ]), ]]); diff --git a/config/set/cakephp40.php b/config/set/cakephp40.php index 971a985ea73..22bcdac9657 100644 --- a/config/set/cakephp40.php +++ b/config/set/cakephp40.php @@ -47,7 +47,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Cake\Form\Form', 'errors', 'getErrors'), new MethodCallRename('Cake\Mailer\Email', 'set', 'setViewVars'), new MethodCallRename('Cake\ORM\EntityInterface', 'unsetProperty', 'unset'), diff --git a/config/set/cakephp41.php b/config/set/cakephp41.php index 47a6323fc25..7c1e9613400 100644 --- a/config/set/cakephp41.php +++ b/config/set/cakephp41.php @@ -22,7 +22,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Cake\Database\Schema\TableSchema', 'getPrimary', 'getPrimaryKey'), new MethodCallRename('Cake\Database\Type\DateTimeType', 'setTimezone', 'setDatabaseTimezone'), new MethodCallRename('Cake\Database\Expression\QueryExpression', 'or_', 'or'), diff --git a/config/set/doctrine-dbal-30.php b/config/set/doctrine-dbal-30.php index 61b6e8827de..8595322e3b8 100644 --- a/config/set/doctrine-dbal-30.php +++ b/config/set/doctrine-dbal-30.php @@ -14,7 +14,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename( 'DBAL\Platforms\AbstractPlatform', 'getVarcharTypeDeclarationSQL', diff --git a/config/set/gmagick_to_imagick.php b/config/set/gmagick_to_imagick.php index ce5f0f7adc5..896a3ce4f6f 100644 --- a/config/set/gmagick_to_imagick.php +++ b/config/set/gmagick_to_imagick.php @@ -22,7 +22,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Gmagick', 'addimage', 'addImage'), new MethodCallRename('Gmagick', 'addnoiseimage', 'addNoiseImage'), new MethodCallRename('Gmagick', 'annotateimage', 'annotateImage'), diff --git a/config/set/guzzle50.php b/config/set/guzzle50.php index acc201ed665..20f79652f31 100644 --- a/config/set/guzzle50.php +++ b/config/set/guzzle50.php @@ -58,7 +58,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('GuzzleHttp\Message\MessageInterface', 'getHeaderLines', 'getHeaderAsArray'), ]), ]]); diff --git a/config/set/kdyby-to-symfony.php b/config/set/kdyby-to-symfony.php index f265a8a63e5..797c57208eb 100644 --- a/config/set/kdyby-to-symfony.php +++ b/config/set/kdyby-to-symfony.php @@ -24,7 +24,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Kdyby\Translation\Translator', 'translate', 'trans'), new MethodCallRename('Kdyby\RabbitMq\IConsumer', 'process', 'execute'), ]), diff --git a/config/set/laravel50.php b/config/set/laravel50.php index 1fa650b5027..cc2d2692939 100644 --- a/config/set/laravel50.php +++ b/config/set/laravel50.php @@ -23,7 +23,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Illuminate\Contracts\Pagination\Paginator', 'links', 'render'), new MethodCallRename('Illuminate\Contracts\Pagination\Paginator', 'getFrom', 'firstItem'), new MethodCallRename('Illuminate\Contracts\Pagination\Paginator', 'getTo', 'lastItem'), diff --git a/config/set/laravel54.php b/config/set/laravel54.php index 2318ece62b9..a70fa4a9f6b 100644 --- a/config/set/laravel54.php +++ b/config/set/laravel54.php @@ -36,7 +36,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Illuminate\Support\Collection', 'every', 'nth'), new MethodCallRename( 'Illuminate\Database\Eloquent\Relations\BelongsToMany', diff --git a/config/set/laravel55.php b/config/set/laravel55.php index 605df6b4a42..bee2bc2d0a5 100644 --- a/config/set/laravel55.php +++ b/config/set/laravel55.php @@ -16,7 +16,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Illuminate\Console\Command', 'fire', 'handle'), ]), ]]); diff --git a/config/set/laravel56.php b/config/set/laravel56.php index 772a627b200..3af1abf1038 100644 --- a/config/set/laravel56.php +++ b/config/set/laravel56.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename( 'Illuminate\Validation\ValidatesWhenResolvedTrait', 'validate', diff --git a/config/set/laravel60.php b/config/set/laravel60.php index 888808381c6..29e75d3735e 100644 --- a/config/set/laravel60.php +++ b/config/set/laravel60.php @@ -32,7 +32,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename( 'Illuminate\Auth\Access\Gate', # https://github.com/laravel/framework/commit/69de466ddc25966a0f6551f48acab1afa7bb9424 diff --git a/config/set/monolog20.php b/config/set/monolog20.php index 6a969b0ddd0..17b6db7015d 100644 --- a/config/set/monolog20.php +++ b/config/set/monolog20.php @@ -13,7 +13,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Monolog\Logger', 'addDebug', 'debug'), new MethodCallRename('Monolog\Logger', 'addInfo', 'info'), new MethodCallRename('Monolog\Logger', 'addNotice', 'notice'), diff --git a/config/set/nette-30.php b/config/set/nette-30.php index e3d96d669d8..072b4d502c6 100644 --- a/config/set/nette-30.php +++ b/config/set/nette-30.php @@ -119,13 +119,13 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) // @see https://github.com/nette/forms/commit/b99385aa9d24d729a18f6397a414ea88eab6895a ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Nette\Forms\Controls\BaseControl', 'setAttribute', 'setHtmlAttribute'), ]), ]]); $services->set(RenameMethodRector::class)->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename( 'Nette\Forms\Controls\BaseControl', # see https://github.com/nette/forms/commit/b99385aa9d24d729a18f6397a414ea88eab6895a diff --git a/config/set/nette-to-symfony.php b/config/set/nette-to-symfony.php index 2c109cb9d51..5a55b44985e 100644 --- a/config/set/nette-to-symfony.php +++ b/config/set/nette-to-symfony.php @@ -57,7 +57,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Nette\Application\IPresenter', 'run', '__invoke'), new MethodCallRename('Nette\DI\Container', 'getByType', 'get'), new MethodCallRename('Nette\Configurator', 'addConfig', 'load'), diff --git a/config/set/phalcon40.php b/config/set/phalcon40.php index 8fae84e6052..f6af5106cef 100644 --- a/config/set/phalcon40.php +++ b/config/set/phalcon40.php @@ -108,7 +108,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Phalcon\Acl\AdapterInterface', 'isResource', 'isComponent'), new MethodCallRename('Phalcon\Acl\AdapterInterface', 'addResource', 'addComponent'), new MethodCallRename('Phalcon\Acl\AdapterInterface', 'addResourceAccess', 'addComponentAccess'), diff --git a/config/set/phpexcel-to-phpspreadsheet.php b/config/set/phpexcel-to-phpspreadsheet.php index 252fe12ecaa..0f305720674 100644 --- a/config/set/phpexcel-to-phpspreadsheet.php +++ b/config/set/phpexcel-to-phpspreadsheet.php @@ -60,7 +60,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { # beware! this can be run only once, since its circular change $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ // https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#worksheetsetsharedstyle new MethodCallRename('PHPExcel_Worksheet', 'setSharedStyle', 'duplicateStyle'), // https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#worksheetgetselectedcell diff --git a/config/set/phpspec30.php b/config/set/phpspec30.php index 492ae64052b..b8d4a2cad5f 100644 --- a/config/set/phpspec30.php +++ b/config/set/phpspec30.php @@ -13,7 +13,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ // @see http://www.phpspec.net/en/stable/manual/upgrading-to-phpspec-3.html new MethodCallRename('PhpSpec\ServiceContainer', 'set', 'define'), new MethodCallRename('PhpSpec\ServiceContainer', 'setShared', 'define'), diff --git a/config/set/phpunit-exception.php b/config/set/phpunit-exception.php index dfe0e251f5c..cc70ee89d50 100644 --- a/config/set/phpunit-exception.php +++ b/config/set/phpunit-exception.php @@ -19,7 +19,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('PHPUnit\Framework\TestClass', 'setExpectedException', 'expectedException'), new MethodCallRename('PHPUnit\Framework\TestClass', 'setExpectedExceptionRegExp', 'expectedException'), ]), diff --git a/config/set/phpunit40.php b/config/set/phpunit40.php index ba9e0cd3a33..a0cd2a23845 100644 --- a/config/set/phpunit40.php +++ b/config/set/phpunit40.php @@ -12,7 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename( 'PHPUnit_Framework_MockObject_MockObject', # see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/137 diff --git a/config/set/phpunit60.php b/config/set/phpunit60.php index dec72ca73fb..0c90bd9ac18 100644 --- a/config/set/phpunit60.php +++ b/config/set/phpunit60.php @@ -18,7 +18,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('PHPUnit\Framework\TestCase', 'createMockBuilder', 'getMockBuilder'), ]), ]]); diff --git a/config/set/phpunit90.php b/config/set/phpunit90.php index 087383e3063..63c290a7b28 100644 --- a/config/set/phpunit90.php +++ b/config/set/phpunit90.php @@ -22,7 +22,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ // see https://github.com/sebastianbergmann/phpunit/issues/3957 - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename( 'PHPUnit\Framework\TestCase', 'expectExceptionMessageRegExp', diff --git a/config/set/phpunit91.php b/config/set/phpunit91.php index 8e0abf64cf0..dbf0cb9dcf3 100644 --- a/config/set/phpunit91.php +++ b/config/set/phpunit91.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('PHPUnit\Framework\TestCase', 'assertFileNotExists', 'assertFileDoesNotExist'), ]), ]]); diff --git a/config/set/shopware56.php b/config/set/shopware56.php index 38671bef746..abdbb6d2928 100644 --- a/config/set/shopware56.php +++ b/config/set/shopware56.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Enlight_Controller_Response_Response', 'getHttpResponseCode', 'getStatusCode'), new MethodCallRename('Enlight_Controller_Response_Response', 'setHttpResponseCode', 'setStatusCode'), new MethodCallRename('Enlight_Controller_Response_Response', 'sendCookies', 'sendHeaders'), diff --git a/config/set/sylius10.php b/config/set/sylius10.php index 4afe58b92a7..e3fb492fee5 100644 --- a/config/set/sylius10.php +++ b/config/set/sylius10.php @@ -16,7 +16,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ // source: https://github.com/Sylius/Sylius/blob/master/UPGRADE-1.0.md#upgrade-from-100-beta3-to-100 new MethodCallRename( 'Sylius\Component\Core\Repository\OrderRepositoryInterface', diff --git a/config/set/symfony30.php b/config/set/symfony30.php index df52948899e..eec41664cb2 100644 --- a/config/set/symfony30.php +++ b/config/set/symfony30.php @@ -67,7 +67,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ // class loader new MethodCallRename( 'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader', diff --git a/config/set/symfony33.php b/config/set/symfony33.php index 7170c0c3dcb..c50ae9484bb 100644 --- a/config/set/symfony33.php +++ b/config/set/symfony33.php @@ -65,7 +65,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Symfony\Component\DependencyInjection\Container', 'isFrozen', 'isCompiled'), ]), ]]); diff --git a/config/set/symfony41.php b/config/set/symfony41.php index adc904562ab..cf09f1c7c6f 100644 --- a/config/set/symfony41.php +++ b/config/set/symfony41.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ # https://github.com/symfony/symfony/commit/463f986c28a497571967e37c1314e9911f1ef6ba new MethodCallRename( 'Symfony\Component\Console\Helper\TableStyle', diff --git a/config/set/symfony42.php b/config/set/symfony42.php index 809cd213e65..01dff8b215c 100644 --- a/config/set/symfony42.php +++ b/config/set/symfony42.php @@ -121,7 +121,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Symfony\Component\Cache\CacheItem', 'getPreviousTags', 'getMetadata'), new MethodCallRename( 'Symfony\Component\Form\AbstractTypeExtension', diff --git a/config/set/symfony43.php b/config/set/symfony43.php index 98fb592772c..2dc683c9787 100644 --- a/config/set/symfony43.php +++ b/config/set/symfony43.php @@ -21,7 +21,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Symfony\Component\BrowserKit\Response', 'getStatus', 'getStatusCode'), new MethodCallRename('Symfony\Component\Security\Http\Firewall', 'handleRequest', 'callListeners'), ]), diff --git a/config/set/symfony50.php b/config/set/symfony50.php index 06e885e9c5f..dbaa42e03b3 100644 --- a/config/set/symfony50.php +++ b/config/set/symfony50.php @@ -24,7 +24,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Symfony\Component\Console\Application', 'renderException', 'renderThrowable'), new MethodCallRename( 'Symfony\Component\Console\Application', diff --git a/config/set/twig127.php b/config/set/twig127.php index 38b8d60f896..4781ac05fe2 100644 --- a/config/set/twig127.php +++ b/config/set/twig127.php @@ -12,7 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => inline_value_objects([ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([ new MethodCallRename('Twig_Node', 'getLine', 'getTemplateLine'), new MethodCallRename('Twig_Node', 'getFilename', 'getTemplateName'), new MethodCallRename('Twig_Template', 'getSource', 'getSourceContext'), diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index 9834ddb8580..b929e8dfd37 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -12618,7 +12618,7 @@ return function (ContainerConfigurator $containerConfigurator) : void { $services = $containerConfigurator->services(); $services->set(RenameMethodRector::class) ->call('configure', [[ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => [ + RenameMethodRector::METHOD_CALL_RENAMES => [ \Rector\SymfonyPhpConfig\inline_object(new Rector\Renaming\ValueObject\MethodCallRename('SomeExampleClass', 'oldMethod', 'newMethod'))] ]]); }; diff --git a/rector-temp-phpstan191602.neon b/rector-temp-phpstan191602.neon deleted file mode 100644 index b4e7430830e..00000000000 --- a/rector-temp-phpstan191602.neon +++ /dev/null @@ -1,409 +0,0 @@ -includes: - - utils/phpstan-extensions/config/phpstan-extensions.neon - - vendor/slam/phpstan-extensions/conf/slam-rules.neon - - vendor/symplify/phpstan-extensions/config/config.neon - - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon - - # see https://github.com/symplify/coding-standard - - vendor/symplify/coding-standard/config/symplify-rules.neon - -rules: - # should be fixed in next part of symplify CS release - - Symplify\CodingStandard\Rules\NoClassWithStaticMethodWithoutStaticNameRule - - Symplify\CodingStandard\Rules\SeeAnnotationToTestRule - -services: - # this rule prevents bug in phar like these: https://github.com/rectorphp/rector/pull/3692/files - - - class: Rector\PHPStanExtensions\Rule\RequireStringArgumentInMethodCallRule - tags: [phpstan.rules.rule] - arguments: - constantArgByMethodByType: - Rector\Core\Rector\AbstractRector: - isObjectType: [1] - -parameters: - level: max - - # see https://github.com/symplify/coding-standard - symplify: - max_cognitive_complexity: 9 # default: 8 - max_class_cognitive_complexity: 50 - - parent_classes: - - Rector - - required_see_types: - - PHPStan\Rules\Rule - - Rector\Core\Rector\AbstractRector - - Rector\FileSystemRector\Rector\AbstractFileSystemRector - - old_to_preffered_classes: - # prevent PHPStorm autocomplete mess - 'Symfony\Component\DependencyInjection\Variable': 'PhpParser\Node\Expr\Variable' - 'phpDocumentor\Reflection\Types\Expression': 'PhpParser\Node\Stmt\Expression' - 'phpDocumentor\Reflection\DocBlock\Tags\Param': 'PhpParser\Node\Param' - 'phpDocumentor\Reflection\DocBlock\Tags\Return_': 'PhpParser\Node\Stmt\Return_' - 'Closure': 'PhpParser\Node\Expr\Closure' - 'PHPUnit\TextUI\Configuration\Variable': 'PhpParser\Node\Expr\Variable' - 'PhpCsFixer\FixerDefinition\CodeSample': 'Rector\Core\RectorDefinition\CodeSample' - 'SebastianBergmann\Type\MixedType': 'PHPStan\Type\MixedType' - 'Hoa\Protocol\Node\Node': 'PhpParser\Node' - - # to allow installing with various phsptan versions without reporting old errors here - reportUnmatchedIgnoredErrors: false - - checkGenericClassInNonGenericObjectType: false - - scanDirectories: - - stubs - - bootstrapFiles: - - vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php - - paths: - - bin - - src - - rules - - packages - - tests - - compiler/src - - utils - # this cannot be put it, because it wipes PHPStan cache on each run :( - must run in separate - #- config/set - - excludes_analyse: - # iterable types - - '#with no value type specified in iterable type array#' - - '#type specified in iterable type (array|iterable)#' - - # phsptan bug - - utils/phpstan-extensions/src/Rule/PreventParentMethodVisibilityOverrideRule.php - - utils/phpstan-extensions/src/Rule/KeepRectorNamespaceForRectorRule.php - - packages/rector-generator/templates/* - - # generated files - - 'packages/doctrine-annotation-generated/src/ConstantPreservingDocParser.php' - - 'packages/doctrine-annotation-generated/src/ConstantPreservingAnnotationReader.php' - - - "*/Expected/*" - # complex printer - - '*tests/Rector/MethodCall/RenameMethodRector/**/SomeClass.php' - # tests files - - '*tests/*/Fixture/*' - - '*tests/*/Source/*' - - '*tests/Source/*' - # part of composer - - '*/tests/Rector/Psr4/MultipleClassFileToPsr4ClassesRector/Expected/Just*ExceptionWithoutNamespace.php' - - ignoreErrors: - # @todo remove - # iterable types - - '#with no value type specified in iterable type array#' - - '#type specified in iterable type (array|iterable)#' - - # false positive - - '#PHPDoc tag \@param for parameter \$node with type float is incompatible with native type PhpParser\\Node#' - - # misuse of interface and class - - '#Parameter \#1 (.*?) expects Symfony\\Component\\DependencyInjection\\ContainerBuilder, Symfony\\Component\\DependencyInjection\\ContainerInterface given#' - - '#Strict comparison using === between string and null will always evaluate to false#' - - # false positive - type is set by annotation above - - '#Array \(array\) does not accept PhpParser\\Node#' - - # irrelevant - - '#Call to function in_array\(\) with arguments string, (.*?) and true will always evaluate to false#' - - # known values - - '#Access to an undefined property PhpParser\\Node\\Expr::\$right#' - - - '#Access to an undefined property PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Stmt\\ClassMethod::\$params#' - - '#Cannot call method getName\(\) on PHPStan\\Reflection\\ClassReflection\|null#' - - # false positive, has annotation type above - - '#Method Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:matchReturnOrAssignNode\(\) should return PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Stmt\\Return_\|null but returns PhpParser\\Node\|null#' - - '#Access to an undefined property PhpParser\\Node::\$(\w+)#' - - # intentionally incorrect - part of the test - - '#Parameter \#2 \$codeSamples of class Rector\\Core\\RectorDefinition\\RectorDefinition constructor expects array, array given#' - - # known values - - '#Cannot access property \$value on PhpParser\\Node\\Expr\\ArrayItem\|null#' - - # known values - - '#Strict comparison using === between PhpParser\\Node\\Expr and null will always evaluate to false#' - - - '#Access to an undefined property PhpParser\\Node\\Stmt\:\:\$expr#' - - '#Cannot access property \$stmts on PhpParser\\Node\\Stmt\\Else_\|null#' - - # node finder - - '#Method Rector\\(.*?) should return array but returns array#' - - # part of test - - '#(.*?)(AttributeAwareNodeInterface|AttributeAware(.*?)TagValueNode)(.*?)#' - - - '#Parameter \#1 \$children of class PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode constructor expects array, array given#' - - '#Method Rector\\PHPUnit\\Rector\\MethodCall\\ReplaceAssertArraySubsetRector\:\:matchArray\(\) should return PhpParser\\Node\\Expr\\Array_\|null but returns PhpParser\\Node\\Expr#' - - - '#(.*?)PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable given#' - - # false positive 0.11.5 - - '#Unreachable statement \- code above always terminates#' - - '#Negated boolean expression is always true#' - - '#Strict comparison using \=\=\= between PhpParser\\Node and null will always evaluate to false#' - - # known types - - '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable\:\:\$name#' - - '#Strict comparison using \=\=\= between PhpParser\\Node\\Expr\\ArrayItem and null will always evaluate to false#' - - '#Parameter \#2 \.\.\.\$args of function array_merge expects array, array\|false given#' - - '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$args#' - - - '#Parameter \#2 \$name of method Rector\\Core\\Rector\\AbstractRector\:\:isName\(\) expects string, string\|null given#' - # cascade irrelevant - - '#Parameter (.*?) expects array, array given#' - - # known value - - '#Cannot cast array\|bool\|string\|null to string#' - - - # array is callable - - '#If condition is always true#' - - - '#Ternary operator condition is always true#' - - - '#Access to an undefined property PhpParser\\Node\\FunctionLike\|PhpParser\\Node\\Stmt\\ClassLike\:\:\$stmts#' - - - '#Property Rector\\TypeDeclaration\\TypeInferer\\(.*?)\:\:\$(.*?)TypeInferers \(array\) does not accept array#' - # sense-less errors - - # 3rd party - - - message: '#Use default null value and nullable compare instead of isset on object#' - path: 'rules/symfony/src/ServiceMapProvider.php' - - # PHP 7.4 1_000 support - - '#Property PhpParser\\Node\\Scalar\\DNumber\:\:\$value \(float\) does not accept string#' - - '#Call to function is_string\(\) with float will always evaluate to false#' - - - '#Method Rector\\Doctrine\\Rector\\MethodCall\\ChangeSetIdToUuidValueRector\:\:getSetUuidMethodCallOnSameVariable\(\) should return PhpParser\\Node\\Expr\\MethodCall\|null but returns PhpParser\\Node\|null#' - - # known value - - '#Method Rector\\StrictCodeQuality\\Rector\\Stmt\\VarInlineAnnotationToAssertRector\:\:findVariableByName\(\) should return PhpParser\\Node\\Expr\\Variable\|null but returns PhpParser\\Node\|null#' - - - '#Method Rector\\NodeTypeResolver\\PHPStan\\Type\\TypeFactory\:\:createUnionOrSingleType\(\) should return PHPStan\\Type\\MixedType\|PHPStan\\Type\\UnionType but returns PHPStan\\Type\\Type#' - - # test - - '#Class Rector\\DynamicTypeAnalysis\\Tests\\Rector\\ClassMethod\\AddArgumentTypeWithProbeDataRector\\Fixture\\SomeClass not found#' - - - - message: '#Class Rector\\Generic\\Tests\\Rector\\StaticCall\\SwapClassMethodArgumentsRector\\Fixture\\SomeClass not found#' - path: rules/generic/tests/Rector/StaticCall/SwapClassMethodArgumentsRector/SwapClassMethodArgumentsRectorTest.php - - # internal rule - - '#Class "Rector\\Utils\\(.*?)" is missing @see annotation with test case class reference#' - - # mixed - - '#Offset int\|string\|null does not exist on array\|null#' - - '#class-string\|T of object#' - - # known values - - '#Offset 0 does not exist on array\|null#' - - '#Parameter \#1 \$left of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#' - - '#Parameter \#2 \$right of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#' - - '#Parameter \#3 \$nodeCallback of method PHPStan\\Analyser\\NodeScopeResolver::processNodes\(\) expects Closure\(PhpParser\\Node, PHPStan\\Analyser\\Scope\): void, Closure\(PhpParser\\Node, PHPStan\\Analyser\\MutatingScope\): void given#' - - # false positive - - '#Comparison operation "<" between 0 and 2 is always true#' - - - '#Method Rector\\Symfony\\Rector\\MethodCall\\AbstractToConstructorInjectionRector\:\:getServiceTypeFromMethodCallArgument\(\) should return PHPStan\\Type\\Type but returns PHPStan\\Type\\Type\|null#' - - - '#Parameter \#1 \$expected of method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) expects class\-string, string given#' - - '#Unable to resolve the template type ExpectedType in call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\)#' - - # fix Symplify 7.2 later - - '#Method (.*?) returns bool type, so the name should start with is/has/was#' - - # known value - - '#Cannot cast \(array\)\|string\|true to string#' - - - '#In method "Rector\\BetterPhpDocParser\\AnnotationReader\\NodeAnnotationReader\:\:createPropertyReflectionFromPropertyNode", caught "Throwable" must be rethrown\. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception\. More info\: http\://bit\.ly/failloud#' - # doc is not enough - - '#Result of \|\| is always true#' - - # known value - - '#Parameter \#2 \$name of class PhpParser\\Node\\Expr\\MethodCall constructor expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Identifier\|string, string\|null given#' - - - '#Parameter \#1 \$eventListenerTag of method Rector\\SymfonyCodeQuality\\Rector\\Class_\\EventListenerToEventSubscriberRector\:\:createEventItem\(\) expects Rector\\Symfony\\ValueObject\\Tag\\EventListenerTag, Rector\\Symfony\\Contract\\Tag\\TagInterface given#' - - '#Method Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfoFactory\:\:parseTokensToPhpDocNode\(\) should return Rector\\AttributeAwarePhpDoc\\Ast\\PhpDoc\\AttributeAwarePhpDocNode but returns PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode#' - - - '#Property PhpParser\\Node\\Stmt\\Expression\:\:\$expr \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#' - - '#Call to an undefined method PHPStan\\Type\\Type\:\:getClassName\(\)#' - - '#Parameter \#1 \$typeNode of method Rector\\StaticTypeMapper\\StaticTypeMapper\:\:mapPHPStanPhpDocTypeNodeToPHPStanType\(\) expects PHPStan\\PhpDocParser\\Ast\\Type\\TypeNode, PHPStan\\PhpDocParser\\Ast\\Node given#' - - '#Parameter \#1 \$str of function preg_quote expects string, int\|string given#' - - - '#Parameter \#1 \$sprintfFuncCall of method Rector\\Core\\PhpParser\\NodeTransformer\:\:transformSprintfToArray\(\) expects PhpParser\\Node\\Expr\\FuncCall, PhpParser\\Node given#' - - '#Parameter \#1 \$nodes of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:find\(\) expects array\|PhpParser\\Node, array\|null given#' - - '#Method Rector\\SOLID\\Reflection\\ParentConstantReflectionResolver\:\:(.*?)\(\) should return ReflectionClassConstant\|null but returns ReflectionClassConstant\|false#' - - '#Parameter \#1 \$firstStmt of method Rector\\Generic\\Rector\\ClassMethod\\NormalToFluentRector\:\:isBothMethodCallMatch\(\) expects PhpParser\\Node\\Stmt\\Expression, PhpParser\\Node\\Stmt given#' - - '#Method Rector\\Core\\Rector\\AbstractRector\:\:wrapToArg\(\) should return array but returns array#' - - - '#Method Rector\\FileSystemRector\\Rector\\AbstractFileSystemRector\:\:wrapToArg\(\) should return array but returns array#' - - '#Cannot call method (.*?)\(\) on Rector\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfo\|null#' - - - '#Parameter \#(.*?) (.*?) of class PhpParser\\Node\\Expr\\BinaryOp\\(.*?) constructor expects PhpParser\\Node\\Expr, PhpParser\\Node given#' - - - '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$description#' - - - '#Method Rector\\Php80\\Rector\\NotIdentical\\StrContainsRector\:\:matchNotIdenticalToFalse\(\) should return PhpParser\\Node\\Expr\\FuncCall\|null but returns PhpParser\\Node\\Expr#' - - - '#Parameter \#2 \$name of method Rector\\Core\\Rector\\AbstractRector\:\:isVariableName\(\) expects string, string\|null given#' - - # node finder - - '#Method Rector\\Core\\PhpParser\\Node\\Manipulator\\MethodCallManipulator\:\:findAssignToVariableName\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#' - - # broken - - '#Cannot call method getParentNode\(\) on Rector\\DeadCode\\ValueObject\\VariableNodeUse\|null#' - - '#Method Rector\\DeadCode\\NodeFinder\\PreviousVariableAssignNodeFinder\:\:find\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#' - - '#Parameter \#2 \$name of method Rector\\NodeNameResolver\\NodeNameResolver\:\:isName\(\) expects string, string\|null given#' - - '#Method Rector\\PHPOffice\\Rector\\MethodCall\\IncreaseColumnIndexRector\:\:findVariableAssignName\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#' - - - '#Parameter \#1 \$keyName of method Rector\\AttributeAwarePhpDoc\\Ast\\Type\\AttributeAwareArrayShapeItemNode\:\:createKeyWithSpacePattern\(\) expects PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode\|PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode\|null, PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode\|PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprStringNode\|PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode\|null given#' - - '#Method Rector\\Caching\\ChangedFilesDetector\:\:hashFile\(\) should return string but returns string\|false#' - - - '#If condition is always false#' - - - '#Parameter \#1 \$funcCall of method Rector\\Php80\\MatchAndRefactor\\StrStartsWithMatchAndRefactor\\AbstractMatchAndRefactor\:\:createStrStartsWithValueObjectFromFuncCall\(\) expects PhpParser\\Node\\Expr\\FuncCall, PhpParser\\Node\\Expr given#' - - # mostly strings in tests - - '#Class (.*?) should be written with \:\:class notation, string found#' - - '#Parameter \#2 \$key of method Rector\\BetterPhpDocParser\\PhpDocNode\\AbstractTagValueNode\:\:printArrayItem\(\) expects string\|null, int\|string given#' - - '#Method Rector\\Naming\\Naming\\PropertyNaming\:\:resolveShortClassName\(\) should return string but returns string\|null#' - - - - message: "#in iterable type Iterator#" - paths: - - *Test.php - - *TestCase.php - - - - message: "#^Cognitive complexity for \"Rector\\\\BetterPhpDocParser\\\\Printer\\\\WhitespaceDetector\\:\\:detectOldWhitespaces\\(\\)\" is 18, keep it under 9$#" - count: 1 - path: packages/better-php-doc-parser/src/Printer/WhitespaceDetector.php - - - - message: "#^Parameter \\#1 \\$input of function array_splice expects array, array\\\\|null given\\.$#" - count: 1 - path: rules/coding-style/src/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php - - - - message: "#^Cognitive complexity for \"Rector\\\\PhpSpecToPHPUnit\\\\Rector\\\\MethodCall\\\\PhpSpecPromisesToPHPUnitAssertRector\\:\\:refactor\\(\\)\" is 13, keep it under 9$#" - count: 1 - path: rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php - - - - message: "#^Class cognitive complexity for \"EregToPcreTransformer\" is (.*?), keep it under 50$#" - path: rules/php70/src/EregToPcreTransformer.php - - - - message: "#Use explicit property fetch names over dynamic#" - path: packages/doctrine-annotation-generated/src/PhpDocNode/ConstantReferenceIdentifierRestorer.php - - - "#^Cognitive complexity for \"Rector\\\\Php70\\\\EregToPcreTransformer\\:\\:(.*?)\" is (.*?), keep it under 9$#" - - - '#Use explicit return value over magic &reference#' - - - '#In method "Rector\\Utils\\ProjectValidator\\Process\\ParallelTaskRunner\:\:(.*?)", caught "Throwable" must be rethrown\. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception#' - # weird - - - '#Method (.*?) specified in iterable type Symfony\\Component\\Process\\Process#' - - '#Cannot cast PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Identifier to string#' - - '#Class cognitive complexity for "DumpNodesCommand" is \d+, keep it under 50#' - - '#Cognitive complexity for "Rector\\Utils\\DocumentationGenerator\\Command\\DumpNodesCommand\:\:execute\(\)" is \d+, keep it under 9#' - - - '#Parameter \#1 \$node of method Rector\\PostRector\\Collector\\NodesToAddCollector\:\:wrapToExpression\(\) expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt, PhpParser\\Node given#' - - '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$class#' - - '#Method Rector\\BetterPhpDocParser\\Tests\\PhpDocParser\\AbstractPhpDocInfoTest\:\:parseFileAndGetFirstNodeOfType\(\) should return PhpParser\\Node but returns PhpParser\\Node\|null#' - - '#Property PhpParser\\Node\\Stmt\\Namespace_\:\:\$stmts \(array\) does not accept array#' - - - '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\Type\\ObjectTypeSpecifier\:\:matchShortenedObjectType\(\)" is 10, keep it under 9#' - - '#Parameter \#1 \$type of method PhpParser\\Builder\\FunctionLike\:\:setReturnType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#' - - '#Cognitive complexity for "Rector\\Core\\PhpParser\\Node\\Value\\ValueResolver\:\:getValue\(\)" is \d+, keep it under 9#' - - '#Cognitive complexity for "Rector\\NetteKdyby\\ContributeEventClassResolver\:\:resolveGetterMethodByEventClassAndParam\(\)" is \d+, keep it under 9#' - - '#Parameter \#1 \$type of class PhpParser\\Node\\NullableType constructor expects PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#' - - '#Parameter \#1 \$object of function get_class expects object, PhpParser\\Node\|null given#' - - '#Class "Rector\\FileSystemRector\\Rector\\Removing\\RemoveProjectFileRector" is missing @see annotation with test case class reference#' - - '#Parameter \#1 \$type of method PhpParser\\Builder\\Param\:\:setType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#' - - '#Parameter \#1 \$node of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findFirstAncestorInstanceOf\(\) expects PhpParser\\Node, PhpParser\\Node\\Expr\\Variable\|null given#' - - '#Parameter \#1 \$objectType of method Rector\\Naming\\Naming\\PropertyNaming\:\:fqnToVariableName\(\) expects PHPStan\\Type\\ObjectType\|string, PHPStan\\Type\\Type given#' - - '#Method Rector\\Core\\PhpParser\\Node\\NodeFactory\:\:createConcat\(\) should return PhpParser\\Node\\Expr\\BinaryOp\\Concat\|null but returns PhpParser\\Node\\Expr#' - - '#Method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findFirstNonAnonymousClass\(\) should return PhpParser\\Node\\Stmt\\Class_\|null but returns PhpParser\\Node\|null#' - # known value - - '#Property PhpParser\\Node\\Stmt\\Foreach_\:\:\$valueVar \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#' - - '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$type#' - - # local type - - - message: '#Method call "isObjectType\(\)" argument on position 1 cannot use "\:\:class" reference#' - path: 'packages/dynamic-type-analysis/src/Rector/StaticCall/RemoveArgumentTypeProbeRector.php' - - # only local use - - - message: '#Class "Rector\\RectorGenerator\\Rector\\Closure\\AddNewServiceToSymfonyPhpConfigRector" is missing @see annotation with test case class reference#' - path: 'packages/rector-generator/src/Rector/Closure/AddNewServiceToSymfonyPhpConfigRector.php' - - - '#Call to an undefined method PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Identifier\:\:toString\(\)#' - - '#Class Rector\\Renaming\\Tests\\Rector\\MethodCall\\RenameMethodRector\\Fixture\\SkipSelfMethodRename not found#' - - # fixed in symplfiy dev - - - message: '#Separate function "Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ref\(\)" in method call to standalone row to improve readability#' - path: 'packages/rector-generator/config/config.php' - - - '#Method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findPreviousAssignToExpr\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#' - - '#Parameter \#1 \$shortControlString of method Rector\\NetteCodeQuality\\Rector\\Assign\\MakeGetComponentAssignAnnotatedRector\:\:resolveTypeFromShortControlNameAndVariable\(\) expects PhpParser\\Node\\Scalar\\String_, PhpParser\\Node\\Expr\|null given#' - - '#Parameter \#1 \$variable of class Rector\\Php70\\ValueObject\\VariableAssignPair constructor expects PhpParser\\Node\\Expr\\ArrayDimFetch\|PhpParser\\Node\\Expr\\PropertyFetch\|PhpParser\\Node\\Expr\\StaticPropertyFetch\|PhpParser\\Node\\Expr\\Variable, PhpParser\\Node\\Expr given#' - - # is nested expr - - '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$expr#' - - '#Cognitive complexity for "Rector\\DeadCode\\NodeManipulator\\LivingCodeManipulator\:\:keepLivingCodeFromExpr\(\)" is \d+, keep it under 9#' - - '#Parameter \#1 \$files of method Symplify\\SmartFileSystem\\Finder\\FinderSanitizer\:\:sanitize\(\) expects \(iterable&Nette\\Utils\\Finder\)\|Symfony\\Component\\Finder\\Finder, array given#' - - '#Static property Rector\\Core\\Testing\\PHPUnit\\AbstractGenericRectorTestCase\:\:\$allRectorContainer \(Rector\\Naming\\Tests\\Rector\\Class_\\RenamePropertyToMatchTypeRector\\Source\\ContainerInterface\|Symfony\\Component\\DependencyInjection\\Container\|null\) does not accept Psr\\Container\\ContainerInterface#' - # stubs - - '#Static property Symplify\\PackageBuilder\\Tests\\AbstractKernelTestCase\:\:\$container \(Psr\\Container\\ContainerInterface\) does not accept Rector\\Naming\\Tests\\Rector\\Class_\\RenamePropertyToMatchTypeRector\\Source\\ContainerInterface\|Symfony\\Component\\DependencyInjection\\Container#' - - # wtf - - - message: '#Else branch is unreachable because ternary operator condition is always true#' - path: 'rules/psr4/src/Composer/PSR4NamespaceMatcher.php' - - # false positive - - '#Parameter \#1 \$arrayItem of method Rector\\NetteKdyby\\NodeResolver\\ListeningMethodsCollector\:\:resolveCustomClassMethodAndEventClass\(\) expects PhpParser\\Node\\Expr\\ArrayItem, PhpParser\\Node given#' - - '#Parameter \#1 \$type of method Rector\\NodeCollector\\NodeCollector\\ParsedNodeCollector\:\:getNodesByType\(\) expects class\-string, string given#' - - - '#Class with base "(.*?)" name is already used in "_HumbugBox(.*?)"#' - - - - message: '#Class "Rector\\RectorGenerator\\ValueObject\\RectorRecipe" has invalid namespace category "ValueObject"\. Pick one of\: ""#' - path: packages/rector-generator/src/ValueObject/RectorRecipe.php - - - '#Parameter \#2 \$currentNode of method Rector\\CodingStyle\\Rector\\Assign\\ManualJsonStringToJsonEncodeArrayRector\:\:matchNextExprAssignConcatToSameVariable\(\) expects PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Expr\\AssignOp\\Concat, PhpParser\\Node given#' - - - - message: '#Array (with keys|explosion) is not allowed\. Use value object to pass data instead#' - paths: - # working with cvs file - # 3rd party package - - utils/project-validator/src/Command/ValidateFixtureContentCommand.php - - src/Testing/PHPUnit/AbstractRectorTestCase.php - - rules/php70/src/EregToPcreTransformer.php - # output format - - packages/changes-reporting/src/Output/JsonOutputFormatter.php - # template variables - - packages/rector-generator/src/TemplateVariablesFactory.php - # output format to json - - rules/doctrine/src/Collector/UuidMigrationDataCollector.php - # should be replaced by symplify/composer-json-manipulator in the future - - compiler/src/Composer/ComposerJsonManipulator.php - # not sure how to improve - - rules/symfony/src/ValueObject/Tag/EventListenerTag.php diff --git a/rules/renaming/src/Rector/MethodCall/RenameMethodRector.php b/rules/renaming/src/Rector/MethodCall/RenameMethodRector.php index 66174083a7f..b842e35105b 100644 --- a/rules/renaming/src/Rector/MethodCall/RenameMethodRector.php +++ b/rules/renaming/src/Rector/MethodCall/RenameMethodRector.php @@ -20,6 +20,7 @@ use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Renaming\Contract\MethodCallRenameInterface; use Rector\Renaming\ValueObject\MethodCallRename; use Rector\Renaming\ValueObject\MethodCallRenameWithArrayKey; +use Webmozart\Assert\Assert; /** * @see \Rector\Renaming\Tests\Rector\MethodCall\RenameMethodRector\RenameMethodRectorTest @@ -29,7 +30,7 @@ final class RenameMethodRector extends AbstractRector implements ConfigurableRec /** * @var string */ - public const OLD_TO_NEW_METHODS_BY_CLASS = 'old_to_new_methods_by_class'; + public const METHOD_CALL_RENAMES = 'old_to_new_methods_by_class'; /** * @var MethodCallRenameInterface[] @@ -51,7 +52,7 @@ $someObject->newMethod(); PHP , [ - self::OLD_TO_NEW_METHODS_BY_CLASS => [ + self::METHOD_CALL_RENAMES => [ new MethodCallRename('SomeExampleClass', 'oldMethod', 'newMethod'), ], ] @@ -99,7 +100,10 @@ PHP public function configure(array $configuration): void { - $this->methodCallRenames = $configuration[self::OLD_TO_NEW_METHODS_BY_CLASS] ?? []; + $methodCallRenames = $configuration[self::METHOD_CALL_RENAMES] ?? []; + Assert::allIsInstanceOf($methodCallRenames, MethodCallRenameInterface::class); + + $this->methodCallRenames = $methodCallRenames; } /** diff --git a/rules/renaming/tests/Rector/MethodCall/RenameMethodRector/RenameMethodRectorTest.php b/rules/renaming/tests/Rector/MethodCall/RenameMethodRector/RenameMethodRectorTest.php index 64098565160..a307226eb98 100644 --- a/rules/renaming/tests/Rector/MethodCall/RenameMethodRector/RenameMethodRectorTest.php +++ b/rules/renaming/tests/Rector/MethodCall/RenameMethodRector/RenameMethodRectorTest.php @@ -36,7 +36,7 @@ final class RenameMethodRectorTest extends AbstractRectorTestCase { return [ RenameMethodRector::class => [ - RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => [ + RenameMethodRector::METHOD_CALL_RENAMES => [ new MethodCallRename(AbstractType::class, 'setDefaultOptions', 'configureOptions'), new MethodCallRename(Html::class, 'add', 'addHtml'), new MethodCallRename('*Presenter', 'run', '__invoke'),