mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 16:30:51 +00:00
Updated Rector to commit 3e9dbc1ffdc6f28322ab796f566174675cadf559
3e9dbc1ffd
remove CakePHP from checked CI docs
This commit is contained in:
parent
e87c848801
commit
76b7ca392f
|
@ -17,12 +17,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'ff4d797c73a51a3fb12cb644c6911ecd7313ec1b';
|
||||
public const PACKAGE_VERSION = '3e9dbc1ffdc6f28322ab796f566174675cadf559';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-10-02 22:20:04';
|
||||
public const RELEASE_DATE = '2022-10-02 23:47:00';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit8c105ebdf649d4804f7b9f7486b63f67::getLoader();
|
||||
return ComposerAutoloaderInit807a379ce54da5bf6f2d3cb3c62683cc::getLoader();
|
||||
|
|
16
vendor/composer/autoload_classmap.php
vendored
16
vendor/composer/autoload_classmap.php
vendored
|
@ -1120,22 +1120,6 @@ return array(
|
|||
'Rector\\Caching\\ValueObject\\CacheItem' => $baseDir . '/packages/Caching/ValueObject/CacheItem.php',
|
||||
'Rector\\Caching\\ValueObject\\Storage\\FileCacheStorage' => $baseDir . '/packages/Caching/ValueObject/Storage/FileCacheStorage.php',
|
||||
'Rector\\Caching\\ValueObject\\Storage\\MemoryCacheStorage' => $baseDir . '/packages/Caching/ValueObject/Storage/MemoryCacheStorage.php',
|
||||
'Rector\\CakePHP\\ImplicitNameResolver' => $vendorDir . '/rector/rector-cakephp/src/ImplicitNameResolver.php',
|
||||
'Rector\\CakePHP\\Naming\\CakePHPFullyQualifiedClassNameResolver' => $vendorDir . '/rector/rector-cakephp/src/Naming/CakePHPFullyQualifiedClassNameResolver.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\ArrayToFluentCallRector' => $vendorDir . '/rector/rector-cakephp/src/Rector/MethodCall/ArrayToFluentCallRector.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\ModalToGetSetRector' => $vendorDir . '/rector/rector-cakephp/src/Rector/MethodCall/ModalToGetSetRector.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\RemoveIntermediaryMethodRector' => $vendorDir . '/rector/rector-cakephp/src/Rector/MethodCall/RemoveIntermediaryMethodRector.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\RenameMethodCallBasedOnParameterRector' => $vendorDir . '/rector/rector-cakephp/src/Rector/MethodCall/RenameMethodCallBasedOnParameterRector.php',
|
||||
'Rector\\CakePHP\\Rector\\Namespace_\\AppUsesStaticCallToUseStatementRector' => $vendorDir . '/rector/rector-cakephp/src/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php',
|
||||
'Rector\\CakePHP\\Rector\\Property\\ChangeSnakedFixtureNameToPascalRector' => $vendorDir . '/rector/rector-cakephp/src/Rector/Property/ChangeSnakedFixtureNameToPascalRector.php',
|
||||
'Rector\\CakePHP\\Set\\CakePHPLevelSetList' => $vendorDir . '/rector/rector-cakephp/src/Set/CakePHPLevelSetList.php',
|
||||
'Rector\\CakePHP\\Set\\CakePHPSetList' => $vendorDir . '/rector/rector-cakephp/src/Set/CakePHPSetList.php',
|
||||
'Rector\\CakePHP\\ValueObject\\ArrayItemsAndFluentClass' => $vendorDir . '/rector/rector-cakephp/src/ValueObject/ArrayItemsAndFluentClass.php',
|
||||
'Rector\\CakePHP\\ValueObject\\ArrayToFluentCall' => $vendorDir . '/rector/rector-cakephp/src/ValueObject/ArrayToFluentCall.php',
|
||||
'Rector\\CakePHP\\ValueObject\\FactoryMethod' => $vendorDir . '/rector/rector-cakephp/src/ValueObject/FactoryMethod.php',
|
||||
'Rector\\CakePHP\\ValueObject\\ModalToGetSet' => $vendorDir . '/rector/rector-cakephp/src/ValueObject/ModalToGetSet.php',
|
||||
'Rector\\CakePHP\\ValueObject\\RemoveIntermediaryMethod' => $vendorDir . '/rector/rector-cakephp/src/ValueObject/RemoveIntermediaryMethod.php',
|
||||
'Rector\\CakePHP\\ValueObject\\RenameMethodCallBasedOnParameter' => $vendorDir . '/rector/rector-cakephp/src/ValueObject/RenameMethodCallBasedOnParameter.php',
|
||||
'Rector\\ChangesReporting\\Annotation\\AnnotationExtractor' => $baseDir . '/packages/ChangesReporting/Annotation/AnnotationExtractor.php',
|
||||
'Rector\\ChangesReporting\\Annotation\\RectorsChangelogResolver' => $baseDir . '/packages/ChangesReporting/Annotation/RectorsChangelogResolver.php',
|
||||
'Rector\\ChangesReporting\\Collector\\AffectedFilesCollector' => $baseDir . '/packages/ChangesReporting/Collector/AffectedFilesCollector.php',
|
||||
|
|
1
vendor/composer/autoload_psr4.php
vendored
1
vendor/composer/autoload_psr4.php
vendored
|
@ -18,7 +18,6 @@ return array(
|
|||
'Rector\\Laravel\\' => array($vendorDir . '/rector/rector-laravel/src'),
|
||||
'Rector\\Doctrine\\' => array($vendorDir . '/rector/rector-doctrine/src'),
|
||||
'Rector\\Core\\' => array($baseDir . '/src'),
|
||||
'Rector\\CakePHP\\' => array($vendorDir . '/rector/rector-cakephp/src'),
|
||||
'Rector\\' => array($baseDir . '/packages', $baseDir . '/rules', $vendorDir . '/rector/rector-downgrade-php/src', $vendorDir . '/rector/rector-downgrade-php/rules'),
|
||||
'RectorPrefix202210\\Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
|
||||
'RectorPrefix202210\\Symplify\\EasyParallel\\' => array($vendorDir . '/symplify/easy-parallel/src'),
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit8c105ebdf649d4804f7b9f7486b63f67
|
||||
class ComposerAutoloaderInit807a379ce54da5bf6f2d3cb3c62683cc
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit8c105ebdf649d4804f7b9f7486b63f67
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8c105ebdf649d4804f7b9f7486b63f67', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit807a379ce54da5bf6f2d3cb3c62683cc', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8c105ebdf649d4804f7b9f7486b63f67', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit807a379ce54da5bf6f2d3cb3c62683cc', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit807a379ce54da5bf6f2d3cb3c62683cc::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit807a379ce54da5bf6f2d3cb3c62683cc::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire8c105ebdf649d4804f7b9f7486b63f67($fileIdentifier, $file);
|
||||
composerRequire807a379ce54da5bf6f2d3cb3c62683cc($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit8c105ebdf649d4804f7b9f7486b63f67
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire8c105ebdf649d4804f7b9f7486b63f67($fileIdentifier, $file)
|
||||
function composerRequire807a379ce54da5bf6f2d3cb3c62683cc($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
29
vendor/composer/autoload_static.php
vendored
29
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67
|
||||
class ComposerStaticInit807a379ce54da5bf6f2d3cb3c62683cc
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -35,7 +35,6 @@ class ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67
|
|||
'Rector\\Laravel\\' => 15,
|
||||
'Rector\\Doctrine\\' => 16,
|
||||
'Rector\\Core\\' => 12,
|
||||
'Rector\\CakePHP\\' => 15,
|
||||
'Rector\\' => 7,
|
||||
'RectorPrefix202210\\Webmozart\\Assert\\' => 36,
|
||||
'RectorPrefix202210\\Symplify\\EasyParallel\\' => 41,
|
||||
|
@ -124,10 +123,6 @@ class ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67
|
|||
array (
|
||||
0 => __DIR__ . '/../..' . '/src',
|
||||
),
|
||||
'Rector\\CakePHP\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/rector/rector-cakephp/src',
|
||||
),
|
||||
'Rector\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/packages',
|
||||
|
@ -1380,22 +1375,6 @@ class ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67
|
|||
'Rector\\Caching\\ValueObject\\CacheItem' => __DIR__ . '/../..' . '/packages/Caching/ValueObject/CacheItem.php',
|
||||
'Rector\\Caching\\ValueObject\\Storage\\FileCacheStorage' => __DIR__ . '/../..' . '/packages/Caching/ValueObject/Storage/FileCacheStorage.php',
|
||||
'Rector\\Caching\\ValueObject\\Storage\\MemoryCacheStorage' => __DIR__ . '/../..' . '/packages/Caching/ValueObject/Storage/MemoryCacheStorage.php',
|
||||
'Rector\\CakePHP\\ImplicitNameResolver' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ImplicitNameResolver.php',
|
||||
'Rector\\CakePHP\\Naming\\CakePHPFullyQualifiedClassNameResolver' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Naming/CakePHPFullyQualifiedClassNameResolver.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\ArrayToFluentCallRector' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Rector/MethodCall/ArrayToFluentCallRector.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\ModalToGetSetRector' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Rector/MethodCall/ModalToGetSetRector.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\RemoveIntermediaryMethodRector' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Rector/MethodCall/RemoveIntermediaryMethodRector.php',
|
||||
'Rector\\CakePHP\\Rector\\MethodCall\\RenameMethodCallBasedOnParameterRector' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Rector/MethodCall/RenameMethodCallBasedOnParameterRector.php',
|
||||
'Rector\\CakePHP\\Rector\\Namespace_\\AppUsesStaticCallToUseStatementRector' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php',
|
||||
'Rector\\CakePHP\\Rector\\Property\\ChangeSnakedFixtureNameToPascalRector' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Rector/Property/ChangeSnakedFixtureNameToPascalRector.php',
|
||||
'Rector\\CakePHP\\Set\\CakePHPLevelSetList' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Set/CakePHPLevelSetList.php',
|
||||
'Rector\\CakePHP\\Set\\CakePHPSetList' => __DIR__ . '/..' . '/rector/rector-cakephp/src/Set/CakePHPSetList.php',
|
||||
'Rector\\CakePHP\\ValueObject\\ArrayItemsAndFluentClass' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ValueObject/ArrayItemsAndFluentClass.php',
|
||||
'Rector\\CakePHP\\ValueObject\\ArrayToFluentCall' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ValueObject/ArrayToFluentCall.php',
|
||||
'Rector\\CakePHP\\ValueObject\\FactoryMethod' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ValueObject/FactoryMethod.php',
|
||||
'Rector\\CakePHP\\ValueObject\\ModalToGetSet' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ValueObject/ModalToGetSet.php',
|
||||
'Rector\\CakePHP\\ValueObject\\RemoveIntermediaryMethod' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ValueObject/RemoveIntermediaryMethod.php',
|
||||
'Rector\\CakePHP\\ValueObject\\RenameMethodCallBasedOnParameter' => __DIR__ . '/..' . '/rector/rector-cakephp/src/ValueObject/RenameMethodCallBasedOnParameter.php',
|
||||
'Rector\\ChangesReporting\\Annotation\\AnnotationExtractor' => __DIR__ . '/../..' . '/packages/ChangesReporting/Annotation/AnnotationExtractor.php',
|
||||
'Rector\\ChangesReporting\\Annotation\\RectorsChangelogResolver' => __DIR__ . '/../..' . '/packages/ChangesReporting/Annotation/RectorsChangelogResolver.php',
|
||||
'Rector\\ChangesReporting\\Collector\\AffectedFilesCollector' => __DIR__ . '/../..' . '/packages/ChangesReporting/Collector/AffectedFilesCollector.php',
|
||||
|
@ -3108,9 +3087,9 @@ class ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8c105ebdf649d4804f7b9f7486b63f67::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit807a379ce54da5bf6f2d3cb3c62683cc::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit807a379ce54da5bf6f2d3cb3c62683cc::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit807a379ce54da5bf6f2d3cb3c62683cc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
77
vendor/composer/installed.json
vendored
77
vendor/composer/installed.json
vendored
|
@ -1777,75 +1777,6 @@
|
|||
},
|
||||
"install-path": "..\/rector\/extension-installer"
|
||||
},
|
||||
{
|
||||
"name": "rector\/rector-cakephp",
|
||||
"version": "dev-main",
|
||||
"version_normalized": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-cakephp.git",
|
||||
"reference": "a489bf049d6672d9ecdc03280f3f0f29c810cdd4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-cakephp\/zipball\/a489bf049d6672d9ecdc03280f3f0f29c810cdd4",
|
||||
"reference": "a489bf049d6672d9ecdc03280f3f0f29c810cdd4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-xml": "*",
|
||||
"php": ">=8.1",
|
||||
"symfony\/string": "^6.0"
|
||||
},
|
||||
"conflict": {
|
||||
"rector\/rector": "<0.11"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"phpstan\/phpstan": "^1.8.1",
|
||||
"phpstan\/phpstan-strict-rules": "^1.1",
|
||||
"phpstan\/phpstan-webmozart-assert": "^1.0",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"rector\/phpstan-rules": "^0.6",
|
||||
"rector\/rector-debugging": "dev-main",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"symplify\/easy-coding-standard": "^11.1",
|
||||
"symplify\/phpstan-extensions": "^11.1",
|
||||
"symplify\/phpstan-rules": "^11.1",
|
||||
"symplify\/rule-doc-generator": "^11.1",
|
||||
"symplify\/vendor-patches": "^11.1"
|
||||
},
|
||||
"time": "2022-09-02T10:52:15+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
"enable-patching": true,
|
||||
"branch-alias": {
|
||||
"dev-main": "0.11-dev"
|
||||
},
|
||||
"rector": {
|
||||
"includes": [
|
||||
"config\/config.php"
|
||||
]
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Rector\\CakePHP\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Rector upgrades rules for CakePHP",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-cakephp\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-cakephp\/tree\/main"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-cakephp"
|
||||
},
|
||||
{
|
||||
"name": "rector\/rector-doctrine",
|
||||
"version": "dev-main",
|
||||
|
@ -2265,12 +2196,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "421857f269c7e9cadb611d33d904673bc1842b5f"
|
||||
"reference": "2f75ef4da76feb5ae15bbecf28f7d13ca9f74a67"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/421857f269c7e9cadb611d33d904673bc1842b5f",
|
||||
"reference": "421857f269c7e9cadb611d33d904673bc1842b5f",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/2f75ef4da76feb5ae15bbecf28f7d13ca9f74a67",
|
||||
"reference": "2f75ef4da76feb5ae15bbecf28f7d13ca9f74a67",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2301,7 +2232,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.1",
|
||||
"symplify\/vendor-patches": "^11.1"
|
||||
},
|
||||
"time": "2022-09-19T21:03:30+00:00",
|
||||
"time": "2022-10-02T20:26:31+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main a489bf0'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c56069f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d75c674'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2decdcf'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9c21f5f'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 294de0c'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 963c24d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 421857f'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c56069f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d75c674'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2decdcf'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9c21f5f'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 294de0c'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 963c24d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2f75ef4'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
25
vendor/rector/rector-cakephp/LICENSE
vendored
25
vendor/rector/rector-cakephp/LICENSE
vendored
|
@ -1,25 +0,0 @@
|
|||
The MIT License
|
||||
---------------
|
||||
|
||||
Copyright (c) 2017-present Tomáš Votruba (https://tomasvotruba.cz)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
39
vendor/rector/rector-cakephp/README.md
vendored
39
vendor/rector/rector-cakephp/README.md
vendored
|
@ -1,39 +0,0 @@
|
|||
# Rector Rules for CakePHP
|
||||
|
||||
See available [CakePHP rules](/docs/rector_rules_overview.md)
|
||||
|
||||
## Install
|
||||
|
||||
This package is already part of [rector/rector](http://github.com/rectorphp/rector) package, so it works out of the box.
|
||||
|
||||
All you need to do is install the main package, and you're good to go:
|
||||
|
||||
```bash
|
||||
composer require rector/rector --dev
|
||||
```
|
||||
|
||||
## Use Sets
|
||||
|
||||
To add a set to your config, use `Rector\CakePHP\Set\CakePHPSetList` class and pick one of constants:
|
||||
|
||||
```php
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->sets([
|
||||
CakePHPSetList::CAKEPHP_40
|
||||
]);
|
||||
};
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Learn Rector Faster
|
||||
|
||||
Rector is a tool that [we develop](https://getrector.org/) and share for free, so anyone can save hundreds of hours on refactoring. But not everyone has time to understand Rector and AST complexity. You have 2 ways to speed this process up:
|
||||
|
||||
* read a book - <a href="https://leanpub.com/rector-the-power-of-automated-refactoring">The Power of Automated Refactoring</a>
|
||||
* hire our experienced team to <a href="https://getrector.org/contact">improve your code base</a>
|
||||
|
||||
Both ways support us to and improve Rector in sustainable way by learning from practical projects.
|
68
vendor/rector/rector-cakephp/composer.json
vendored
68
vendor/rector/rector-cakephp/composer.json
vendored
|
@ -1,68 +0,0 @@
|
|||
{
|
||||
"name": "rector\/rector-cakephp",
|
||||
"type": "rector-extension",
|
||||
"license": "MIT",
|
||||
"description": "Rector upgrades rules for CakePHP",
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"ext-xml": "*",
|
||||
"symfony\/string": "^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan\/phpstan": "^1.8.1",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"symplify\/phpstan-rules": "^11.1",
|
||||
"symplify\/phpstan-extensions": "^11.1",
|
||||
"symplify\/easy-coding-standard": "^11.1",
|
||||
"symplify\/rule-doc-generator": "^11.1",
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"rector\/phpstan-rules": "^0.6",
|
||||
"phpstan\/phpstan-webmozart-assert": "^1.0",
|
||||
"phpstan\/phpstan-strict-rules": "^1.1",
|
||||
"symplify\/vendor-patches": "^11.1",
|
||||
"rector\/rector-debugging": "dev-main"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Rector\\CakePHP\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Rector\\CakePHP\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"phpstan": "vendor\/bin\/phpstan analyse --ansi --error-format symplify",
|
||||
"check-cs": "vendor\/bin\/ecs check --ansi",
|
||||
"fix-cs": "vendor\/bin\/ecs check --fix --ansi",
|
||||
"docs": [
|
||||
"vendor\/bin\/rule-doc-generator generate src --output-file docs\/rector_rules_overview.md --ansi",
|
||||
"vendor\/bin\/ecs check-markdown docs\/rector_rules_overview.md --ansi --fix"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"enable-patching": true,
|
||||
"branch-alias": {
|
||||
"dev-main": "0.11-dev"
|
||||
},
|
||||
"rector": {
|
||||
"includes": [
|
||||
"config\/config.php"
|
||||
]
|
||||
}
|
||||
},
|
||||
"conflict": {
|
||||
"rector\/rector": "<0.11"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"cweagans\/composer-patches": true,
|
||||
"rector\/extension-installer": true,
|
||||
"phpstan\/extension-installer": true
|
||||
}
|
||||
}
|
||||
}
|
11
vendor/rector/rector-cakephp/config/config.php
vendored
11
vendor/rector/rector-cakephp/config/config.php
vendored
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$services = $rectorConfig->services();
|
||||
$services->defaults()->public()->autowire()->autoconfigure();
|
||||
$services->load('Rector\\CakePHP\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/{Rector,ValueObject,Contract}']);
|
||||
};
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector;
|
||||
use Rector\CakePHP\ValueObject\ArrayToFluentCall;
|
||||
use Rector\CakePHP\ValueObject\FactoryMethod;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(ArrayToFluentCallRector::class, [ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS => [new ArrayToFluentCall('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',
|
||||
]), new ArrayToFluentCall('Cake\\ORM\\Query', ['fields' => 'select', 'conditions' => 'where', 'join' => 'join', 'order' => 'order', 'limit' => 'limit', 'offset' => 'offset', 'group' => 'group', 'having' => 'having', 'contain' => 'contain', 'page' => 'page']), new ArrayToFluentCall('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',
|
||||
]), new ArrayToFluentCall('Cake\\ORM\\Query', ['fields' => 'select', 'conditions' => 'where', 'join' => 'join', 'order' => 'order', 'limit' => 'limit', 'offset' => 'offset', 'group' => 'group', 'having' => 'having', 'contain' => 'contain', 'page' => 'page'])], ArrayToFluentCallRector::FACTORY_METHODS => [new FactoryMethod('Cake\\ORM\\Table', 'belongsTo', 'Cake\\ORM\\Association', 2), new FactoryMethod('Cake\\ORM\\Table', 'belongsToMany', 'Cake\\ORM\\Association', 2), new FactoryMethod('Cake\\ORM\\Table', 'hasMany', 'Cake\\ORM\\Association', 2), new FactoryMethod('Cake\\ORM\\Table', 'hasOne', 'Cake\\ORM\\Association', 2), new FactoryMethod('Cake\\ORM\\Table', 'find', 'Cake\\ORM\\Query', 2)]]);
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\Namespace_\AppUsesStaticCallToUseStatementRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
# @see https://github.com/cakephp/upgrade/tree/master/src/Shell/Task
|
||||
$rectorConfig->rule(AppUsesStaticCallToUseStatementRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
|
||||
# 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',
|
||||
]);
|
||||
};
|
|
@ -1,175 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\Visibility;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameProperty;
|
||||
use Rector\Transform\Rector\Assign\PropertyFetchToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;
|
||||
use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector;
|
||||
use Rector\Visibility\ValueObject\ChangeMethodVisibility;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(PropertyFetchToMethodCallRector::class, [
|
||||
// source: https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'params', 'getAttribute', null, ['params']),
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'data', 'getData'),
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'query', 'getQueryParams'),
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'cookies', 'getCookie'),
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'base', 'getAttribute', null, ['base']),
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'webroot', 'getAttribute', null, ['webroot']),
|
||||
new PropertyFetchToMethodCall('Cake\\Network\\Request', 'here', 'getAttribute', null, ['here']),
|
||||
]);
|
||||
$rectorConfig->ruleWithConfiguration(RenamePropertyRector::class, [new RenameProperty('Cake\\Network\\Request', '_session', 'session')]);
|
||||
$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [
|
||||
new ModalToGetSet('Cake\\Core\\InstanceConfigTrait', 'config', null, null, 2, 'array'),
|
||||
new ModalToGetSet('Cake\\Core\\StaticConfigTrait', 'config', null, null, 2, 'array'),
|
||||
new ModalToGetSet('Cake\\Console\\ConsoleOptionParser', 'command'),
|
||||
new ModalToGetSet('Cake\\Console\\ConsoleOptionParser', 'description'),
|
||||
new ModalToGetSet('Cake\\Console\\ConsoleOptionParser', 'epilog'),
|
||||
new ModalToGetSet('Cake\\Database\\Connection', 'driver'),
|
||||
new ModalToGetSet('Cake\\Database\\Connection', 'schemaCollection'),
|
||||
new ModalToGetSet('Cake\\Database\\Connection', 'useSavePoints', 'isSavePointsEnabled', 'enableSavePoints'),
|
||||
new ModalToGetSet('Cake\\Database\\Driver', 'autoQuoting', 'isAutoQuotingEnabled', 'enableAutoQuoting'),
|
||||
new ModalToGetSet('Cake\\Database\\Expression\\FunctionExpression', 'name'),
|
||||
new ModalToGetSet('Cake\\Database\\Expression\\QueryExpression', 'tieWith', 'getConjunction', 'setConjunction'),
|
||||
new ModalToGetSet('Cake\\Database\\Expression\\ValuesExpression', 'columns'),
|
||||
new ModalToGetSet('Cake\\Database\\Expression\\ValuesExpression', 'values'),
|
||||
new ModalToGetSet('Cake\\Database\\Expression\\ValuesExpression', 'query'),
|
||||
new ModalToGetSet('Cake\\Database\\Query', 'connection'),
|
||||
new ModalToGetSet('Cake\\Database\\Query', 'selectTypeMap'),
|
||||
new ModalToGetSet('Cake\\Database\\Query', 'bufferResults', 'isBufferedResultsEnabled', 'enableBufferedResults'),
|
||||
new ModalToGetSet('Cake\\Database\\Schema\\CachedCollection', 'cacheMetadata'),
|
||||
new ModalToGetSet('Cake\\Database\\Schema\\TableSchema', 'options'),
|
||||
new ModalToGetSet('Cake\\Database\\Schema\\TableSchema', 'temporary', 'isTemporary', 'setTemporary'),
|
||||
new ModalToGetSet('Cake\\Database\\TypeMap', 'defaults'),
|
||||
new ModalToGetSet('Cake\\Database\\TypeMap', 'types'),
|
||||
new ModalToGetSet('Cake\\Database\\TypeMapTrait', 'typeMap'),
|
||||
new ModalToGetSet('Cake\\Database\\TypeMapTrait', 'defaultTypes'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'name'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'cascadeCallbacks'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'source'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'target'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'conditions'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'bindingKey'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'foreignKey'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'dependent'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'joinType'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'property'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'strategy'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association', 'finder'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\BelongsToMany', 'targetForeignKey'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\BelongsToMany', 'saveStrategy'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\BelongsToMany', 'conditions'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\HasMany', 'saveStrategy'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\HasMany', 'foreignKey'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\HasMany', 'sort'),
|
||||
new ModalToGetSet('Cake\\ORM\\Association\\HasOne', 'foreignKey'),
|
||||
new ModalToGetSet('Cake\\ORM\\EagerLoadable', 'config'),
|
||||
new ModalToGetSet('Cake\\ORM\\EagerLoadable', 'canBeJoined', 'canBeJoined', 'setCanBeJoined'),
|
||||
// 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
|
||||
new ModalToGetSet('Cake\\ORM\\EagerLoadable', 'matching'),
|
||||
new ModalToGetSet('Cake\\ORM\\EagerLoadable', 'autoFields', 'isAutoFieldsEnabled', 'enableAutoFields'),
|
||||
new ModalToGetSet('Cake\\ORM\\Locator\\TableLocator', 'config'),
|
||||
new ModalToGetSet('Cake\\ORM\\Query', 'eagerLoader'),
|
||||
new ModalToGetSet('Cake\\ORM\\Query', 'hydrate', 'isHydrationEnabled', 'enableHydration'),
|
||||
new ModalToGetSet('Cake\\ORM\\Query', 'autoFields', 'isAutoFieldsEnabled', 'enableAutoFields'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'table'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'alias'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'registryAlias'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'connection'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'schema'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'primaryKey'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'displayField'),
|
||||
new ModalToGetSet('Cake\\ORM\\Table', 'entityClass'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'entityClass'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'from'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'sender'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'replyTo'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'readReceipt'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'returnPath'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'to'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'cc'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'bcc'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'charset'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'headerCharset'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'emailPattern'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'subject'),
|
||||
// template: have to be changed manually, non A → B change + array case
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'viewRender', 'getViewRenderer', 'setViewRenderer'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'viewVars'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'theme'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'helpers'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'emailFormat'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'transport'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'messageId'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'domain'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'attachments'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'configTransport'),
|
||||
new ModalToGetSet('Cake\\Mailer\\Email', 'profile'),
|
||||
new ModalToGetSet('Cake\\Validation\\Validator', 'provider'),
|
||||
new ModalToGetSet('Cake\\View\\StringTemplateTrait', 'templates'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'templatePath'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'layoutPath'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'plugin'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'helpers'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'theme'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'template'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'layout'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'options'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'name'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'className'),
|
||||
new ModalToGetSet('Cake\\View\\ViewBuilder', 'autoLayout', 'isAutoLayoutEnabled', 'enableAutoLayout'),
|
||||
]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
|
||||
new MethodCallRename('Cake\\Network\\Request', 'param', 'getParam'),
|
||||
new MethodCallRename('Cake\\Network\\Request', 'data', 'getData'),
|
||||
new MethodCallRename('Cake\\Network\\Request', 'query', 'getQuery'),
|
||||
new MethodCallRename('Cake\\Network\\Request', 'cookie', 'getCookie'),
|
||||
new MethodCallRename('Cake\\Network\\Request', 'method', 'getMethod'),
|
||||
new MethodCallRename('Cake\\Network\\Request', 'setInput', 'withBody'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'location', 'withLocation'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'disableCache', 'withDisabledCache'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'type', 'withType'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'charset', 'withCharset'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'cache', 'withCache'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'modified', 'withModified'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'expires', 'withExpires'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'sharable', 'withSharable'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'maxAge', 'withMaxAge'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'vary', 'withVary'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'etag', 'withEtag'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'compress', 'withCompression'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'length', 'withLength'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'mustRevalidate', 'withMustRevalidate'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'notModified', 'withNotModified'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'cookie', 'withCookie'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'file', 'withFile'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'download', 'withDownload'),
|
||||
# psr-7
|
||||
new MethodCallRename('Cake\\Network\\Response', 'header', 'getHeader'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'body', 'withBody'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'statusCode', 'getStatusCode'),
|
||||
new MethodCallRename('Cake\\Network\\Response', 'protocol', 'getProtocolVersion'),
|
||||
new MethodCallRename('Cake\\Event\\Event', 'name', 'getName'),
|
||||
new MethodCallRename('Cake\\Event\\Event', 'subject', 'getSubject'),
|
||||
new MethodCallRename('Cake\\Event\\Event', 'result', 'getResult'),
|
||||
new MethodCallRename('Cake\\Event\\Event', 'data', 'getData'),
|
||||
new MethodCallRename('Cake\\View\\Helper\\FormHelper', 'input', 'control'),
|
||||
new MethodCallRename('Cake\\View\\Helper\\FormHelper', 'inputs', 'controls'),
|
||||
new MethodCallRename('Cake\\View\\Helper\\FormHelper', 'allInputs', 'allControls'),
|
||||
new MethodCallRename('Cake\\Mailer\\Mailer', 'layout', 'setLayout'),
|
||||
new MethodCallRename('Cake\\Routing\\Route\\Route', 'parse', 'parseRequest'),
|
||||
new MethodCallRename('Cake\\Routing\\Router', 'parse', 'parseRequest'),
|
||||
]);
|
||||
$rectorConfig->ruleWithConfiguration(ChangeMethodVisibilityRector::class, [new ChangeMethodVisibility('Cake\\Mailer\\MailerAwareTrait', 'getMailer', Visibility::PROTECTED), new ChangeMethodVisibility('Cake\\View\\CellTrait', 'cell', Visibility::PROTECTED)]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['Cake\\Database\\Schema\\Table' => 'Cake\\Database\\Schema\\TableSchema']);
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
# source: https://book.cakephp.org/3.0/en/appendices/3-5-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['Cake\\Http\\Client\\CookieCollection' => 'Cake\\Http\\Cookie\\CookieCollection', 'Cake\\Console\\ShellDispatcher' => 'Cake\\Console\\CommandRunner']);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\Database\\Schema\\TableSchema', 'column', 'getColumn'), new MethodCallRename('Cake\\Database\\Schema\\TableSchema', 'constraint', 'getConstraint'), new MethodCallRename('Cake\\Database\\Schema\\TableSchema', 'index', 'getIndex')]);
|
||||
$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [new ModalToGetSet('Cake\\Cache\\Cache', 'config'), new ModalToGetSet('Cake\\Cache\\Cache', 'registry'), new ModalToGetSet('Cake\\Console\\Shell', 'io'), new ModalToGetSet('Cake\\Console\\ConsoleIo', 'outputAs'), new ModalToGetSet('Cake\\Console\\ConsoleOutput', 'outputAs'), new ModalToGetSet('Cake\\Database\\Connection', 'logger'), new ModalToGetSet('Cake\\Database\\TypedResultInterface', 'returnType'), new ModalToGetSet('Cake\\Database\\TypedResultTrait', 'returnType'), new ModalToGetSet('Cake\\Database\\Log\\LoggingStatement', 'logger'), new ModalToGetSet('Cake\\Datasource\\ModelAwareTrait', 'modelType'), new ModalToGetSet('Cake\\Database\\Query', 'valueBinder', 'getValueBinder', 'valueBinder'), new ModalToGetSet('Cake\\Database\\Schema\\TableSchema', 'columnType'), new ModalToGetSet('Cake\\Datasource\\QueryTrait', 'eagerLoaded', 'isEagerLoaded', 'eagerLoaded'), new ModalToGetSet('Cake\\Event\\EventDispatcherInterface', 'eventManager'), new ModalToGetSet('Cake\\Event\\EventDispatcherTrait', 'eventManager'), new ModalToGetSet('Cake\\Error\\Debugger', 'outputAs', 'getOutputFormat', 'setOutputFormat'), new ModalToGetSet('Cake\\Http\\ServerRequest', 'env', 'getEnv', 'withEnv'), new ModalToGetSet('Cake\\Http\\ServerRequest', 'charset', 'getCharset', 'withCharset'), new ModalToGetSet('Cake\\I18n\\I18n', 'locale'), new ModalToGetSet('Cake\\I18n\\I18n', 'translator'), new ModalToGetSet('Cake\\I18n\\I18n', 'defaultLocale'), new ModalToGetSet('Cake\\I18n\\I18n', 'defaultFormatter'), new ModalToGetSet('Cake\\ORM\\Association\\BelongsToMany', 'sort'), new ModalToGetSet('Cake\\ORM\\LocatorAwareTrait', 'tableLocator'), new ModalToGetSet('Cake\\ORM\\Table', 'validator'), new ModalToGetSet('Cake\\Routing\\RouteBuilder', 'extensions'), new ModalToGetSet('Cake\\Routing\\RouteBuilder', 'routeClass'), new ModalToGetSet('Cake\\Routing\\RouteCollection', 'extensions'), new ModalToGetSet('Cake\\TestSuite\\TestFixture', 'schema'), new ModalToGetSet('Cake\\Utility\\Security', 'salt'), new ModalToGetSet('Cake\\View\\View', 'template'), new ModalToGetSet('Cake\\View\\View', 'layout'), new ModalToGetSet('Cake\\View\\View', 'theme'), new ModalToGetSet('Cake\\View\\View', 'templatePath'), new ModalToGetSet('Cake\\View\\View', 'layoutPath'), new ModalToGetSet('Cake\\View\\View', 'autoLayout', 'isAutoLayoutEnabled', 'enableAutoLayout')]);
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Transform\Rector\Assign\PropertyFetchToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
# source: https://book.cakephp.org/3.0/en/appendices/3-6-migration-guide.html
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\ORM\\Table', 'association', 'getAssociation'), new MethodCallRename('Cake\\Validation\\ValidationSet', 'isPresenceRequired', 'requirePresence'), new MethodCallRename('Cake\\Validation\\ValidationSet', 'isEmptyAllowed', 'allowEmpty')]);
|
||||
$rectorConfig->ruleWithConfiguration(PropertyFetchToMethodCallRector::class, [new PropertyFetchToMethodCall('Cake\\Controller\\Controller', 'name', 'getName', 'setName'), new PropertyFetchToMethodCall('Cake\\Controller\\Controller', 'plugin', 'getPlugin', 'setPlugin'), new PropertyFetchToMethodCall('Cake\\Form\\Form', 'validator', 'getValidator', 'setValidator')]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['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']);
|
||||
};
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\Rector\Property\ChangeSnakedFixtureNameToPascalRector;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Transform\Rector\Assign\PropertyFetchToMethodCallRector;
|
||||
use Rector\Transform\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector;
|
||||
use Rector\Transform\ValueObject\MethodCallToAnotherMethodCallWithArguments;
|
||||
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;
|
||||
# source: https://book.cakephp.org/3.0/en/appendices/3-7-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\Form\\Form', 'errors', 'getErrors'), new MethodCallRename('Cake\\Validation\\Validation', 'cc', 'creditCard'), new MethodCallRename('Cake\\Filesystem\\Folder', 'normalizePath', 'correctSlashFor'), new MethodCallRename('Cake\\Http\\Client\\Response', 'body', 'getStringBody'), new MethodCallRename('Cake\\Core\\Plugin', 'unload', 'clear')]);
|
||||
$rectorConfig->ruleWithConfiguration(PropertyFetchToMethodCallRector::class, [new PropertyFetchToMethodCall('Cake\\Http\\Client\\Response', 'body', 'getStringBody'), new PropertyFetchToMethodCall('Cake\\Http\\Client\\Response', 'json', 'getJson'), new PropertyFetchToMethodCall('Cake\\Http\\Client\\Response', 'xml', 'getXml'), new PropertyFetchToMethodCall('Cake\\Http\\Client\\Response', 'cookies', 'getCookies'), new PropertyFetchToMethodCall('Cake\\Http\\Client\\Response', 'code', 'getStatusCode'), new PropertyFetchToMethodCall('Cake\\View\\View', 'request', 'getRequest', 'setRequest'), new PropertyFetchToMethodCall('Cake\\View\\View', 'response', 'getResponse', 'setResponse'), new PropertyFetchToMethodCall('Cake\\View\\View', 'templatePath', 'getTemplatePath', 'setTemplatePath'), new PropertyFetchToMethodCall('Cake\\View\\View', 'template', 'getTemplate', 'setTemplate'), new PropertyFetchToMethodCall('Cake\\View\\View', 'layout', 'getLayout', 'setLayout'), new PropertyFetchToMethodCall('Cake\\View\\View', 'layoutPath', 'getLayoutPath', 'setLayoutPath'), new PropertyFetchToMethodCall('Cake\\View\\View', 'autoLayout', 'isAutoLayoutEnabled', 'enableAutoLayout'), new PropertyFetchToMethodCall('Cake\\View\\View', 'theme', 'getTheme', 'setTheme'), new PropertyFetchToMethodCall('Cake\\View\\View', 'subDir', 'getSubDir', 'setSubDir'), new PropertyFetchToMethodCall('Cake\\View\\View', 'plugin', 'getPlugin', 'setPlugin'), new PropertyFetchToMethodCall('Cake\\View\\View', 'name', 'getName', 'setName'), new PropertyFetchToMethodCall('Cake\\View\\View', 'elementCache', 'getElementCache', 'setElementCache'), new PropertyFetchToMethodCall('Cake\\View\\View', 'helpers', 'helpers')]);
|
||||
$rectorConfig->ruleWithConfiguration(MethodCallToAnotherMethodCallWithArgumentsRector::class, [new MethodCallToAnotherMethodCallWithArguments('Cake\\Database\\Query', 'join', 'clause', ['join']), new MethodCallToAnotherMethodCallWithArguments('Cake\\Database\\Query', 'from', 'clause', ['from'])]);
|
||||
$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [new ModalToGetSet('Cake\\Database\\Connection', 'logQueries', 'isQueryLoggingEnabled', 'enableQueryLogging'), new ModalToGetSet('Cake\\ORM\\Association', 'className', 'getClassName', 'setClassName')]);
|
||||
$rectorConfig->rule(ChangeSnakedFixtureNameToPascalRector::class);
|
||||
};
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
# source: https://book.cakephp.org/3.0/en/appendices/3-8-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\ORM\\Entity', 'visibleProperties', 'getVisible')]);
|
||||
};
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use PHPStan\Type\BooleanType;
|
||||
use PHPStan\Type\IntegerType;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\StringType;
|
||||
use PHPStan\Type\UnionType;
|
||||
use PHPStan\Type\VoidType;
|
||||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\CakePHP\ValueObject\RenameMethodCallBasedOnParameter;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
|
||||
use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
|
||||
use Rector\Renaming\ValueObject\RenameClassConstFetch;
|
||||
use Rector\Renaming\ValueObject\RenameProperty;
|
||||
use Rector\Renaming\ValueObject\RenameStaticMethod;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
|
||||
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
|
||||
# source: https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['Cake\\Database\\Type' => 'Cake\\Database\\TypeFactory', 'Cake\\Console\\ConsoleErrorHandler' => 'Cake\\Error\\ConsoleErrorHandler']);
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [new RenameClassConstFetch('Cake\\View\\View', 'NAME_ELEMENT', 'TYPE_ELEMENT'), new RenameClassConstFetch('Cake\\View\\View', 'NAME_LAYOUT', 'TYPE_LAYOUT'), new RenameClassAndConstFetch('Cake\\Mailer\\Email', 'MESSAGE_HTML', 'Cake\\Mailer\\Message', 'MESSAGE_HTML'), new RenameClassAndConstFetch('Cake\\Mailer\\Email', 'MESSAGE_TEXT', 'Cake\\Mailer\\Message', 'MESSAGE_TEXT'), new RenameClassAndConstFetch('Cake\\Mailer\\Email', 'MESSAGE_BOTH', 'Cake\\Mailer\\Message', 'MESSAGE_BOTH'), new RenameClassAndConstFetch('Cake\\Mailer\\Email', 'EMAIL_PATTERN', 'Cake\\Mailer\\Message', 'EMAIL_PATTERN')]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\Form\\Form', 'errors', 'getErrors'), new MethodCallRename('Cake\\Mailer\\Email', 'set', 'setViewVars'), new MethodCallRename('Cake\\ORM\\EntityInterface', 'unsetProperty', 'unset'), new MethodCallRename('Cake\\Cache\\Cache', 'engine', 'pool'), new MethodCallRename('Cake\\Http\\Cookie\\Cookie', 'getStringValue', 'getScalarValue'), new MethodCallRename('Cake\\Validation\\Validator', 'containsNonAlphaNumeric', 'notAlphaNumeric'), new MethodCallRename('Cake\\Validation\\Validator', 'errors', 'validate')]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameStaticMethodRector::class, [new RenameStaticMethod('Router', 'pushRequest', 'Router', 'setRequest'), new RenameStaticMethod('Router', 'setRequestInfo', 'Router', 'setRequest'), new RenameStaticMethod('Router', 'setRequestContext', 'Router', 'setRequest')]);
|
||||
$rectorConfig->ruleWithConfiguration(RenamePropertyRector::class, [new RenameProperty('Cake\\ORM\\Entity', '_properties', '_fields')]);
|
||||
$rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [new AddReturnTypeDeclaration('Cake\\Http\\BaseApplication', 'bootstrap', new VoidType()), new AddReturnTypeDeclaration('Cake\\Http\\BaseApplication', 'bootstrapCli', new VoidType()), new AddReturnTypeDeclaration('Cake\\Http\\BaseApplication', 'middleware', new ObjectType('Cake\\Http\\MiddlewareQueue')), new AddReturnTypeDeclaration('Cake\\Console\\Shell', 'initialize', new VoidType()), new AddReturnTypeDeclaration('Cake\\Controller\\Component', 'initialize', new VoidType()), new AddReturnTypeDeclaration('Cake\\Controller\\Controller', 'initialize', new VoidType()), new AddReturnTypeDeclaration('Cake\\Controller\\Controller', 'render', new ObjectType('Cake\\Http\\Response')), new AddReturnTypeDeclaration('Cake\\Form\\Form', 'validate', new BooleanType()), new AddReturnTypeDeclaration('Cake\\Form\\Form', '_buildSchema', new ObjectType('Cake\\Form\\Schema')), new AddReturnTypeDeclaration('Cake\\ORM\\Behavior', 'initialize', new VoidType()), new AddReturnTypeDeclaration('Cake\\ORM\\Table', 'initialize', new VoidType()), new AddReturnTypeDeclaration('Cake\\ORM\\Table', 'updateAll', new IntegerType()), new AddReturnTypeDeclaration('Cake\\ORM\\Table', 'deleteAll', new IntegerType()), new AddReturnTypeDeclaration('Cake\\ORM\\Table', 'validationDefault', new ObjectType('Cake\\Validation\\Validator')), new AddReturnTypeDeclaration('Cake\\ORM\\Table', 'buildRules', new ObjectType('Cake\\ORM\\RulesChecker')), new AddReturnTypeDeclaration('Cake\\View\\Helper', 'initialize', new VoidType())]);
|
||||
$eventInterfaceObjectType = new ObjectType('Cake\\Event\\EventInterface');
|
||||
$rectorConfig->ruleWithConfiguration(AddParamTypeDeclarationRector::class, [new AddParamTypeDeclaration('Cake\\Form\\Form', 'getData', 0, new UnionType([new StringType(), new NullType()])), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'beforeFind', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'buildValidator', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'buildRules', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'beforeRules', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'afterRules', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'beforeSave', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'afterSave', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'beforeDelete', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Behavior', 'afterDelete', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'beforeFind', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'buildValidator', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'buildRules', 0, new ObjectType('Cake\\ORM\\RulesChecker')), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'beforeRules', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'afterRules', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'beforeSave', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'afterSave', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'beforeDelete', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\ORM\\Table', 'afterDelete', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Controller', 'beforeFilter', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Controller', 'afterFilter', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Controller', 'beforeRender', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Controller', 'beforeRedirect', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Component', 'shutdown', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Component', 'startup', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Component', 'beforeFilter', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Component', 'beforeRender', 0, $eventInterfaceObjectType), new AddParamTypeDeclaration('Cake\\Controller\\Component', 'beforeRedirect', 0, $eventInterfaceObjectType)]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodCallBasedOnParameterRector::class, [new RenameMethodCallBasedOnParameter('Cake\\Http\\ServerRequest', 'getParam', 'paging', 'getAttribute'), new RenameMethodCallBasedOnParameter('Cake\\Http\\ServerRequest', 'withParam', 'paging', 'withAttribute')]);
|
||||
$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [new ModalToGetSet('Cake\\Console\\ConsoleIo', 'styles', 'setStyle', 'getStyle'), new ModalToGetSet('Cake\\Console\\ConsoleOutput', 'styles', 'setStyle', 'getStyle'), new ModalToGetSet('Cake\\ORM\\EntityInterface', 'isNew', 'setNew', 'isNew')]);
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['Cake\\Routing\\Exception\\RedirectException' => 'Cake\\Http\\Exception\\RedirectException', 'Cake\\Database\\Expression\\Comparison' => 'Cake\\Database\\Expression\\ComparisonExpression']);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\Database\\Schema\\TableSchema', 'getPrimary', 'getPrimaryKey'), new MethodCallRename('Cake\\Database\\Type\\DateTimeType', 'setTimezone', 'setDatabaseTimezone'), new MethodCallRename('Cake\\Database\\Expression\\QueryExpression', 'or_', 'or'), new MethodCallRename('Cake\\Database\\Expression\\QueryExpression', 'and_', 'and'), new MethodCallRename('Cake\\View\\Form\\ContextInterface', 'primaryKey', 'getPrimaryKey'), new MethodCallRename('Cake\\Http\\Middleware\\CsrfProtectionMiddleware', 'whitelistCallback', 'skipCheckCallback')]);
|
||||
$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [new ModalToGetSet('Cake\\Form\\Form', 'schema')]);
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
# source: https://book.cakephp.org/4/en/appendices/4-2-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['Cake\\Core\\Exception\\Exception' => 'Cake\\Core\\Exception\\CakeException', 'Cake\\Database\\Exception' => 'Cake\\Database\\Exception\\DatabaseException']);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\ORM\\Behavior', 'getTable', 'table')]);
|
||||
};
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Rector\MethodCall\RemoveIntermediaryMethodRector;
|
||||
use Rector\CakePHP\ValueObject\RemoveIntermediaryMethod;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Transform\Rector\Assign\PropertyFetchToMethodCallRector;
|
||||
use Rector\Transform\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector;
|
||||
use Rector\Transform\ValueObject\MethodCallToAnotherMethodCallWithArguments;
|
||||
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;
|
||||
# source: https://book.cakephp.org/4.next/en/appendices/4-3-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\Controller\\Component', 'shutdown', 'afterFilter')]);
|
||||
$rectorConfig->ruleWithConfiguration(PropertyFetchToMethodCallRector::class, [new PropertyFetchToMethodCall('Cake\\Network\\Socket', 'connected', 'isConnected'), new PropertyFetchToMethodCall('Cake\\Network\\Socket', 'encrypted', 'isEncrypted'), new PropertyFetchToMethodCall('Cake\\Network\\Socket', 'lastError', 'lastError')]);
|
||||
$rectorConfig->ruleWithConfiguration(RemoveIntermediaryMethodRector::class, [new RemoveIntermediaryMethod('getTableLocator', 'get', 'fetchTable')]);
|
||||
$rectorConfig->ruleWithConfiguration(MethodCallToAnotherMethodCallWithArgumentsRector::class, [new MethodCallToAnotherMethodCallWithArguments('Cake\\Database\\DriverInterface', 'supportsQuoting', 'supports', ['quote']), new MethodCallToAnotherMethodCallWithArguments('Cake\\Database\\DriverInterface', 'supportsSavepoints', 'supports', ['savepoint'])]);
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
# @see https://book.cakephp.org/4/en/appendices/4-4-migration-guide.html
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['Cake\\TestSuite\\ConsoleIntegrationTestTrait' => 'Cake\\Console\\TestSuite\\ConsoleIntegrationTestTrait', 'Cake\\TestSuite\\Stub\\ConsoleInput' => 'Cake\\Console\\TestSuite\\StubConsoleInput', 'Cake\\TestSuite\\Stub\\ConsoleOutput' => 'Cake\\Console\\TestSuite\\StubConsoleOutput', 'Cake\\TestSuite\\Stub\\MissingConsoleInputException' => 'Cake\\Console\\TestSuite\\MissingConsoleInputException', 'Cake\\TestSuite\\HttpClientTrait' => 'Cake\\Http\\TestSuite\\HttpClientTrait']);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Cake\\Database\\Query', 'newExpr', 'expr')]);
|
||||
};
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_30, CakePHPSetList::CAKEPHP_34]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_35, CakePHPLevelSetList::UP_TO_CAKEPHP_34]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_36, CakePHPLevelSetList::UP_TO_CAKEPHP_35]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_37, CakePHPLevelSetList::UP_TO_CAKEPHP_36]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_38, CakePHPLevelSetList::UP_TO_CAKEPHP_37]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_40, CakePHPLevelSetList::UP_TO_CAKEPHP_38]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_41, CakePHPLevelSetList::UP_TO_CAKEPHP_40]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_42, CakePHPLevelSetList::UP_TO_CAKEPHP_41]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_43, CakePHPLevelSetList::UP_TO_CAKEPHP_42]);
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\CakePHP\Set\CakePHPLevelSetList;
|
||||
use Rector\CakePHP\Set\CakePHPSetList;
|
||||
use Rector\Config\RectorConfig;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->sets([CakePHPSetList::CAKEPHP_44, CakePHPLevelSetList::UP_TO_CAKEPHP_43]);
|
||||
};
|
|
@ -1,171 +0,0 @@
|
|||
# 6 Rules Overview
|
||||
|
||||
## AppUsesStaticCallToUseStatementRector
|
||||
|
||||
Change `App::uses()` to use imports
|
||||
|
||||
- class: [`Rector\CakePHP\Rector\Namespace_\AppUsesStaticCallToUseStatementRector`](../src/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php)
|
||||
|
||||
```diff
|
||||
-App::uses('NotificationListener', 'Event');
|
||||
+use Event\NotificationListener;
|
||||
|
||||
CakeEventManager::instance()->attach(new NotificationListener());
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## ArrayToFluentCallRector
|
||||
|
||||
Moves array options to fluent setter method calls.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector`](../src/Rector/MethodCall/ArrayToFluentCallRector.php)
|
||||
|
||||
```php
|
||||
use Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector;
|
||||
use Rector\CakePHP\ValueObject\ArrayToFluentCall;
|
||||
use Rector\Config\RectorConfig;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->ruleWithConfiguration(ArrayToFluentCallRector::class, [Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS: [new ArrayToFluentCall('ArticlesTable', ['setForeignKey', 'setProperty'])]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
use Cake\ORM\Table;
|
||||
|
||||
final class ArticlesTable extends Table
|
||||
{
|
||||
public function initialize(array $config)
|
||||
{
|
||||
- $this->belongsTo('Authors', [
|
||||
- 'foreignKey' => 'author_id',
|
||||
- 'propertyName' => 'person'
|
||||
- ]);
|
||||
+ $this->belongsTo('Authors')
|
||||
+ ->setForeignKey('author_id')
|
||||
+ ->setProperty('person');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## ChangeSnakedFixtureNameToPascalRector
|
||||
|
||||
Changes `$fixtures` style from snake_case to PascalCase.
|
||||
|
||||
- class: [`Rector\CakePHP\Rector\Property\ChangeSnakedFixtureNameToPascalRector`](../src/Rector/Property/ChangeSnakedFixtureNameToPascalRector.php)
|
||||
|
||||
```diff
|
||||
class SomeTest
|
||||
{
|
||||
protected $fixtures = [
|
||||
- 'app.posts',
|
||||
- 'app.users',
|
||||
- 'some_plugin.posts/special_posts',
|
||||
+ 'app.Posts',
|
||||
+ 'app.Users',
|
||||
+ 'some_plugin.Posts/SpecialPosts',
|
||||
];
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## ModalToGetSetRector
|
||||
|
||||
Changes combined set/get `value()` to specific `getValue()` or `setValue(x)`.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector`](../src/Rector/MethodCall/ModalToGetSetRector.php)
|
||||
|
||||
```php
|
||||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Config\RectorConfig;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector::UNPREFIXED_METHODS_TO_GET_SET: [new ModalToGetSet('getConfig', 'setConfig', 'InstanceConfigTrait', 'config', 1)]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
$object = new InstanceConfigTrait;
|
||||
|
||||
-$config = $object->config();
|
||||
-$config = $object->config('key');
|
||||
+$config = $object->getConfig();
|
||||
+$config = $object->getConfig('key');
|
||||
|
||||
-$object->config('key', 'value');
|
||||
-$object->config(['key' => 'value']);
|
||||
+$object->setConfig('key', 'value');
|
||||
+$object->setConfig(['key' => 'value']);
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## RemoveIntermediaryMethodRector
|
||||
|
||||
Removes an intermediary method call for when a higher level API is added.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\CakePHP\Rector\MethodCall\RemoveIntermediaryMethodRector`](../src/Rector/MethodCall/RemoveIntermediaryMethodRector.php)
|
||||
|
||||
```php
|
||||
use Rector\CakePHP\Rector\MethodCall\RemoveIntermediaryMethodRector;
|
||||
use Rector\CakePHP\ValueObject\RemoveIntermediaryMethod;
|
||||
use Rector\Config\RectorConfig;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->ruleWithConfiguration(RemoveIntermediaryMethodRector::class, [Rector\CakePHP\Rector\MethodCall\RemoveIntermediaryMethodRector::REMOVE_INTERMEDIARY_METHOD: [new RemoveIntermediaryMethod('getTableLocator', 'get', 'fetchTable')]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
-$users = $this->getTableLocator()->get('Users');
|
||||
+$users = $this->fetchTable('Users');
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## RenameMethodCallBasedOnParameterRector
|
||||
|
||||
Changes method calls based on matching the first parameter value.
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector`](../src/Rector/MethodCall/RenameMethodCallBasedOnParameterRector.php)
|
||||
|
||||
```php
|
||||
use Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector;
|
||||
use Rector\CakePHP\ValueObject\RenameMethodCallBasedOnParameter;
|
||||
use Rector\Config\RectorConfig;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodCallBasedOnParameterRector::class, [Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector::CALLS_WITH_PARAM_RENAMES: [new RenameMethodCallBasedOnParameter('ServerRequest', 'getParam', 'paging', 'getAttribute'), new RenameMethodCallBasedOnParameter('ServerRequest', 'withParam', 'paging', 'withAttribute')]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
$object = new ServerRequest();
|
||||
|
||||
-$config = $object->getParam('paging');
|
||||
-$object = $object->withParam('paging', ['a value']);
|
||||
+$config = $object->getAttribute('paging');
|
||||
+$object = $object->withAttribute('paging', ['a value']);
|
||||
```
|
||||
|
||||
<br>
|
20
vendor/rector/rector-cakephp/rector.php
vendored
20
vendor/rector/rector-cakephp/rector.php
vendored
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix202210;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->importNames();
|
||||
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);
|
||||
$rectorConfig->skip([
|
||||
// for tests
|
||||
'*/Source/*',
|
||||
'*/Fixture/*',
|
||||
StringClassNameToClassConstantRector::class => [__DIR__ . '/config'],
|
||||
]);
|
||||
$rectorConfig->sets([LevelSetList::UP_TO_PHP_81, SetList::DEAD_CODE, SetList::CODE_QUALITY, SetList::NAMING]);
|
||||
};
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP;
|
||||
|
||||
/**
|
||||
* @inspired https://github.com/cakephp/upgrade/blob/756410c8b7d5aff9daec3fa1fe750a3858d422ac/src/Shell/Task/AppUsesTask.php
|
||||
*/
|
||||
final class ImplicitNameResolver
|
||||
{
|
||||
/**
|
||||
* A map of old => new for use statements that are missing
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private const IMPLICIT_MAP = [
|
||||
'App' => 'Cake\\Core\\App',
|
||||
'AppController' => 'App\\Controller\\AppController',
|
||||
'AppHelper' => 'App\\View\\Helper\\AppHelper',
|
||||
'AppModel' => 'App\\Model\\AppModel',
|
||||
'Cache' => 'Cake\\Cache\\Cache',
|
||||
'CakeEventListener' => 'Cake\\Event\\EventListener',
|
||||
'CakeLog' => 'Cake\\Log\\Log',
|
||||
'CakePlugin' => 'Cake\\Core\\Plugin',
|
||||
'CakeTestCase' => 'Cake\\TestSuite\\TestCase',
|
||||
'CakeTestFixture' => 'Cake\\TestSuite\\Fixture\\TestFixture',
|
||||
'Component' => 'Cake\\Controller\\Component',
|
||||
'ComponentRegistry' => 'Cake\\Controller\\ComponentRegistry',
|
||||
'Configure' => 'Cake\\Core\\Configure',
|
||||
'ConnectionManager' => 'Cake\\Database\\ConnectionManager',
|
||||
'Controller' => 'Cake\\Controller\\Controller',
|
||||
'Debugger' => 'Cake\\Error\\Debugger',
|
||||
'ExceptionRenderer' => 'Cake\\Error\\ExceptionRenderer',
|
||||
'Helper' => 'Cake\\View\\Helper',
|
||||
'HelperRegistry' => 'Cake\\View\\HelperRegistry',
|
||||
'Inflector' => 'Cake\\Utility\\Inflector',
|
||||
'Model' => 'Cake\\Model\\Model',
|
||||
'ModelBehavior' => 'Cake\\Model\\Behavior',
|
||||
'Object' => 'Cake\\Core\\Object',
|
||||
'Router' => 'Cake\\Routing\\Router',
|
||||
'Shell' => 'Cake\\Console\\Shell',
|
||||
'View' => 'Cake\\View\\View',
|
||||
// Also apply to already renamed ones
|
||||
'Log' => 'Cake\\Log\\Log',
|
||||
'Plugin' => 'Cake\\Core\\Plugin',
|
||||
'TestCase' => 'Cake\\TestSuite\\TestCase',
|
||||
'TestFixture' => 'Cake\\TestSuite\\Fixture\\TestFixture',
|
||||
];
|
||||
/**
|
||||
* This value used to be directory So "/" in path should be "\" in namespace
|
||||
*/
|
||||
public function resolve(string $shortClass) : ?string
|
||||
{
|
||||
return self::IMPLICIT_MAP[$shortClass] ?? null;
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Naming;
|
||||
|
||||
use RectorPrefix202210\Nette\Utils\Strings;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\CakePHP\ImplicitNameResolver;
|
||||
use Rector\Core\Util\StringUtils;
|
||||
/**
|
||||
* @inspired https://github.com/cakephp/upgrade/blob/756410c8b7d5aff9daec3fa1fe750a3858d422ac/src/Shell/Task/AppUsesTask.php
|
||||
*/
|
||||
final class CakePHPFullyQualifiedClassNameResolver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/mbvKJp/1
|
||||
*/
|
||||
public const LIB_NAMESPACE_PART_REGEX = '#\\\\Lib\\\\#';
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/XvoZIP/1
|
||||
*/
|
||||
private const SLASH_REGEX = '#(/|\\.)#';
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/lq0lQ9/1
|
||||
*/
|
||||
private const PLUGIN_OR_LIB_REGEX = '#(Plugin|Lib)#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\CakePHP\ImplicitNameResolver
|
||||
*/
|
||||
private $implicitNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
public function __construct(ImplicitNameResolver $implicitNameResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->implicitNameResolver = $implicitNameResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
}
|
||||
/**
|
||||
* This value used to be directory So "/" in path should be "\" in namespace
|
||||
*/
|
||||
public function resolveFromPseudoNamespaceAndShortClassName(string $pseudoNamespace, string $shortClass) : string
|
||||
{
|
||||
$pseudoNamespace = $this->normalizeFileSystemSlashes($pseudoNamespace);
|
||||
$resolvedShortClass = $this->implicitNameResolver->resolve($shortClass);
|
||||
// A. is known renamed class?
|
||||
if ($resolvedShortClass !== null) {
|
||||
return $resolvedShortClass;
|
||||
}
|
||||
// Chop Lib out as locations moves those files to the top level.
|
||||
// But only if Lib is not the last folder.
|
||||
if (StringUtils::isMatch($pseudoNamespace, self::LIB_NAMESPACE_PART_REGEX)) {
|
||||
$pseudoNamespace = Strings::replace($pseudoNamespace, '#\\\\Lib#', '');
|
||||
}
|
||||
// B. is Cake native class?
|
||||
$cakePhpVersion = 'Cake\\' . $pseudoNamespace . '\\' . $shortClass;
|
||||
if ($this->reflectionProvider->hasClass($cakePhpVersion)) {
|
||||
return $cakePhpVersion;
|
||||
}
|
||||
// C. is not plugin nor lib custom App class?
|
||||
if (\strpos($pseudoNamespace, '\\') !== \false && !StringUtils::isMatch($pseudoNamespace, self::PLUGIN_OR_LIB_REGEX)) {
|
||||
return 'App\\' . $pseudoNamespace . '\\' . $shortClass;
|
||||
}
|
||||
return $pseudoNamespace . '\\' . $shortClass;
|
||||
}
|
||||
private function normalizeFileSystemSlashes(string $pseudoNamespace) : string
|
||||
{
|
||||
return Strings::replace($pseudoNamespace, self::SLASH_REGEX, '\\');
|
||||
}
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\CakePHP\ValueObject\ArrayItemsAndFluentClass;
|
||||
use Rector\CakePHP\ValueObject\ArrayToFluentCall;
|
||||
use Rector\CakePHP\ValueObject\FactoryMethod;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202210\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see \Rector\CakePHP\Tests\Rector\MethodCall\ArrayToFluentCallRector\ArrayToFluentCallRectorTest
|
||||
*/
|
||||
final class ArrayToFluentCallRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ARRAYS_TO_FLUENT_CALLS = 'arrays_to_fluent_calls';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const FACTORY_METHODS = 'factory_methods';
|
||||
/**
|
||||
* @var ArrayToFluentCall[]
|
||||
*/
|
||||
private $arraysToFluentCalls = [];
|
||||
/**
|
||||
* @var FactoryMethod[]
|
||||
*/
|
||||
private $factoryMethods = [];
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Moves array options to fluent setter method calls.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
|
||||
use Cake\ORM\Table;
|
||||
|
||||
final class ArticlesTable extends Table
|
||||
{
|
||||
public function initialize(array $config)
|
||||
{
|
||||
$this->belongsTo('Authors', [
|
||||
'foreignKey' => 'author_id',
|
||||
'propertyName' => 'person'
|
||||
]);
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Cake\ORM\Table;
|
||||
|
||||
final class ArticlesTable extends Table
|
||||
{
|
||||
public function initialize(array $config)
|
||||
{
|
||||
$this->belongsTo('Authors')
|
||||
->setForeignKey('author_id')
|
||||
->setProperty('person');
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, [self::ARRAYS_TO_FLUENT_CALLS => [new ArrayToFluentCall('ArticlesTable', ['foreignKey' => 'setForeignKey', 'propertyName' => 'setProperty'])]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [MethodCall::class];
|
||||
}
|
||||
/**
|
||||
* @param MethodCall $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$factoryMethod = $this->matchTypeAndMethodName($node);
|
||||
if (!$factoryMethod instanceof FactoryMethod) {
|
||||
return null;
|
||||
}
|
||||
foreach ($this->arraysToFluentCalls as $arrayToFluentCall) {
|
||||
if ($arrayToFluentCall->getClass() !== $factoryMethod->getNewClass()) {
|
||||
continue;
|
||||
}
|
||||
return $this->replaceArrayToFluentMethodCalls($node, $factoryMethod->getPosition(), $arrayToFluentCall);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param mixed[] $configuration
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$arraysToFluentCalls = $configuration[self::ARRAYS_TO_FLUENT_CALLS] ?? [];
|
||||
Assert::isArray($arraysToFluentCalls);
|
||||
Assert::allIsInstanceOf($arraysToFluentCalls, ArrayToFluentCall::class);
|
||||
$this->arraysToFluentCalls = $arraysToFluentCalls;
|
||||
$factoryMethods = $configuration[self::FACTORY_METHODS] ?? [];
|
||||
Assert::isArray($factoryMethods);
|
||||
Assert::allIsInstanceOf($factoryMethods, FactoryMethod::class);
|
||||
$this->factoryMethods = $factoryMethods;
|
||||
}
|
||||
private function matchTypeAndMethodName(MethodCall $methodCall) : ?FactoryMethod
|
||||
{
|
||||
foreach ($this->factoryMethods as $factoryMethod) {
|
||||
if (!$this->isObjectType($methodCall->var, $factoryMethod->getObjectType())) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isName($methodCall->name, $factoryMethod->getMethod())) {
|
||||
continue;
|
||||
}
|
||||
return $factoryMethod;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function replaceArrayToFluentMethodCalls(MethodCall $methodCall, int $argumentPosition, ArrayToFluentCall $arrayToFluentCall) : ?MethodCall
|
||||
{
|
||||
if (\count($methodCall->args) !== $argumentPosition) {
|
||||
return null;
|
||||
}
|
||||
$argumentValue = $methodCall->args[$argumentPosition - 1]->value;
|
||||
if (!$argumentValue instanceof Array_) {
|
||||
return null;
|
||||
}
|
||||
$arrayItemsAndFluentClass = $this->extractFluentMethods($argumentValue->items, $arrayToFluentCall->getArrayKeysToFluentCalls());
|
||||
if ($arrayItemsAndFluentClass->getArrayItems() !== []) {
|
||||
$argumentValue->items = $arrayItemsAndFluentClass->getArrayItems();
|
||||
} else {
|
||||
$positionToRemove = $argumentPosition - 1;
|
||||
$this->nodeRemover->removeArg($methodCall, $positionToRemove);
|
||||
}
|
||||
if ($arrayItemsAndFluentClass->getFluentCalls() === []) {
|
||||
return null;
|
||||
}
|
||||
$node = $methodCall;
|
||||
foreach ($arrayItemsAndFluentClass->getFluentCalls() as $method => $expr) {
|
||||
$args = $this->nodeFactory->createArgs([$expr]);
|
||||
$node = $this->nodeFactory->createMethodCall($node, $method, $args);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* @param array<ArrayItem|null> $originalArrayItems
|
||||
* @param array<string, string> $arrayMap
|
||||
*/
|
||||
private function extractFluentMethods(array $originalArrayItems, array $arrayMap) : ArrayItemsAndFluentClass
|
||||
{
|
||||
$newArrayItems = [];
|
||||
$fluentCalls = [];
|
||||
foreach ($originalArrayItems as $originalArrayItem) {
|
||||
if ($originalArrayItem === null) {
|
||||
continue;
|
||||
}
|
||||
$key = $originalArrayItem->key;
|
||||
if ($key instanceof String_ && isset($arrayMap[$key->value])) {
|
||||
/** @var string $methodName */
|
||||
$methodName = $arrayMap[$key->value];
|
||||
$fluentCalls[$methodName] = $originalArrayItem->value;
|
||||
} else {
|
||||
$newArrayItems[] = $originalArrayItem;
|
||||
}
|
||||
}
|
||||
return new ArrayItemsAndFluentClass($newArrayItems, $fluentCalls);
|
||||
}
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Identifier;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202210\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html#deprecated-combined-get-set-methods
|
||||
* @see https://github.com/cakephp/cakephp/commit/326292688c5e6d08945a3cafa4b6ffb33e714eea#diff-e7c0f0d636ca50a0350e9be316d8b0f9
|
||||
*
|
||||
* @see \Rector\CakePHP\Tests\Rector\MethodCall\ModalToGetSetRector\ModalToGetSetRectorTest
|
||||
*/
|
||||
final class ModalToGetSetRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UNPREFIXED_METHODS_TO_GET_SET = 'unprefixed_methods_to_get_set';
|
||||
/**
|
||||
* @var ModalToGetSet[]
|
||||
*/
|
||||
private $unprefixedMethodsToGetSet = [];
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Changes combined set/get `value()` to specific `getValue()` or `setValue(x)`.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
|
||||
$object = new InstanceConfigTrait;
|
||||
|
||||
$config = $object->config();
|
||||
$config = $object->config('key');
|
||||
|
||||
$object->config('key', 'value');
|
||||
$object->config(['key' => 'value']);
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
$object = new InstanceConfigTrait;
|
||||
|
||||
$config = $object->getConfig();
|
||||
$config = $object->getConfig('key');
|
||||
|
||||
$object->setConfig('key', 'value');
|
||||
$object->setConfig(['key' => 'value']);
|
||||
CODE_SAMPLE
|
||||
, [self::UNPREFIXED_METHODS_TO_GET_SET => [new ModalToGetSet('InstanceConfigTrait', 'config', 'getConfig', 'setConfig')]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [MethodCall::class];
|
||||
}
|
||||
/**
|
||||
* @param MethodCall $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$modalToGetSet = $this->matchTypeAndMethodName($node);
|
||||
if (!$modalToGetSet instanceof ModalToGetSet) {
|
||||
return null;
|
||||
}
|
||||
$newName = $this->resolveNewMethodNameByCondition($node, $modalToGetSet);
|
||||
$node->name = new Identifier($newName);
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* @param mixed[] $configuration
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$unprefixedMethodsToGetSet = $configuration[self::UNPREFIXED_METHODS_TO_GET_SET] ?? $configuration;
|
||||
Assert::isArray($unprefixedMethodsToGetSet);
|
||||
Assert::allIsAOf($unprefixedMethodsToGetSet, ModalToGetSet::class);
|
||||
$this->unprefixedMethodsToGetSet = $unprefixedMethodsToGetSet;
|
||||
}
|
||||
private function matchTypeAndMethodName(MethodCall $methodCall) : ?ModalToGetSet
|
||||
{
|
||||
foreach ($this->unprefixedMethodsToGetSet as $unprefixedMethodToGetSet) {
|
||||
if (!$this->isObjectType($methodCall->var, $unprefixedMethodToGetSet->getObjectType())) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isName($methodCall->name, $unprefixedMethodToGetSet->getUnprefixedMethod())) {
|
||||
continue;
|
||||
}
|
||||
return $unprefixedMethodToGetSet;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function resolveNewMethodNameByCondition(MethodCall $methodCall, ModalToGetSet $modalToGetSet) : string
|
||||
{
|
||||
if (\count($methodCall->args) >= $modalToGetSet->getMinimalSetterArgumentCount()) {
|
||||
return $modalToGetSet->getSetMethod();
|
||||
}
|
||||
if (!isset($methodCall->args[0])) {
|
||||
return $modalToGetSet->getGetMethod();
|
||||
}
|
||||
// first argument type that is considered setter
|
||||
if ($modalToGetSet->getFirstArgumentType() === null) {
|
||||
return $modalToGetSet->getGetMethod();
|
||||
}
|
||||
$firstArgumentType = $modalToGetSet->getFirstArgumentType();
|
||||
$argumentValue = $methodCall->args[0]->value;
|
||||
if ($firstArgumentType === 'array' && $argumentValue instanceof Array_) {
|
||||
return $modalToGetSet->getSetMethod();
|
||||
}
|
||||
return $modalToGetSet->getGetMethod();
|
||||
}
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Identifier;
|
||||
use Rector\CakePHP\ValueObject\RemoveIntermediaryMethod;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Defluent\NodeAnalyzer\FluentChainMethodCallNodeAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202210\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html#deprecated-combined-get-set-methods
|
||||
* @see https://github.com/cakephp/cakephp/commit/326292688c5e6d08945a3cafa4b6ffb33e714eea#diff-e7c0f0d636ca50a0350e9be316d8b0f9
|
||||
*
|
||||
* @see \Rector\CakePHP\Tests\Rector\MethodCall\ModalToGetSetRector\ModalToGetSetRectorTest
|
||||
*/
|
||||
final class RemoveIntermediaryMethodRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const REMOVE_INTERMEDIARY_METHOD = 'remove_intermediary_method';
|
||||
/**
|
||||
* @var RemoveIntermediaryMethod[]
|
||||
*/
|
||||
private $removeIntermediaryMethod = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Defluent\NodeAnalyzer\FluentChainMethodCallNodeAnalyzer
|
||||
*/
|
||||
private $fluentChainMethodCallNodeAnalyzer;
|
||||
public function __construct(FluentChainMethodCallNodeAnalyzer $fluentChainMethodCallNodeAnalyzer)
|
||||
{
|
||||
$this->fluentChainMethodCallNodeAnalyzer = $fluentChainMethodCallNodeAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Removes an intermediary method call for when a higher level API is added.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
|
||||
$users = $this->getTableLocator()->get('Users');
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
$users = $this->fetchTable('Users');
|
||||
CODE_SAMPLE
|
||||
, [self::REMOVE_INTERMEDIARY_METHOD => [new RemoveIntermediaryMethod('getTableLocator', 'get', 'fetchTable')]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [MethodCall::class];
|
||||
}
|
||||
/**
|
||||
* @param MethodCall $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$removeIntermediaryMethod = $this->matchTypeAndMethodName($node);
|
||||
if (!$removeIntermediaryMethod instanceof RemoveIntermediaryMethod) {
|
||||
return null;
|
||||
}
|
||||
/** @var MethodCall $var */
|
||||
$var = $node->var;
|
||||
$target = $var->var;
|
||||
return new MethodCall($target, $removeIntermediaryMethod->getFinalMethod(), $node->args);
|
||||
}
|
||||
/**
|
||||
* @param mixed[] $configuration
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$removeIntermediaryMethods = $configuration[self::REMOVE_INTERMEDIARY_METHOD] ?? $configuration;
|
||||
Assert::isArray($removeIntermediaryMethods);
|
||||
Assert::allIsAOf($removeIntermediaryMethods, RemoveIntermediaryMethod::class);
|
||||
$this->removeIntermediaryMethod = $removeIntermediaryMethods;
|
||||
}
|
||||
private function matchTypeAndMethodName(MethodCall $methodCall) : ?RemoveIntermediaryMethod
|
||||
{
|
||||
$rootMethodCall = $this->fluentChainMethodCallNodeAnalyzer->resolveRootMethodCall($methodCall);
|
||||
if (!$rootMethodCall instanceof MethodCall) {
|
||||
return null;
|
||||
}
|
||||
if (!$rootMethodCall->var instanceof Variable) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeNameResolver->isName($rootMethodCall->var, 'this')) {
|
||||
return null;
|
||||
}
|
||||
/** @var MethodCall $var */
|
||||
$var = $methodCall->var;
|
||||
if (!$methodCall->name instanceof Identifier || !$var->name instanceof Identifier) {
|
||||
return null;
|
||||
}
|
||||
foreach ($this->removeIntermediaryMethod as $singleRemoveIntermediaryMethod) {
|
||||
if (!$this->isName($methodCall->name, $singleRemoveIntermediaryMethod->getSecondMethod())) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isName($var->name, $singleRemoveIntermediaryMethod->getFirstMethod())) {
|
||||
continue;
|
||||
}
|
||||
return $singleRemoveIntermediaryMethod;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Identifier;
|
||||
use Rector\CakePHP\ValueObject\RenameMethodCallBasedOnParameter;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202210\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://book.cakephp.org/4.0/en/appendices/4-0-migration-guide.html
|
||||
* @see https://github.com/cakephp/cakephp/commit/77017145961bb697b4256040b947029259f66a9b
|
||||
*
|
||||
* @see \Rector\CakePHP\Tests\Rector\MethodCall\RenameMethodCallBasedOnParameterRector\RenameMethodCallBasedOnParameterRectorTest
|
||||
*/
|
||||
final class RenameMethodCallBasedOnParameterRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CALLS_WITH_PARAM_RENAMES = 'calls_with_param_renames';
|
||||
/**
|
||||
* @var RenameMethodCallBasedOnParameter[]
|
||||
*/
|
||||
private $callsWithParamRenames = [];
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
$configuration = [self::CALLS_WITH_PARAM_RENAMES => [new RenameMethodCallBasedOnParameter('ServerRequest', 'getParam', 'paging', 'getAttribute'), new RenameMethodCallBasedOnParameter('ServerRequest', 'withParam', 'paging', 'withAttribute')]];
|
||||
return new RuleDefinition('Changes method calls based on matching the first parameter value.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
|
||||
$object = new ServerRequest();
|
||||
|
||||
$config = $object->getParam('paging');
|
||||
$object = $object->withParam('paging', ['a value']);
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
$object = new ServerRequest();
|
||||
|
||||
$config = $object->getAttribute('paging');
|
||||
$object = $object->withAttribute('paging', ['a value']);
|
||||
CODE_SAMPLE
|
||||
, $configuration)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [MethodCall::class];
|
||||
}
|
||||
/**
|
||||
* @param MethodCall $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$renameMethodCallBasedOnParameter = $this->matchTypeAndMethodName($node);
|
||||
if (!$renameMethodCallBasedOnParameter instanceof RenameMethodCallBasedOnParameter) {
|
||||
return null;
|
||||
}
|
||||
$node->name = new Identifier($renameMethodCallBasedOnParameter->getNewMethod());
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* @param mixed[] $configuration
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$callsWithParamRenames = $configuration[self::CALLS_WITH_PARAM_RENAMES] ?? $configuration;
|
||||
Assert::isArray($callsWithParamRenames);
|
||||
Assert::allIsInstanceOf($callsWithParamRenames, RenameMethodCallBasedOnParameter::class);
|
||||
$this->callsWithParamRenames = $callsWithParamRenames;
|
||||
}
|
||||
private function matchTypeAndMethodName(MethodCall $methodCall) : ?RenameMethodCallBasedOnParameter
|
||||
{
|
||||
if (\count($methodCall->args) < 1) {
|
||||
return null;
|
||||
}
|
||||
$firstArgValue = $methodCall->args[0]->value;
|
||||
foreach ($this->callsWithParamRenames as $callWithParamRename) {
|
||||
if (!$this->isObjectType($methodCall->var, $callWithParamRename->getOldObjectType())) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isName($methodCall->name, $callWithParamRename->getOldMethod())) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->valueResolver->isValue($firstArgValue, $callWithParamRename->getParameterName())) {
|
||||
continue;
|
||||
}
|
||||
return $callWithParamRename;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Rector\Namespace_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt\Declare_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\CakePHP\Naming\CakePHPFullyQualifiedClassNameResolver;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/cakephp/upgrade/blob/756410c8b7d5aff9daec3fa1fe750a3858d422ac/src/Shell/Task/AppUsesTask.php
|
||||
* @see https://github.com/cakephp/upgrade/search?q=uses&unscoped_q=uses
|
||||
*
|
||||
* @see \Rector\CakePHP\Tests\Rector\Namespace_\AppUsesStaticCallToUseStatementRector\AppUsesStaticCallToUseStatementRectorTest
|
||||
*/
|
||||
final class AppUsesStaticCallToUseStatementRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\CakePHP\Naming\CakePHPFullyQualifiedClassNameResolver
|
||||
*/
|
||||
private $cakePHPFullyQualifiedClassNameResolver;
|
||||
public function __construct(CakePHPFullyQualifiedClassNameResolver $cakePHPFullyQualifiedClassNameResolver)
|
||||
{
|
||||
$this->cakePHPFullyQualifiedClassNameResolver = $cakePHPFullyQualifiedClassNameResolver;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Change App::uses() to use imports', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
App::uses('NotificationListener', 'Event');
|
||||
|
||||
CakeEventManager::instance()->attach(new NotificationListener());
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Event\NotificationListener;
|
||||
|
||||
CakeEventManager::instance()->attach(new NotificationListener());
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [FileWithoutNamespace::class, Namespace_::class];
|
||||
}
|
||||
/**
|
||||
* @param FileWithoutNamespace|Namespace_ $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$appUsesStaticCalls = $this->collectAppUseStaticCalls($node);
|
||||
if ($appUsesStaticCalls === []) {
|
||||
return null;
|
||||
}
|
||||
$this->nodeRemover->removeNodes($appUsesStaticCalls);
|
||||
$names = $this->resolveNamesFromStaticCalls($appUsesStaticCalls);
|
||||
$uses = $this->nodeFactory->createUsesFromNames($names);
|
||||
if ($node instanceof Namespace_) {
|
||||
$node->stmts = \array_merge($uses, $node->stmts);
|
||||
return $node;
|
||||
}
|
||||
return $this->refactorFile($node, $uses);
|
||||
}
|
||||
/**
|
||||
* @return StaticCall[]
|
||||
*/
|
||||
private function collectAppUseStaticCalls(Node $node) : array
|
||||
{
|
||||
/** @var StaticCall[] $appUsesStaticCalls */
|
||||
$appUsesStaticCalls = $this->betterNodeFinder->find($node, function (Node $node) : bool {
|
||||
if (!$node instanceof StaticCall) {
|
||||
return \false;
|
||||
}
|
||||
$callerType = $this->nodeTypeResolver->getType($node->class);
|
||||
if (!$callerType->isSuperTypeOf(new ObjectType('App'))->yes()) {
|
||||
return \false;
|
||||
}
|
||||
return $this->isName($node->name, 'uses');
|
||||
});
|
||||
return $appUsesStaticCalls;
|
||||
}
|
||||
/**
|
||||
* @param StaticCall[] $staticCalls
|
||||
* @return string[]
|
||||
*/
|
||||
private function resolveNamesFromStaticCalls(array $staticCalls) : array
|
||||
{
|
||||
$names = [];
|
||||
foreach ($staticCalls as $staticCall) {
|
||||
$names[] = $this->createFullyQualifiedNameFromAppUsesStaticCall($staticCall);
|
||||
}
|
||||
return $names;
|
||||
}
|
||||
/**
|
||||
* @param Use_[] $uses
|
||||
*/
|
||||
private function refactorFile(FileWithoutNamespace $fileWithoutNamespace, array $uses) : ?FileWithoutNamespace
|
||||
{
|
||||
$hasNamespace = $this->betterNodeFinder->findFirstInstanceOf($fileWithoutNamespace, Namespace_::class);
|
||||
// already handled above
|
||||
if ($hasNamespace !== null) {
|
||||
return null;
|
||||
}
|
||||
$hasDeclare = $this->betterNodeFinder->findFirstInstanceOf($fileWithoutNamespace, Declare_::class);
|
||||
if ($hasDeclare !== null) {
|
||||
return $this->refactorFileWithDeclare($fileWithoutNamespace, $uses);
|
||||
}
|
||||
$fileWithoutNamespace->stmts = \array_merge($uses, $fileWithoutNamespace->stmts);
|
||||
return $fileWithoutNamespace;
|
||||
}
|
||||
private function createFullyQualifiedNameFromAppUsesStaticCall(StaticCall $staticCall) : string
|
||||
{
|
||||
/** @var string $shortClassName */
|
||||
$shortClassName = $this->valueResolver->getValue($staticCall->args[0]->value);
|
||||
/** @var string $namespaceName */
|
||||
$namespaceName = $this->valueResolver->getValue($staticCall->args[1]->value);
|
||||
return $this->cakePHPFullyQualifiedClassNameResolver->resolveFromPseudoNamespaceAndShortClassName($namespaceName, $shortClassName);
|
||||
}
|
||||
/**
|
||||
* @param Use_[] $uses
|
||||
*/
|
||||
private function refactorFileWithDeclare(FileWithoutNamespace $fileWithoutNamespace, array $uses) : FileWithoutNamespace
|
||||
{
|
||||
$newStmts = [];
|
||||
foreach ($fileWithoutNamespace->stmts as $stmt) {
|
||||
$newStmts[] = $stmt;
|
||||
if ($stmt instanceof Declare_) {
|
||||
foreach ($uses as $use) {
|
||||
$newStmts[] = $use;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return new FileWithoutNamespace($newStmts);
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Rector\Property;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PhpParser\Node\Stmt\PropertyProperty;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use RectorPrefix202210\Symfony\Component\String\UnicodeString;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\CakePHP\Tests\Rector\Property\ChangeSnakedFixtureNameToPascal\ChangeSnakedFixtureNameToPascalTest
|
||||
*
|
||||
* @see https://book.cakephp.org/3.0/en/appendices/3-7-migration-guide.html
|
||||
*/
|
||||
final class ChangeSnakedFixtureNameToPascalRector extends AbstractRector
|
||||
{
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Changes $fixtures style from snake_case to PascalCase.', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeTest
|
||||
{
|
||||
protected $fixtures = [
|
||||
'app.posts',
|
||||
'app.users',
|
||||
'some_plugin.posts/special_posts',
|
||||
];
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeTest
|
||||
{
|
||||
protected $fixtures = [
|
||||
'app.Posts',
|
||||
'app.Users',
|
||||
'some_plugin.Posts/SpecialPosts',
|
||||
];
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Property::class];
|
||||
}
|
||||
/**
|
||||
* @param Property $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$classLike = $this->betterNodeFinder->findParentType($node, ClassLike::class);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node, 'fixtures')) {
|
||||
return null;
|
||||
}
|
||||
foreach ($node->props as $prop) {
|
||||
$this->refactorPropertyWithArrayDefault($prop);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
private function refactorPropertyWithArrayDefault(PropertyProperty $propertyProperty) : void
|
||||
{
|
||||
if (!$propertyProperty->default instanceof Array_) {
|
||||
return;
|
||||
}
|
||||
$array = $propertyProperty->default;
|
||||
foreach ($array->items as $arrayItem) {
|
||||
if (!$arrayItem instanceof ArrayItem) {
|
||||
continue;
|
||||
}
|
||||
$itemValue = $arrayItem->value;
|
||||
if (!$itemValue instanceof String_) {
|
||||
continue;
|
||||
}
|
||||
$this->renameFixtureName($itemValue);
|
||||
}
|
||||
}
|
||||
private function renameFixtureName(String_ $string) : void
|
||||
{
|
||||
[$prefix, $table] = \explode('.', $string->value);
|
||||
$tableParts = \explode('/', $table);
|
||||
$pascalCaseTableParts = \array_map(function (string $token) : string {
|
||||
$tokenUnicodeString = new UnicodeString($token);
|
||||
return \ucfirst($tokenUnicodeString->camel()->toString());
|
||||
}, $tableParts);
|
||||
$table = \implode('/', $pascalCaseTableParts);
|
||||
$string->value = \sprintf('%s.%s', $prefix, $table);
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Set;
|
||||
|
||||
use Rector\Set\Contract\SetListInterface;
|
||||
final class CakePHPLevelSetList implements SetListInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_34 = __DIR__ . '/../../config/sets/level/up-to-cakephp-34.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_35 = __DIR__ . '/../../config/sets/level/up-to-cakephp-35.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_36 = __DIR__ . '/../../config/sets/level/up-to-cakephp-36.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_37 = __DIR__ . '/../../config/sets/level/up-to-cakephp-37.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_38 = __DIR__ . '/../../config/sets/level/up-to-cakephp-38.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_40 = __DIR__ . '/../../config/sets/level/up-to-cakephp-40.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_41 = __DIR__ . '/../../config/sets/level/up-to-cakephp-41.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_42 = __DIR__ . '/../../config/sets/level/up-to-cakephp-42.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_43 = __DIR__ . '/../../config/sets/level/up-to-cakephp-43.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UP_TO_CAKEPHP_44 = __DIR__ . '/../../config/sets/level/up-to-cakephp-44.php';
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\Set;
|
||||
|
||||
use Rector\Set\Contract\SetListInterface;
|
||||
final class CakePHPSetList implements SetListInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_30 = __DIR__ . '/../../config/sets/cakephp30.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_34 = __DIR__ . '/../../config/sets/cakephp34.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_35 = __DIR__ . '/../../config/sets/cakephp35.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_36 = __DIR__ . '/../../config/sets/cakephp36.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_37 = __DIR__ . '/../../config/sets/cakephp37.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_38 = __DIR__ . '/../../config/sets/cakephp38.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_40 = __DIR__ . '/../../config/sets/cakephp40.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_41 = __DIR__ . '/../../config/sets/cakephp41.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_42 = __DIR__ . '/../../config/sets/cakephp42.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_43 = __DIR__ . '/../../config/sets/cakephp43.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_44 = __DIR__ . '/../../config/sets/cakephp44.php';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CAKEPHP_FLUENT_OPTIONS = __DIR__ . '/../../config/sets/cakephp-fluent-options.php';
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\ValueObject;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
final class ArrayItemsAndFluentClass
|
||||
{
|
||||
/**
|
||||
* @var ArrayItem[]
|
||||
* @readonly
|
||||
*/
|
||||
private $arrayItems;
|
||||
/**
|
||||
* @var array<string, Expr>
|
||||
* @readonly
|
||||
*/
|
||||
private $fluentCalls;
|
||||
/**
|
||||
* @param ArrayItem[] $arrayItems
|
||||
* @param array<string, Expr> $fluentCalls
|
||||
*/
|
||||
public function __construct(array $arrayItems, array $fluentCalls)
|
||||
{
|
||||
$this->arrayItems = $arrayItems;
|
||||
$this->fluentCalls = $fluentCalls;
|
||||
}
|
||||
/**
|
||||
* @return ArrayItem[]
|
||||
*/
|
||||
public function getArrayItems() : array
|
||||
{
|
||||
return $this->arrayItems;
|
||||
}
|
||||
/**
|
||||
* @return array<string, Expr>
|
||||
*/
|
||||
public function getFluentCalls() : array
|
||||
{
|
||||
return $this->fluentCalls;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\ValueObject;
|
||||
|
||||
final class ArrayToFluentCall
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $class;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
* @readonly
|
||||
*/
|
||||
private $arrayKeysToFluentCalls;
|
||||
/**
|
||||
* @param array<string, string> $arrayKeysToFluentCalls
|
||||
*/
|
||||
public function __construct(string $class, array $arrayKeysToFluentCalls)
|
||||
{
|
||||
$this->class = $class;
|
||||
$this->arrayKeysToFluentCalls = $arrayKeysToFluentCalls;
|
||||
}
|
||||
public function getClass() : string
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getArrayKeysToFluentCalls() : array
|
||||
{
|
||||
return $this->arrayKeysToFluentCalls;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\ValueObject;
|
||||
|
||||
use PHPStan\Type\ObjectType;
|
||||
final class FactoryMethod
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $method;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $newClass;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
*/
|
||||
private $position;
|
||||
public function __construct(string $type, string $method, string $newClass, int $position)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->method = $method;
|
||||
$this->newClass = $newClass;
|
||||
$this->position = $position;
|
||||
}
|
||||
public function getObjectType() : ObjectType
|
||||
{
|
||||
return new ObjectType($this->type);
|
||||
}
|
||||
public function getMethod() : string
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
public function getPosition() : int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
public function getNewClass() : string
|
||||
{
|
||||
return $this->newClass;
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\ValueObject;
|
||||
|
||||
use PHPStan\Type\ObjectType;
|
||||
final class ModalToGetSet
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $getMethod;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $setMethod;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $unprefixedMethod;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
*/
|
||||
private $minimalSetterArgumentCount = 1;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string|null
|
||||
*/
|
||||
private $firstArgumentType;
|
||||
public function __construct(string $type, string $unprefixedMethod, ?string $getMethod = null, ?string $setMethod = null, int $minimalSetterArgumentCount = 1, ?string $firstArgumentType = null)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->unprefixedMethod = $unprefixedMethod;
|
||||
$this->minimalSetterArgumentCount = $minimalSetterArgumentCount;
|
||||
$this->firstArgumentType = $firstArgumentType;
|
||||
$this->getMethod = $getMethod ?? 'get' . \ucfirst($unprefixedMethod);
|
||||
$this->setMethod = $setMethod ?? 'set' . \ucfirst($unprefixedMethod);
|
||||
}
|
||||
public function getObjectType() : ObjectType
|
||||
{
|
||||
return new ObjectType($this->type);
|
||||
}
|
||||
public function getUnprefixedMethod() : string
|
||||
{
|
||||
return $this->unprefixedMethod;
|
||||
}
|
||||
public function getGetMethod() : string
|
||||
{
|
||||
return $this->getMethod;
|
||||
}
|
||||
public function getSetMethod() : string
|
||||
{
|
||||
return $this->setMethod;
|
||||
}
|
||||
public function getMinimalSetterArgumentCount() : int
|
||||
{
|
||||
return $this->minimalSetterArgumentCount;
|
||||
}
|
||||
public function getFirstArgumentType() : ?string
|
||||
{
|
||||
return $this->firstArgumentType;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\ValueObject;
|
||||
|
||||
final class RemoveIntermediaryMethod
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $firstMethod;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $secondMethod;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $finalMethod;
|
||||
public function __construct(string $firstMethod, string $secondMethod, string $finalMethod)
|
||||
{
|
||||
$this->firstMethod = $firstMethod;
|
||||
$this->secondMethod = $secondMethod;
|
||||
$this->finalMethod = $finalMethod;
|
||||
}
|
||||
public function getFirstMethod() : string
|
||||
{
|
||||
return $this->firstMethod;
|
||||
}
|
||||
public function getSecondMethod() : string
|
||||
{
|
||||
return $this->secondMethod;
|
||||
}
|
||||
public function getFinalMethod() : string
|
||||
{
|
||||
return $this->finalMethod;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CakePHP\ValueObject;
|
||||
|
||||
use PHPStan\Type\ObjectType;
|
||||
final class RenameMethodCallBasedOnParameter
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $oldClass;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $oldMethod;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $parameterName;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $newMethod;
|
||||
public function __construct(string $oldClass, string $oldMethod, string $parameterName, string $newMethod)
|
||||
{
|
||||
$this->oldClass = $oldClass;
|
||||
$this->oldMethod = $oldMethod;
|
||||
$this->parameterName = $parameterName;
|
||||
$this->newMethod = $newMethod;
|
||||
}
|
||||
public function getOldMethod() : string
|
||||
{
|
||||
return $this->oldMethod;
|
||||
}
|
||||
public function getParameterName() : string
|
||||
{
|
||||
return $this->parameterName;
|
||||
}
|
||||
public function getNewMethod() : string
|
||||
{
|
||||
return $this->newMethod;
|
||||
}
|
||||
public function getOldObjectType() : ObjectType
|
||||
{
|
||||
return new ObjectType($this->oldClass);
|
||||
}
|
||||
}
|
|
@ -12,10 +12,12 @@ use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
|||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Symfony\Rector\MethodCall\MakeDispatchFirstArgumentEventRector;
|
||||
use Rector\Symfony\Rector\MethodCall\WebTestCaseAssertIsSuccessfulRector;
|
||||
use Rector\Symfony\Rector\MethodCall\WebTestCaseAssertResponseCodeRector;
|
||||
# https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.3.md
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
# https://symfony.com/blog/new-in-symfony-4-3-better-test-assertions
|
||||
$rectorConfig->rule(WebTestCaseAssertIsSuccessfulRector::class);
|
||||
$rectorConfig->rule(WebTestCaseAssertResponseCodeRector::class);
|
||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
|
||||
new MethodCallRename('Symfony\\Component\\BrowserKit\\Response', 'getStatus', 'getStatusCode'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user