mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 08:20:53 +00:00
[DX] Make use of configure() method (#1344)
This commit is contained in:
parent
d1fd98466e
commit
58c8a93698
|
@ -38,7 +38,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeParameterTypeWideningRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
DowngradeParameterTypeWideningRector::SAFE_TYPES => [
|
||||
// phsptan
|
||||
Type::class,
|
||||
|
@ -83,7 +83,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
'hasParameter',
|
||||
],
|
||||
],
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,9 +17,7 @@ Let´s say you want to define a custom configuration where you want to update th
|
|||
All you have to do is using the ChangePackageVersionComposerRector:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// rector.php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Composer\Rector\ChangePackageVersionComposerRector;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
|
@ -29,21 +27,16 @@ use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ChangePackageVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
// we use constant for keys to save you from typos
|
||||
ChangePackageVersionComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('symfony/yaml', '^5.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new PackageAndVersion('symfony/yaml', '^5.0'),
|
||||
]);
|
||||
};
|
||||
```
|
||||
|
||||
There are some more rules related to manipulate your composer.json files. Let´s see them in action:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// rector.php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Composer\Rector\AddPackageToRequireComposerRector;
|
||||
use Rector\Composer\Rector\AddPackageToRequireDevComposerRector;
|
||||
|
@ -59,37 +52,27 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
// Add a package to the require section of your composer.json
|
||||
$services->set(AddPackageToRequireComposerRector::class)
|
||||
->call('configure', [[
|
||||
// we use constant for keys to save you from typos
|
||||
AddPackageToRequireComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('symfony/yaml', '^5.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new PackageAndVersion('symfony/yaml', '^5.0'),
|
||||
]);
|
||||
|
||||
// Add a package to the require dev section of your composer.json
|
||||
$services->set(AddPackageToRequireDevComposerRector::class)
|
||||
->call('configure', [[
|
||||
// we use constant for keys to save you from typos
|
||||
AddPackageToRequireDevComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('phpunit/phpunit', '^9.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new PackageAndVersion('phpunit/phpunit', '^9.0'),
|
||||
]);
|
||||
|
||||
// Remove a package from composer.json
|
||||
$services->set(RemovePackageComposerRector::class)
|
||||
->call('configure', [[
|
||||
// we use constant for keys to save you from typos
|
||||
RemovePackageComposerRector::PACKAGE_NAMES => ['symfony/console']
|
||||
]]);
|
||||
->configure([
|
||||
'symfony/console'
|
||||
]);
|
||||
|
||||
// Replace a package in the composer.json
|
||||
$services->set(ReplacePackageAndVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
// we use constant for keys to save you from typos
|
||||
ReplacePackageAndVersionComposerRector::REPLACE_PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new ReplacePackageAndVersion('vendor1/package2', 'vendor2/package1', '^3.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ReplacePackageAndVersion('vendor1/package2', 'vendor2/package1', '^3.0'),
|
||||
]);
|
||||
};
|
||||
```
|
||||
|
||||
|
|
|
@ -17,11 +17,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
// we use constant for keys to save you from typos
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'App\SomeOldClass' => 'App\SomeNewClass',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'App\SomeOldClass' => 'App\SomeNewClass',
|
||||
]);
|
||||
};
|
||||
```
|
||||
|
|
|
@ -127,11 +127,9 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentAdder('SomeExampleClass', 'someMethod', 0, 'someArgument', true, new ObjectType('SomeType')),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ArgumentAdder('SomeExampleClass', 'someMethod', 0, 'someArgument', true, new ObjectType('SomeType')),
|
||||
]);
|
||||
};
|
||||
```
|
||||
|
||||
|
|
|
@ -140,33 +140,31 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(ArrayThisCallToThisMethodCallRector::class);
|
||||
$services->set(CommonNotEqualRector::class);
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'split' => 'explode',
|
||||
'join' => 'implode',
|
||||
'sizeof' => 'count',
|
||||
# https://www.php.net/manual/en/aliases.php
|
||||
'chop' => 'rtrim',
|
||||
'doubleval' => 'floatval',
|
||||
'gzputs' => 'gzwrites',
|
||||
'fputs' => 'fwrite',
|
||||
'ini_alter' => 'ini_set',
|
||||
'is_double' => 'is_float',
|
||||
'is_integer' => 'is_int',
|
||||
'is_long' => 'is_int',
|
||||
'is_real' => 'is_float',
|
||||
'is_writeable' => 'is_writable',
|
||||
'key_exists' => 'array_key_exists',
|
||||
'pos' => 'current',
|
||||
'strchr' => 'strstr',
|
||||
# mb
|
||||
'mbstrcut' => 'mb_strcut',
|
||||
'mbstrlen' => 'mb_strlen',
|
||||
'mbstrpos' => 'mb_strpos',
|
||||
'mbstrrpos' => 'mb_strrpos',
|
||||
'mbsubstr' => 'mb_substr',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'split' => 'explode',
|
||||
'join' => 'implode',
|
||||
'sizeof' => 'count',
|
||||
# https://www.php.net/manual/en/aliases.php
|
||||
'chop' => 'rtrim',
|
||||
'doubleval' => 'floatval',
|
||||
'gzputs' => 'gzwrites',
|
||||
'fputs' => 'fwrite',
|
||||
'ini_alter' => 'ini_set',
|
||||
'is_double' => 'is_float',
|
||||
'is_integer' => 'is_int',
|
||||
'is_long' => 'is_int',
|
||||
'is_real' => 'is_float',
|
||||
'is_writeable' => 'is_writable',
|
||||
'key_exists' => 'array_key_exists',
|
||||
'pos' => 'current',
|
||||
'strchr' => 'strstr',
|
||||
# mb
|
||||
'mbstrcut' => 'mb_strcut',
|
||||
'mbstrlen' => 'mb_strlen',
|
||||
'mbstrpos' => 'mb_strpos',
|
||||
'mbstrrpos' => 'mb_strrpos',
|
||||
'mbsubstr' => 'mb_substr',
|
||||
]);
|
||||
$services->set(SetTypeToCastRector::class);
|
||||
$services->set(LogicalToBooleanRector::class);
|
||||
$services->set(VarToPublicPropertyRector::class);
|
||||
|
|
|
@ -64,12 +64,10 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(UseMessageVariableForSprintfInSymfonyStyleRector::class);
|
||||
|
||||
$services->set(FuncCallToConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
FuncCallToConstFetchRector::FUNCTIONS_TO_CONSTANTS => [
|
||||
'php_sapi_name' => 'PHP_SAPI',
|
||||
'pi' => 'M_PI',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'php_sapi_name' => 'PHP_SAPI',
|
||||
'pi' => 'M_PI',
|
||||
]);
|
||||
|
||||
$services->set(SeparateMultiUseImportsRector::class);
|
||||
$services->set(RemoveDoubleUnderscoreInMethodNameRector::class);
|
||||
|
|
|
@ -27,7 +27,6 @@ use Rector\DowngradePhp80\Rector\StaticCall\DowngradePhpTokenRector;
|
|||
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
|
||||
use Rector\Removing\Rector\Class_\RemoveInterfacesRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
@ -35,24 +34,20 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveInterfacesRector::class)
|
||||
->call('configure', [[
|
||||
RemoveInterfacesRector::INTERFACES_TO_REMOVE => [
|
||||
// @see https://wiki.php.net/rfc/stringable
|
||||
'Stringable',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
// @see https://wiki.php.net/rfc/stringable
|
||||
'Stringable',
|
||||
]);
|
||||
|
||||
$services->set(DowngradeNamedArgumentRector::class);
|
||||
|
||||
$services->set(DowngradeAttributeToAnnotationRector::class)
|
||||
->call('configure', [[
|
||||
DowngradeAttributeToAnnotationRector::ATTRIBUTE_TO_ANNOTATION => ValueObjectInliner::inline([
|
||||
// Symfony
|
||||
new DowngradeAttributeToAnnotation('Symfony\Contracts\Service\Attribute\Required', 'required'),
|
||||
// Nette
|
||||
new DowngradeAttributeToAnnotation('Nette\DI\Attributes\Inject', 'inject'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
// Symfony
|
||||
new DowngradeAttributeToAnnotation('Symfony\Contracts\Service\Attribute\Required', 'required'),
|
||||
// Nette
|
||||
new DowngradeAttributeToAnnotation('Nette\DI\Attributes\Inject', 'inject'),
|
||||
]);
|
||||
|
||||
$services->set(DowngradeUnionTypeTypedPropertyRector::class);
|
||||
$services->set(DowngradeUnionTypeDeclarationRector::class);
|
||||
|
|
|
@ -5,31 +5,28 @@ declare(strict_types=1);
|
|||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
// Rename is now move, specific for files.
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'rename', 'move'),
|
||||
->configure([
|
||||
// Rename is now move, specific for files.
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'rename', 'move'),
|
||||
|
||||
// No arbitrary abbreviations
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'createDir', 'createDirectory'),
|
||||
// No arbitrary abbreviations
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'createDir', 'createDirectory'),
|
||||
|
||||
// Writes are now deterministic
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'update', 'write'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'updateStream', 'writeStream'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'put', 'write'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'putStream', 'writeStream'),
|
||||
// Writes are now deterministic
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'update', 'write'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'updateStream', 'writeStream'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'put', 'write'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'putStream', 'writeStream'),
|
||||
|
||||
// Metadata getters are renamed
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getTimestamp', 'lastModified'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'has', 'fileExists'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getMimetype', 'mimeType'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getSize', 'fileSize'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getVisibility', 'visibility'),
|
||||
]),
|
||||
]]);
|
||||
// Metadata getters are renamed
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getTimestamp', 'lastModified'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'has', 'fileExists'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getMimetype', 'mimeType'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getSize', 'fileSize'),
|
||||
new MethodCallRename('League\Flysystem\FilesystemInterface', 'getVisibility', 'visibility'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,162 +6,157 @@ use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
|||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://www.php.net/manual/en/book.gmagick.php → https://www.php.net/manual/en/book.imagick.php
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'Gmagick' => 'Imagick',
|
||||
'GmagickPixel' => 'ImagickPixel',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'Gmagick' => 'Imagick',
|
||||
'GmagickPixel' => 'ImagickPixel',
|
||||
]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Gmagick', 'addimage', 'addImage'),
|
||||
new MethodCallRename('Gmagick', 'addnoiseimage', 'addNoiseImage'),
|
||||
new MethodCallRename('Gmagick', 'annotateimage', 'annotateImage'),
|
||||
new MethodCallRename('Gmagick', 'blurimage', 'blurImage'),
|
||||
new MethodCallRename('Gmagick', 'borderimage', 'borderImage'),
|
||||
new MethodCallRename('Gmagick', 'charcoalimage', 'charcoalImage'),
|
||||
new MethodCallRename('Gmagick', 'chopimage', 'chopImage'),
|
||||
new MethodCallRename('Gmagick', 'commentimage', 'commentImage'),
|
||||
new MethodCallRename('Gmagick', 'compositeimage', 'compositeImage'),
|
||||
new MethodCallRename('Gmagick', 'cropimage', 'cropImage'),
|
||||
new MethodCallRename('Gmagick', 'cropthumbnailimage', 'cropThumbnailImage'),
|
||||
new MethodCallRename('Gmagick', 'cyclecolormapimage', 'cycleColormapImage'),
|
||||
new MethodCallRename('Gmagick', 'deconstructimages', 'deconstructImages'),
|
||||
new MethodCallRename('Gmagick', 'despeckleimage', 'despeckleImage'),
|
||||
new MethodCallRename('Gmagick', 'drawimage', 'drawImage'),
|
||||
new MethodCallRename('Gmagick', 'edgeimage', 'edgeImage'),
|
||||
new MethodCallRename('Gmagick', 'embossimage', 'embossImage'),
|
||||
new MethodCallRename('Gmagick', 'enhanceimage', 'enhanceImage'),
|
||||
new MethodCallRename('Gmagick', 'equalizeimage', 'equalizeImage'),
|
||||
new MethodCallRename('Gmagick', 'flipimage', 'flipImage'),
|
||||
new MethodCallRename('Gmagick', 'flopimage', 'flopImage'),
|
||||
new MethodCallRename('Gmagick', 'frameimage', 'frameImage'),
|
||||
new MethodCallRename('Gmagick', 'gammaimage', 'gammaImage'),
|
||||
new MethodCallRename('Gmagick', 'getcopyright', 'getCopyright'),
|
||||
new MethodCallRename('Gmagick', 'getfilename', 'getFilename'),
|
||||
new MethodCallRename('Gmagick', 'getimagebackgroundcolor', 'getImageBackgroundColor'),
|
||||
new MethodCallRename('Gmagick', 'getimageblueprimary', 'getImageBluePrimary'),
|
||||
new MethodCallRename('Gmagick', 'getimagebordercolor', 'getImageBorderColor'),
|
||||
new MethodCallRename('Gmagick', 'getimagechanneldepth', 'getImageChannelDepth'),
|
||||
new MethodCallRename('Gmagick', 'getimagecolors', 'getImageColors'),
|
||||
new MethodCallRename('Gmagick', 'getimagecolorspace', 'getImageColorspace'),
|
||||
new MethodCallRename('Gmagick', 'getimagecompose', 'getImageCompose'),
|
||||
new MethodCallRename('Gmagick', 'getimagedelay', 'getImageDelay'),
|
||||
new MethodCallRename('Gmagick', 'getimagedepth', 'getImageDepth'),
|
||||
new MethodCallRename('Gmagick', 'getimagedispose', 'getImageDispose'),
|
||||
new MethodCallRename('Gmagick', 'getimageextrema', 'getImageExtrema'),
|
||||
new MethodCallRename('Gmagick', 'getimagefilename', 'getImageFilename'),
|
||||
new MethodCallRename('Gmagick', 'getimageformat', 'getImageFormat'),
|
||||
new MethodCallRename('Gmagick', 'getimagegamma', 'getImageGamma'),
|
||||
new MethodCallRename('Gmagick', 'getimagegreenprimary', 'getImageGreenPrimary'),
|
||||
new MethodCallRename('Gmagick', 'getimageheight', 'getImageHeight'),
|
||||
new MethodCallRename('Gmagick', 'getimagehistogram', 'getImageHistogram'),
|
||||
new MethodCallRename('Gmagick', 'getimageindex', 'getImageIndex'),
|
||||
new MethodCallRename('Gmagick', 'getimageinterlacescheme', 'getImageInterlaceScheme'),
|
||||
new MethodCallRename('Gmagick', 'getimageiterations', 'getImageIterations'),
|
||||
new MethodCallRename('Gmagick', 'getimagematte', 'getImageMatte'),
|
||||
new MethodCallRename('Gmagick', 'getimagemattecolor', 'getImageMatteColor'),
|
||||
new MethodCallRename('Gmagick', 'getimageprofile', 'getImageProfile'),
|
||||
new MethodCallRename('Gmagick', 'getimageredprimary', 'getImageRedPrimary'),
|
||||
new MethodCallRename('Gmagick', 'getimagerenderingintent', 'getImageRenderingIntent'),
|
||||
new MethodCallRename('Gmagick', 'getimageresolution', 'getImageResolution'),
|
||||
new MethodCallRename('Gmagick', 'getimagescene', 'getImageScene'),
|
||||
new MethodCallRename('Gmagick', 'getimagesignature', 'getImageSignature'),
|
||||
new MethodCallRename('Gmagick', 'getimagetype', 'getImageType'),
|
||||
new MethodCallRename('Gmagick', 'getimageunits', 'getImageUnits'),
|
||||
new MethodCallRename('Gmagick', 'getimagewhitepoint', 'getImageWhitePoint'),
|
||||
new MethodCallRename('Gmagick', 'getimagewidth', 'getImageWidth'),
|
||||
new MethodCallRename('Gmagick', 'getpackagename', 'getPackageName'),
|
||||
new MethodCallRename('Gmagick', 'getquantumdepth', 'getQuantumDepth'),
|
||||
new MethodCallRename('Gmagick', 'getreleasedate', 'getReleaseDate'),
|
||||
new MethodCallRename('Gmagick', 'getsamplingfactors', 'getSamplingFactors'),
|
||||
new MethodCallRename('Gmagick', 'getsize', 'getSize'),
|
||||
new MethodCallRename('Gmagick', 'getversion', 'getVersion'),
|
||||
new MethodCallRename('Gmagick', 'hasnextimage', 'hasNextImage'),
|
||||
new MethodCallRename('Gmagick', 'haspreviousimage', 'hasPreviousImage'),
|
||||
new MethodCallRename('Gmagick', 'implodeimage', 'implodeImage'),
|
||||
new MethodCallRename('Gmagick', 'labelimage', 'labelImage'),
|
||||
new MethodCallRename('Gmagick', 'levelimage', 'levelImage'),
|
||||
new MethodCallRename('Gmagick', 'magnifyimage', 'magnifyImage'),
|
||||
new MethodCallRename('Gmagick', 'mapimage', 'mapImage'),
|
||||
new MethodCallRename('Gmagick', 'medianfilterimage', 'medianFilterImage'),
|
||||
new MethodCallRename('Gmagick', 'minifyimage', 'minifyImage'),
|
||||
new MethodCallRename('Gmagick', 'modulateimage', 'modulateImage'),
|
||||
new MethodCallRename('Gmagick', 'motionblurimage', 'motionBlurImage'),
|
||||
new MethodCallRename('Gmagick', 'newimage', 'newImage'),
|
||||
new MethodCallRename('Gmagick', 'nextimage', 'nextImage'),
|
||||
new MethodCallRename('Gmagick', 'normalizeimage', 'normalizeImage'),
|
||||
new MethodCallRename('Gmagick', 'oilpaintimage', 'oilPaintImage'),
|
||||
new MethodCallRename('Gmagick', 'previousimage', 'previousImage'),
|
||||
new MethodCallRename('Gmagick', 'profileimage', 'profileImage'),
|
||||
new MethodCallRename('Gmagick', 'quantizeimage', 'quantizeImage'),
|
||||
new MethodCallRename('Gmagick', 'quantizeimages', 'quantizeImages'),
|
||||
new MethodCallRename('Gmagick', 'queryfontmetrics', 'queryFontMetrics'),
|
||||
new MethodCallRename('Gmagick', 'queryfonts', 'queryFonts'),
|
||||
new MethodCallRename('Gmagick', 'queryformats', 'queryFormats'),
|
||||
new MethodCallRename('Gmagick', 'radialblurimage', 'radialBlurImage'),
|
||||
new MethodCallRename('Gmagick', 'raiseimage', 'raiseImage'),
|
||||
new MethodCallRename('Gmagick', 'readimage', 'readimages'),
|
||||
new MethodCallRename('Gmagick', 'readimageblob', 'readImageBlob'),
|
||||
new MethodCallRename('Gmagick', 'readimagefile', 'readImageFile'),
|
||||
new MethodCallRename('Gmagick', 'reducenoiseimage', 'reduceNoiseImage'),
|
||||
new MethodCallRename('Gmagick', 'removeimage', 'removeImage'),
|
||||
new MethodCallRename('Gmagick', 'removeimageprofile', 'removeImageProfile'),
|
||||
new MethodCallRename('Gmagick', 'resampleimage', 'resampleImage'),
|
||||
new MethodCallRename('Gmagick', 'resizeimage', 'resizeImage'),
|
||||
new MethodCallRename('Gmagick', 'rollimage', 'rollImage'),
|
||||
new MethodCallRename('Gmagick', 'rotateimage', 'rotateImage'),
|
||||
new MethodCallRename('Gmagick', 'scaleimage', 'scaleImage'),
|
||||
new MethodCallRename('Gmagick', 'separateimagechannel', 'separateImageChannel'),
|
||||
new MethodCallRename('Gmagick', 'setCompressionQuality', 'getCompressionQuality'),
|
||||
new MethodCallRename('Gmagick', 'setfilename', 'setFilename'),
|
||||
new MethodCallRename('Gmagick', 'setimagebackgroundcolor', 'setImageBackgroundColor'),
|
||||
new MethodCallRename('Gmagick', 'setimageblueprimary', 'setImageBluePrimary'),
|
||||
new MethodCallRename('Gmagick', 'setimagebordercolor', 'setImageBorderColor'),
|
||||
new MethodCallRename('Gmagick', 'setimagechanneldepth', 'setImageChannelDepth'),
|
||||
new MethodCallRename('Gmagick', 'setimagecolorspace', 'setImageColorspace'),
|
||||
new MethodCallRename('Gmagick', 'setimagecompose', 'setImageCompose'),
|
||||
new MethodCallRename('Gmagick', 'setimagedelay', 'setImageDelay'),
|
||||
new MethodCallRename('Gmagick', 'setimagedepth', 'setImageDepth'),
|
||||
new MethodCallRename('Gmagick', 'setimagedispose', 'setImageDispose'),
|
||||
new MethodCallRename('Gmagick', 'setimagefilename', 'setImageFilename'),
|
||||
new MethodCallRename('Gmagick', 'setimageformat', 'setImageFormat'),
|
||||
new MethodCallRename('Gmagick', 'setimagegamma', 'setImageGamma'),
|
||||
new MethodCallRename('Gmagick', 'setimagegreenprimary', 'setImageGreenPrimary'),
|
||||
new MethodCallRename('Gmagick', 'setimageindex', 'setImageIndex'),
|
||||
new MethodCallRename('Gmagick', 'setimageinterlacescheme', 'setImageInterlaceScheme'),
|
||||
new MethodCallRename('Gmagick', 'setimageiterations', 'setImageIterations'),
|
||||
new MethodCallRename('Gmagick', 'setimageprofile', 'setImageProfile'),
|
||||
new MethodCallRename('Gmagick', 'setimageredprimary', 'setImageRedPrimary'),
|
||||
new MethodCallRename('Gmagick', 'setimagerenderingintent', 'setImageRenderingIntent'),
|
||||
new MethodCallRename('Gmagick', 'setimageresolution', 'setImageResolution'),
|
||||
new MethodCallRename('Gmagick', 'setimagescene', 'setImageScene'),
|
||||
new MethodCallRename('Gmagick', 'setimagetype', 'setImageType'),
|
||||
new MethodCallRename('Gmagick', 'setimageunits', 'setImageUnits'),
|
||||
new MethodCallRename('Gmagick', 'setimagewhitepoint', 'setImageWhitePoint'),
|
||||
new MethodCallRename('Gmagick', 'setsamplingfactors', 'setSamplingFactors'),
|
||||
new MethodCallRename('Gmagick', 'setsize', 'setSize'),
|
||||
new MethodCallRename('Gmagick', 'shearimage', 'shearImage'),
|
||||
new MethodCallRename('Gmagick', 'solarizeimage', 'solarizeImage'),
|
||||
new MethodCallRename('Gmagick', 'spreadimage', 'spreadImage'),
|
||||
new MethodCallRename('Gmagick', 'stripimage', 'stripImage'),
|
||||
new MethodCallRename('Gmagick', 'swirlimage', 'swirlImage'),
|
||||
new MethodCallRename('Gmagick', 'thumbnailimage', 'thumbnailImage'),
|
||||
new MethodCallRename('Gmagick', 'trimimage', 'trimImage'),
|
||||
new MethodCallRename('Gmagick', 'writeimage', 'writeImage'),
|
||||
new MethodCallRename('GmagickPixel', 'getcolor', 'getColor'),
|
||||
new MethodCallRename('GmagickPixel', 'getcolorcount', 'getColorCount'),
|
||||
new MethodCallRename('GmagickPixel', 'getcolorvalue', 'getColorValue'),
|
||||
new MethodCallRename('GmagickPixel', 'setcolor', 'setColor'),
|
||||
new MethodCallRename('GmagickPixel', 'setcolorvalue', 'setColorValue'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new MethodCallRename('Gmagick', 'addimage', 'addImage'),
|
||||
new MethodCallRename('Gmagick', 'addnoiseimage', 'addNoiseImage'),
|
||||
new MethodCallRename('Gmagick', 'annotateimage', 'annotateImage'),
|
||||
new MethodCallRename('Gmagick', 'blurimage', 'blurImage'),
|
||||
new MethodCallRename('Gmagick', 'borderimage', 'borderImage'),
|
||||
new MethodCallRename('Gmagick', 'charcoalimage', 'charcoalImage'),
|
||||
new MethodCallRename('Gmagick', 'chopimage', 'chopImage'),
|
||||
new MethodCallRename('Gmagick', 'commentimage', 'commentImage'),
|
||||
new MethodCallRename('Gmagick', 'compositeimage', 'compositeImage'),
|
||||
new MethodCallRename('Gmagick', 'cropimage', 'cropImage'),
|
||||
new MethodCallRename('Gmagick', 'cropthumbnailimage', 'cropThumbnailImage'),
|
||||
new MethodCallRename('Gmagick', 'cyclecolormapimage', 'cycleColormapImage'),
|
||||
new MethodCallRename('Gmagick', 'deconstructimages', 'deconstructImages'),
|
||||
new MethodCallRename('Gmagick', 'despeckleimage', 'despeckleImage'),
|
||||
new MethodCallRename('Gmagick', 'drawimage', 'drawImage'),
|
||||
new MethodCallRename('Gmagick', 'edgeimage', 'edgeImage'),
|
||||
new MethodCallRename('Gmagick', 'embossimage', 'embossImage'),
|
||||
new MethodCallRename('Gmagick', 'enhanceimage', 'enhanceImage'),
|
||||
new MethodCallRename('Gmagick', 'equalizeimage', 'equalizeImage'),
|
||||
new MethodCallRename('Gmagick', 'flipimage', 'flipImage'),
|
||||
new MethodCallRename('Gmagick', 'flopimage', 'flopImage'),
|
||||
new MethodCallRename('Gmagick', 'frameimage', 'frameImage'),
|
||||
new MethodCallRename('Gmagick', 'gammaimage', 'gammaImage'),
|
||||
new MethodCallRename('Gmagick', 'getcopyright', 'getCopyright'),
|
||||
new MethodCallRename('Gmagick', 'getfilename', 'getFilename'),
|
||||
new MethodCallRename('Gmagick', 'getimagebackgroundcolor', 'getImageBackgroundColor'),
|
||||
new MethodCallRename('Gmagick', 'getimageblueprimary', 'getImageBluePrimary'),
|
||||
new MethodCallRename('Gmagick', 'getimagebordercolor', 'getImageBorderColor'),
|
||||
new MethodCallRename('Gmagick', 'getimagechanneldepth', 'getImageChannelDepth'),
|
||||
new MethodCallRename('Gmagick', 'getimagecolors', 'getImageColors'),
|
||||
new MethodCallRename('Gmagick', 'getimagecolorspace', 'getImageColorspace'),
|
||||
new MethodCallRename('Gmagick', 'getimagecompose', 'getImageCompose'),
|
||||
new MethodCallRename('Gmagick', 'getimagedelay', 'getImageDelay'),
|
||||
new MethodCallRename('Gmagick', 'getimagedepth', 'getImageDepth'),
|
||||
new MethodCallRename('Gmagick', 'getimagedispose', 'getImageDispose'),
|
||||
new MethodCallRename('Gmagick', 'getimageextrema', 'getImageExtrema'),
|
||||
new MethodCallRename('Gmagick', 'getimagefilename', 'getImageFilename'),
|
||||
new MethodCallRename('Gmagick', 'getimageformat', 'getImageFormat'),
|
||||
new MethodCallRename('Gmagick', 'getimagegamma', 'getImageGamma'),
|
||||
new MethodCallRename('Gmagick', 'getimagegreenprimary', 'getImageGreenPrimary'),
|
||||
new MethodCallRename('Gmagick', 'getimageheight', 'getImageHeight'),
|
||||
new MethodCallRename('Gmagick', 'getimagehistogram', 'getImageHistogram'),
|
||||
new MethodCallRename('Gmagick', 'getimageindex', 'getImageIndex'),
|
||||
new MethodCallRename('Gmagick', 'getimageinterlacescheme', 'getImageInterlaceScheme'),
|
||||
new MethodCallRename('Gmagick', 'getimageiterations', 'getImageIterations'),
|
||||
new MethodCallRename('Gmagick', 'getimagematte', 'getImageMatte'),
|
||||
new MethodCallRename('Gmagick', 'getimagemattecolor', 'getImageMatteColor'),
|
||||
new MethodCallRename('Gmagick', 'getimageprofile', 'getImageProfile'),
|
||||
new MethodCallRename('Gmagick', 'getimageredprimary', 'getImageRedPrimary'),
|
||||
new MethodCallRename('Gmagick', 'getimagerenderingintent', 'getImageRenderingIntent'),
|
||||
new MethodCallRename('Gmagick', 'getimageresolution', 'getImageResolution'),
|
||||
new MethodCallRename('Gmagick', 'getimagescene', 'getImageScene'),
|
||||
new MethodCallRename('Gmagick', 'getimagesignature', 'getImageSignature'),
|
||||
new MethodCallRename('Gmagick', 'getimagetype', 'getImageType'),
|
||||
new MethodCallRename('Gmagick', 'getimageunits', 'getImageUnits'),
|
||||
new MethodCallRename('Gmagick', 'getimagewhitepoint', 'getImageWhitePoint'),
|
||||
new MethodCallRename('Gmagick', 'getimagewidth', 'getImageWidth'),
|
||||
new MethodCallRename('Gmagick', 'getpackagename', 'getPackageName'),
|
||||
new MethodCallRename('Gmagick', 'getquantumdepth', 'getQuantumDepth'),
|
||||
new MethodCallRename('Gmagick', 'getreleasedate', 'getReleaseDate'),
|
||||
new MethodCallRename('Gmagick', 'getsamplingfactors', 'getSamplingFactors'),
|
||||
new MethodCallRename('Gmagick', 'getsize', 'getSize'),
|
||||
new MethodCallRename('Gmagick', 'getversion', 'getVersion'),
|
||||
new MethodCallRename('Gmagick', 'hasnextimage', 'hasNextImage'),
|
||||
new MethodCallRename('Gmagick', 'haspreviousimage', 'hasPreviousImage'),
|
||||
new MethodCallRename('Gmagick', 'implodeimage', 'implodeImage'),
|
||||
new MethodCallRename('Gmagick', 'labelimage', 'labelImage'),
|
||||
new MethodCallRename('Gmagick', 'levelimage', 'levelImage'),
|
||||
new MethodCallRename('Gmagick', 'magnifyimage', 'magnifyImage'),
|
||||
new MethodCallRename('Gmagick', 'mapimage', 'mapImage'),
|
||||
new MethodCallRename('Gmagick', 'medianfilterimage', 'medianFilterImage'),
|
||||
new MethodCallRename('Gmagick', 'minifyimage', 'minifyImage'),
|
||||
new MethodCallRename('Gmagick', 'modulateimage', 'modulateImage'),
|
||||
new MethodCallRename('Gmagick', 'motionblurimage', 'motionBlurImage'),
|
||||
new MethodCallRename('Gmagick', 'newimage', 'newImage'),
|
||||
new MethodCallRename('Gmagick', 'nextimage', 'nextImage'),
|
||||
new MethodCallRename('Gmagick', 'normalizeimage', 'normalizeImage'),
|
||||
new MethodCallRename('Gmagick', 'oilpaintimage', 'oilPaintImage'),
|
||||
new MethodCallRename('Gmagick', 'previousimage', 'previousImage'),
|
||||
new MethodCallRename('Gmagick', 'profileimage', 'profileImage'),
|
||||
new MethodCallRename('Gmagick', 'quantizeimage', 'quantizeImage'),
|
||||
new MethodCallRename('Gmagick', 'quantizeimages', 'quantizeImages'),
|
||||
new MethodCallRename('Gmagick', 'queryfontmetrics', 'queryFontMetrics'),
|
||||
new MethodCallRename('Gmagick', 'queryfonts', 'queryFonts'),
|
||||
new MethodCallRename('Gmagick', 'queryformats', 'queryFormats'),
|
||||
new MethodCallRename('Gmagick', 'radialblurimage', 'radialBlurImage'),
|
||||
new MethodCallRename('Gmagick', 'raiseimage', 'raiseImage'),
|
||||
new MethodCallRename('Gmagick', 'readimage', 'readimages'),
|
||||
new MethodCallRename('Gmagick', 'readimageblob', 'readImageBlob'),
|
||||
new MethodCallRename('Gmagick', 'readimagefile', 'readImageFile'),
|
||||
new MethodCallRename('Gmagick', 'reducenoiseimage', 'reduceNoiseImage'),
|
||||
new MethodCallRename('Gmagick', 'removeimage', 'removeImage'),
|
||||
new MethodCallRename('Gmagick', 'removeimageprofile', 'removeImageProfile'),
|
||||
new MethodCallRename('Gmagick', 'resampleimage', 'resampleImage'),
|
||||
new MethodCallRename('Gmagick', 'resizeimage', 'resizeImage'),
|
||||
new MethodCallRename('Gmagick', 'rollimage', 'rollImage'),
|
||||
new MethodCallRename('Gmagick', 'rotateimage', 'rotateImage'),
|
||||
new MethodCallRename('Gmagick', 'scaleimage', 'scaleImage'),
|
||||
new MethodCallRename('Gmagick', 'separateimagechannel', 'separateImageChannel'),
|
||||
new MethodCallRename('Gmagick', 'setCompressionQuality', 'getCompressionQuality'),
|
||||
new MethodCallRename('Gmagick', 'setfilename', 'setFilename'),
|
||||
new MethodCallRename('Gmagick', 'setimagebackgroundcolor', 'setImageBackgroundColor'),
|
||||
new MethodCallRename('Gmagick', 'setimageblueprimary', 'setImageBluePrimary'),
|
||||
new MethodCallRename('Gmagick', 'setimagebordercolor', 'setImageBorderColor'),
|
||||
new MethodCallRename('Gmagick', 'setimagechanneldepth', 'setImageChannelDepth'),
|
||||
new MethodCallRename('Gmagick', 'setimagecolorspace', 'setImageColorspace'),
|
||||
new MethodCallRename('Gmagick', 'setimagecompose', 'setImageCompose'),
|
||||
new MethodCallRename('Gmagick', 'setimagedelay', 'setImageDelay'),
|
||||
new MethodCallRename('Gmagick', 'setimagedepth', 'setImageDepth'),
|
||||
new MethodCallRename('Gmagick', 'setimagedispose', 'setImageDispose'),
|
||||
new MethodCallRename('Gmagick', 'setimagefilename', 'setImageFilename'),
|
||||
new MethodCallRename('Gmagick', 'setimageformat', 'setImageFormat'),
|
||||
new MethodCallRename('Gmagick', 'setimagegamma', 'setImageGamma'),
|
||||
new MethodCallRename('Gmagick', 'setimagegreenprimary', 'setImageGreenPrimary'),
|
||||
new MethodCallRename('Gmagick', 'setimageindex', 'setImageIndex'),
|
||||
new MethodCallRename('Gmagick', 'setimageinterlacescheme', 'setImageInterlaceScheme'),
|
||||
new MethodCallRename('Gmagick', 'setimageiterations', 'setImageIterations'),
|
||||
new MethodCallRename('Gmagick', 'setimageprofile', 'setImageProfile'),
|
||||
new MethodCallRename('Gmagick', 'setimageredprimary', 'setImageRedPrimary'),
|
||||
new MethodCallRename('Gmagick', 'setimagerenderingintent', 'setImageRenderingIntent'),
|
||||
new MethodCallRename('Gmagick', 'setimageresolution', 'setImageResolution'),
|
||||
new MethodCallRename('Gmagick', 'setimagescene', 'setImageScene'),
|
||||
new MethodCallRename('Gmagick', 'setimagetype', 'setImageType'),
|
||||
new MethodCallRename('Gmagick', 'setimageunits', 'setImageUnits'),
|
||||
new MethodCallRename('Gmagick', 'setimagewhitepoint', 'setImageWhitePoint'),
|
||||
new MethodCallRename('Gmagick', 'setsamplingfactors', 'setSamplingFactors'),
|
||||
new MethodCallRename('Gmagick', 'setsize', 'setSize'),
|
||||
new MethodCallRename('Gmagick', 'shearimage', 'shearImage'),
|
||||
new MethodCallRename('Gmagick', 'solarizeimage', 'solarizeImage'),
|
||||
new MethodCallRename('Gmagick', 'spreadimage', 'spreadImage'),
|
||||
new MethodCallRename('Gmagick', 'stripimage', 'stripImage'),
|
||||
new MethodCallRename('Gmagick', 'swirlimage', 'swirlImage'),
|
||||
new MethodCallRename('Gmagick', 'thumbnailimage', 'thumbnailImage'),
|
||||
new MethodCallRename('Gmagick', 'trimimage', 'trimImage'),
|
||||
new MethodCallRename('Gmagick', 'writeimage', 'writeImage'),
|
||||
new MethodCallRename('GmagickPixel', 'getcolor', 'getColor'),
|
||||
new MethodCallRename('GmagickPixel', 'getcolorcount', 'getColorCount'),
|
||||
new MethodCallRename('GmagickPixel', 'getcolorvalue', 'getColorValue'),
|
||||
new MethodCallRename('GmagickPixel', 'setcolor', 'setColor'),
|
||||
new MethodCallRename('GmagickPixel', 'setcolorvalue', 'setColorValue'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@ use Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
|||
use Rector\Transform\ValueObject\FuncCallToMethodCall;
|
||||
use Rector\Transform\ValueObject\StaticCallToFuncCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
@ -20,22 +19,16 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
];
|
||||
|
||||
$services->set(FuncCallToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
FuncCallToMethodCallRector::FUNC_CALL_TO_CLASS_METHOD_CALL => ValueObjectInliner::inline($configuration),
|
||||
]]);
|
||||
->configure($configuration);
|
||||
|
||||
$services->set(StaticCallToFuncCallRector::class)
|
||||
->call('configure', [[
|
||||
StaticCallToFuncCallRector::STATIC_CALLS_TO_FUNCTIONS => ValueObjectInliner::inline([
|
||||
new StaticCallToFuncCall('GuzzleHttp\Utils', 'setPath', 'GuzzleHttp\set_path'),
|
||||
new StaticCallToFuncCall('GuzzleHttp\Pool', 'batch', 'GuzzleHttp\Pool\batch'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new StaticCallToFuncCall('GuzzleHttp\Utils', 'setPath', 'GuzzleHttp\set_path'),
|
||||
new StaticCallToFuncCall('GuzzleHttp\Pool', 'batch', 'GuzzleHttp\Pool\batch'),
|
||||
]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('GuzzleHttp\Message\MessageInterface', 'getHeaderLines', 'getHeaderAsArray'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new MethodCallRename('GuzzleHttp\Message\MessageInterface', 'getHeaderLines', 'getHeaderAsArray'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,26 +5,23 @@ declare(strict_types=1);
|
|||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://github.com/Seldaek/monolog/commit/39f8a20e6dadc0194e846b254c5f23d1c732290b#diff-dce565f403e044caa5e6a0d988339430
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Monolog\Logger', 'addDebug', 'debug'),
|
||||
new MethodCallRename('Monolog\Logger', 'addInfo', 'info'),
|
||||
new MethodCallRename('Monolog\Logger', 'addNotice', 'notice'),
|
||||
new MethodCallRename('Monolog\Logger', 'addWarning', 'warning'),
|
||||
new MethodCallRename('Monolog\Logger', 'addError', 'error'),
|
||||
new MethodCallRename('Monolog\Logger', 'addCritical', 'critical'),
|
||||
new MethodCallRename('Monolog\Logger', 'addAlert', 'alert'),
|
||||
new MethodCallRename('Monolog\Logger', 'addEmergency', 'emergency'),
|
||||
new MethodCallRename('Monolog\Logger', 'warn', 'warning'),
|
||||
new MethodCallRename('Monolog\Logger', 'err', 'error'),
|
||||
new MethodCallRename('Monolog\Logger', 'crit', 'critical'),
|
||||
new MethodCallRename('Monolog\Logger', 'emerg', 'emergency'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new MethodCallRename('Monolog\Logger', 'addDebug', 'debug'),
|
||||
new MethodCallRename('Monolog\Logger', 'addInfo', 'info'),
|
||||
new MethodCallRename('Monolog\Logger', 'addNotice', 'notice'),
|
||||
new MethodCallRename('Monolog\Logger', 'addWarning', 'warning'),
|
||||
new MethodCallRename('Monolog\Logger', 'addError', 'error'),
|
||||
new MethodCallRename('Monolog\Logger', 'addCritical', 'critical'),
|
||||
new MethodCallRename('Monolog\Logger', 'addAlert', 'alert'),
|
||||
new MethodCallRename('Monolog\Logger', 'addEmergency', 'emergency'),
|
||||
new MethodCallRename('Monolog\Logger', 'warn', 'warning'),
|
||||
new MethodCallRename('Monolog\Logger', 'err', 'error'),
|
||||
new MethodCallRename('Monolog\Logger', 'crit', 'critical'),
|
||||
new MethodCallRename('Monolog\Logger', 'emerg', 'emergency'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -13,7 +13,6 @@ use Rector\Removing\ValueObject\RemoveFuncCallArg;
|
|||
use Rector\Renaming\Rector\ConstFetch\RenameConstantRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
@ -26,61 +25,53 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(MysqlFuncCallToMysqliRector::class);
|
||||
|
||||
$services->set(RemoveFuncCallArgRector::class)
|
||||
->call('configure', [[
|
||||
RemoveFuncCallArgRector::REMOVED_FUNCTION_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new RemoveFuncCallArg('mysql_pconnect', 3),
|
||||
new RemoveFuncCallArg('mysql_connect', 3),
|
||||
new RemoveFuncCallArg('mysql_connect', 4),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new RemoveFuncCallArg('mysql_pconnect', 3),
|
||||
new RemoveFuncCallArg('mysql_connect', 3),
|
||||
new RemoveFuncCallArg('mysql_connect', 4),
|
||||
]);
|
||||
|
||||
$services->set(MysqlPConnectToMysqliConnectRector::class);
|
||||
|
||||
# first swap arguments, then rename
|
||||
$services->set(SwapFuncCallArgumentsRector::class)
|
||||
->call('configure', [[
|
||||
SwapFuncCallArgumentsRector::FUNCTION_ARGUMENT_SWAPS => ValueObjectInliner::inline([
|
||||
new SwapFuncCallArguments('mysql_query', [1, 0]),
|
||||
new SwapFuncCallArguments('mysql_real_escape_string', [1, 0]),
|
||||
new SwapFuncCallArguments('mysql_select_db', [1, 0]),
|
||||
new SwapFuncCallArguments('mysql_set_charset', [1, 0]),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new SwapFuncCallArguments('mysql_query', [1, 0]),
|
||||
new SwapFuncCallArguments('mysql_real_escape_string', [1, 0]),
|
||||
new SwapFuncCallArguments('mysql_select_db', [1, 0]),
|
||||
new SwapFuncCallArguments('mysql_set_charset', [1, 0]),
|
||||
]);
|
||||
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'mysql_connect' => 'mysqli_connect',
|
||||
'mysql_data_seek' => 'mysqli_data_seek',
|
||||
'mysql_fetch_array' => 'mysqli_fetch_array',
|
||||
'mysql_fetch_assoc' => 'mysqli_fetch_assoc',
|
||||
'mysql_fetch_lengths' => 'mysqli_fetch_lengths',
|
||||
'mysql_fetch_object' => 'mysqli_fetch_object',
|
||||
'mysql_fetch_row' => 'mysqli_fetch_row',
|
||||
'mysql_field_seek' => 'mysqli_field_seek',
|
||||
'mysql_free_result' => 'mysqli_free_result',
|
||||
'mysql_get_client_info' => 'mysqli_get_client_info',
|
||||
'mysql_num_fields' => 'mysqli_num_fields',
|
||||
'mysql_numfields' => 'mysqli_num_fields',
|
||||
'mysql_num_rows' => 'mysqli_num_rows',
|
||||
'mysql_numrows' => 'mysqli_num_rows',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'mysql_connect' => 'mysqli_connect',
|
||||
'mysql_data_seek' => 'mysqli_data_seek',
|
||||
'mysql_fetch_array' => 'mysqli_fetch_array',
|
||||
'mysql_fetch_assoc' => 'mysqli_fetch_assoc',
|
||||
'mysql_fetch_lengths' => 'mysqli_fetch_lengths',
|
||||
'mysql_fetch_object' => 'mysqli_fetch_object',
|
||||
'mysql_fetch_row' => 'mysqli_fetch_row',
|
||||
'mysql_field_seek' => 'mysqli_field_seek',
|
||||
'mysql_free_result' => 'mysqli_free_result',
|
||||
'mysql_get_client_info' => 'mysqli_get_client_info',
|
||||
'mysql_num_fields' => 'mysqli_num_fields',
|
||||
'mysql_numfields' => 'mysqli_num_fields',
|
||||
'mysql_num_rows' => 'mysqli_num_rows',
|
||||
'mysql_numrows' => 'mysqli_num_rows',
|
||||
]);
|
||||
|
||||
# http://php.net/manual/en/mysql.constants.php → http://php.net/manual/en/mysqli.constants.php
|
||||
$services->set(RenameConstantRector::class)
|
||||
->call('configure', [[
|
||||
RenameConstantRector::OLD_TO_NEW_CONSTANTS => [
|
||||
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
|
||||
'MYSQL_BOTH' => 'MYSQLI_BOTH',
|
||||
'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS',
|
||||
'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE',
|
||||
'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE',
|
||||
'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL',
|
||||
'MYSQL_NUM' => 'MYSQLI_NUM',
|
||||
'MYSQL_PRIMARY_KEY_FLAG' => 'MYSQLI_PRI_KEY_FLAG',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
|
||||
'MYSQL_BOTH' => 'MYSQLI_BOTH',
|
||||
'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS',
|
||||
'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE',
|
||||
'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE',
|
||||
'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL',
|
||||
'MYSQL_NUM' => 'MYSQLI_NUM',
|
||||
'MYSQL_PRIMARY_KEY_FLAG' => 'MYSQLI_PRI_KEY_FLAG',
|
||||
]);
|
||||
|
||||
$services->set(MysqlQueryMysqlErrorWithLinkRector::class);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@ use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
|||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://docs.phalcon.io/4.0/en/upgrade#general-notes
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
|
@ -15,113 +14,107 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
# for class renames is better - https://docs.phalcon.io/4.0/en/upgrade#cheat-sheet
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'Phalcon\Acl\Adapter' => 'Phalcon\Acl\Adapter\AbstractAdapter',
|
||||
'Phalcon\Acl\Resource' => 'Phalcon\Acl\Component',
|
||||
'Phalcon\Acl\ResourceInterface' => 'Phalcon\Acl\ComponentInterface',
|
||||
'Phalcon\Acl\ResourceAware' => 'Phalcon\Acl\ComponentAware',
|
||||
'Phalcon\Assets\ResourceInterface' => 'Phalcon\Assets\AssetInterface',
|
||||
'Phalcon\Validation\MessageInterface' => 'Phalcon\Messages\MessageInterface',
|
||||
'Phalcon\Mvc\Model\MessageInterface' => 'Phalcon\Messages\MessageInterface',
|
||||
'Phalcon\Annotations\Adapter' => 'Phalcon\Annotations\Adapter\AbstractAdapter',
|
||||
'Phalcon\Annotations\Factory' => 'Phalcon\Annotations\AnnotationsFactory',
|
||||
'Phalcon\Application' => 'Phalcon\Application\AbstractApplication',
|
||||
'Phalcon\Assets\Resource' => 'Phalcon\Assets\Asset',
|
||||
'Phalcon\Assets\Resource\Css' => 'Phalcon\Assets\Asset\Css',
|
||||
'Phalcon\Assets\Resource\Js' => 'Phalcon\Assets\Asset\Js',
|
||||
'Phalcon\Cache\Backend' => 'Phalcon\Cache',
|
||||
'Phalcon\Cache\Backend\Factory' => 'Phalcon\Cache\AdapterFactory',
|
||||
'Phalcon\Cache\Backend\Apcu' => 'Phalcon\Cache\Adapter\Apcu',
|
||||
'Phalcon\Cache\Backend\File' => 'Phalcon\Cache\Adapter\Stream',
|
||||
'Phalcon\Cache\Backend\Libmemcached' => 'Phalcon\Cache\Adapter\Libmemcached',
|
||||
'Phalcon\Cache\Backend\Memory' => 'Phalcon\Cache\Adapter\Memory',
|
||||
'Phalcon\Cache\Backend\Redis' => 'Phalcon\Cache\Adapter\Redis',
|
||||
'Phalcon\Cache\Exception' => 'Phalcon\Cache\Exception\Exception',
|
||||
'Phalcon\Config\Factory' => 'Phalcon\Config\ConfigFactory',
|
||||
'Phalcon\Db' => 'Phalcon\Db\AbstractDb',
|
||||
'Phalcon\Db\Adapter' => 'Phalcon\Db\Adapter\AbstractAdapter',
|
||||
'Phalcon\Db\Adapter\Pdo' => 'Phalcon\Db\Adapter\Pdo\AbstractPdo',
|
||||
'Phalcon\Db\Adapter\Pdo\Factory' => 'Phalcon\Db\Adapter\PdoFactory',
|
||||
'Phalcon\Dispatcher' => 'Phalcon\Dispatcher\AbstractDispatcher',
|
||||
'Phalcon\Factory' => 'Phalcon\Factory\AbstractFactory',
|
||||
'Phalcon\Flash' => 'Phalcon\Flash\AbstractFlash',
|
||||
'Phalcon\Forms\Element' => 'Phalcon\Forms\Element\AbstractElement',
|
||||
'Phalcon\Image\Adapter' => 'Phalcon\Image\Adapter\AbstractAdapter',
|
||||
'Phalcon\Image\Factory' => 'Phalcon\Image\ImageFactory',
|
||||
'Phalcon\Logger\Adapter' => 'Phalcon\Logger\Adapter\AbstractAdapter',
|
||||
'Phalcon\Logger\Adapter\Blackhole' => 'Phalcon\Logger\Adapter\Noop',
|
||||
'Phalcon\Logger\Adapter\File' => 'Phalcon\Logger\Adapter\Stream',
|
||||
'Phalcon\Logger\Factory' => 'Phalcon\Logger\LoggerFactory',
|
||||
'Phalcon\Logger\Formatter' => 'Phalcon\Logger\Formatter\AbstractFormatter',
|
||||
'Phalcon\Mvc\Collection' => 'Phalcon\Collection',
|
||||
'Phalcon\Mvc\Collection\Exception' => 'Phalcon\Collection\Exception',
|
||||
'Phalcon\Mvc\Model\Message' => 'Phalcon\Messages\Message',
|
||||
'Phalcon\Mvc\Model\MetaData\Files' => 'Phalcon\Mvc\Model\MetaData\Stream',
|
||||
'Phalcon\Mvc\Model\Validator' => 'Phalcon\Validation\Validator',
|
||||
'Phalcon\Mvc\Model\Validator\Email' => 'Phalcon\Validation\Validator\Email',
|
||||
'Phalcon\Mvc\Model\Validator\Exclusionin' => 'Phalcon\Validation\Validator\ExclusionIn',
|
||||
'Phalcon\Mvc\Model\Validator\Inclusionin' => 'Phalcon\Validation\Validator\InclusionIn',
|
||||
'Phalcon\Mvc\Model\Validator\Ip' => 'Phalcon\Validation\Validator\Ip',
|
||||
'Phalcon\Mvc\Model\Validator\Numericality' => 'Phalcon\Validation\Validator\Numericality',
|
||||
'Phalcon\Mvc\Model\Validator\PresenceOf' => 'Phalcon\Validation\Validator\PresenceOf',
|
||||
'Phalcon\Mvc\Model\Validator\Regex' => 'Phalcon\Validation\Validator\Regex',
|
||||
'Phalcon\Mvc\Model\Validator\StringLength' => 'Phalcon\Validation\Validator\StringLength',
|
||||
'Phalcon\Mvc\Model\Validator\Uniqueness' => 'Phalcon\Validation\Validator\Uniqueness',
|
||||
'Phalcon\Mvc\Model\Validator\Url' => 'Phalcon\Validation\Validator\Url',
|
||||
'Phalcon\Mvc\Url' => 'Phalcon\Url',
|
||||
'Phalcon\Mvc\Url\Exception' => 'Phalcon\Url\Exception',
|
||||
'Phalcon\Mvc\User\Component' => 'Phalcon\Di\Injectable',
|
||||
'Phalcon\Mvc\User\Module' => 'Phalcon\Di\Injectable',
|
||||
'Phalcon\Mvc\User\Plugin' => 'Phalcon\Di\Injectable',
|
||||
'Phalcon\Mvc\View\Engine' => 'Phalcon\Mvc\View\Engine\AbstractEngine',
|
||||
'Phalcon\Paginator\Adapter' => 'Phalcon\Paginator\Adapter\AbstractAdapter',
|
||||
'Phalcon\Paginator\Factory' => 'Phalcon\Paginator\PaginatorFactory',
|
||||
'Phalcon\Session\Adapter' => 'Phalcon\Session\Adapter\AbstractAdapter',
|
||||
'Phalcon\Session\Adapter\Files' => 'Phalcon\Session\Adapter\Stream',
|
||||
'Phalcon\Session\Factory' => 'Phalcon\Session\Manager',
|
||||
'Phalcon\Translate\Adapter' => 'Phalcon\Translate\Adapter\AbstractAdapter',
|
||||
'Phalcon\Translate\Factory' => 'Phalcon\Translate\TranslateFactory',
|
||||
'Phalcon\Validation\CombinedFieldsValidator' => 'Phalcon\Validation\AbstractCombinedFieldsValidator',
|
||||
'Phalcon\Validation\Message' => 'Phalcon\Messages\Message',
|
||||
'Phalcon\Validation\Message\Group' => 'Phalcon\Messages\Messages',
|
||||
'Phalcon\Validation\Validator' => 'Phalcon\Validation\AbstractValidator',
|
||||
'Phalcon\Text' => 'Phalcon\Helper\Str',
|
||||
'Phalcon\Session\AdapterInterface' => 'SessionHandlerInterface',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'Phalcon\Acl\Adapter' => 'Phalcon\Acl\Adapter\AbstractAdapter',
|
||||
'Phalcon\Acl\Resource' => 'Phalcon\Acl\Component',
|
||||
'Phalcon\Acl\ResourceInterface' => 'Phalcon\Acl\ComponentInterface',
|
||||
'Phalcon\Acl\ResourceAware' => 'Phalcon\Acl\ComponentAware',
|
||||
'Phalcon\Assets\ResourceInterface' => 'Phalcon\Assets\AssetInterface',
|
||||
'Phalcon\Validation\MessageInterface' => 'Phalcon\Messages\MessageInterface',
|
||||
'Phalcon\Mvc\Model\MessageInterface' => 'Phalcon\Messages\MessageInterface',
|
||||
'Phalcon\Annotations\Adapter' => 'Phalcon\Annotations\Adapter\AbstractAdapter',
|
||||
'Phalcon\Annotations\Factory' => 'Phalcon\Annotations\AnnotationsFactory',
|
||||
'Phalcon\Application' => 'Phalcon\Application\AbstractApplication',
|
||||
'Phalcon\Assets\Resource' => 'Phalcon\Assets\Asset',
|
||||
'Phalcon\Assets\Resource\Css' => 'Phalcon\Assets\Asset\Css',
|
||||
'Phalcon\Assets\Resource\Js' => 'Phalcon\Assets\Asset\Js',
|
||||
'Phalcon\Cache\Backend' => 'Phalcon\Cache',
|
||||
'Phalcon\Cache\Backend\Factory' => 'Phalcon\Cache\AdapterFactory',
|
||||
'Phalcon\Cache\Backend\Apcu' => 'Phalcon\Cache\Adapter\Apcu',
|
||||
'Phalcon\Cache\Backend\File' => 'Phalcon\Cache\Adapter\Stream',
|
||||
'Phalcon\Cache\Backend\Libmemcached' => 'Phalcon\Cache\Adapter\Libmemcached',
|
||||
'Phalcon\Cache\Backend\Memory' => 'Phalcon\Cache\Adapter\Memory',
|
||||
'Phalcon\Cache\Backend\Redis' => 'Phalcon\Cache\Adapter\Redis',
|
||||
'Phalcon\Cache\Exception' => 'Phalcon\Cache\Exception\Exception',
|
||||
'Phalcon\Config\Factory' => 'Phalcon\Config\ConfigFactory',
|
||||
'Phalcon\Db' => 'Phalcon\Db\AbstractDb',
|
||||
'Phalcon\Db\Adapter' => 'Phalcon\Db\Adapter\AbstractAdapter',
|
||||
'Phalcon\Db\Adapter\Pdo' => 'Phalcon\Db\Adapter\Pdo\AbstractPdo',
|
||||
'Phalcon\Db\Adapter\Pdo\Factory' => 'Phalcon\Db\Adapter\PdoFactory',
|
||||
'Phalcon\Dispatcher' => 'Phalcon\Dispatcher\AbstractDispatcher',
|
||||
'Phalcon\Factory' => 'Phalcon\Factory\AbstractFactory',
|
||||
'Phalcon\Flash' => 'Phalcon\Flash\AbstractFlash',
|
||||
'Phalcon\Forms\Element' => 'Phalcon\Forms\Element\AbstractElement',
|
||||
'Phalcon\Image\Adapter' => 'Phalcon\Image\Adapter\AbstractAdapter',
|
||||
'Phalcon\Image\Factory' => 'Phalcon\Image\ImageFactory',
|
||||
'Phalcon\Logger\Adapter' => 'Phalcon\Logger\Adapter\AbstractAdapter',
|
||||
'Phalcon\Logger\Adapter\Blackhole' => 'Phalcon\Logger\Adapter\Noop',
|
||||
'Phalcon\Logger\Adapter\File' => 'Phalcon\Logger\Adapter\Stream',
|
||||
'Phalcon\Logger\Factory' => 'Phalcon\Logger\LoggerFactory',
|
||||
'Phalcon\Logger\Formatter' => 'Phalcon\Logger\Formatter\AbstractFormatter',
|
||||
'Phalcon\Mvc\Collection' => 'Phalcon\Collection',
|
||||
'Phalcon\Mvc\Collection\Exception' => 'Phalcon\Collection\Exception',
|
||||
'Phalcon\Mvc\Model\Message' => 'Phalcon\Messages\Message',
|
||||
'Phalcon\Mvc\Model\MetaData\Files' => 'Phalcon\Mvc\Model\MetaData\Stream',
|
||||
'Phalcon\Mvc\Model\Validator' => 'Phalcon\Validation\Validator',
|
||||
'Phalcon\Mvc\Model\Validator\Email' => 'Phalcon\Validation\Validator\Email',
|
||||
'Phalcon\Mvc\Model\Validator\Exclusionin' => 'Phalcon\Validation\Validator\ExclusionIn',
|
||||
'Phalcon\Mvc\Model\Validator\Inclusionin' => 'Phalcon\Validation\Validator\InclusionIn',
|
||||
'Phalcon\Mvc\Model\Validator\Ip' => 'Phalcon\Validation\Validator\Ip',
|
||||
'Phalcon\Mvc\Model\Validator\Numericality' => 'Phalcon\Validation\Validator\Numericality',
|
||||
'Phalcon\Mvc\Model\Validator\PresenceOf' => 'Phalcon\Validation\Validator\PresenceOf',
|
||||
'Phalcon\Mvc\Model\Validator\Regex' => 'Phalcon\Validation\Validator\Regex',
|
||||
'Phalcon\Mvc\Model\Validator\StringLength' => 'Phalcon\Validation\Validator\StringLength',
|
||||
'Phalcon\Mvc\Model\Validator\Uniqueness' => 'Phalcon\Validation\Validator\Uniqueness',
|
||||
'Phalcon\Mvc\Model\Validator\Url' => 'Phalcon\Validation\Validator\Url',
|
||||
'Phalcon\Mvc\Url' => 'Phalcon\Url',
|
||||
'Phalcon\Mvc\Url\Exception' => 'Phalcon\Url\Exception',
|
||||
'Phalcon\Mvc\User\Component' => 'Phalcon\Di\Injectable',
|
||||
'Phalcon\Mvc\User\Module' => 'Phalcon\Di\Injectable',
|
||||
'Phalcon\Mvc\User\Plugin' => 'Phalcon\Di\Injectable',
|
||||
'Phalcon\Mvc\View\Engine' => 'Phalcon\Mvc\View\Engine\AbstractEngine',
|
||||
'Phalcon\Paginator\Adapter' => 'Phalcon\Paginator\Adapter\AbstractAdapter',
|
||||
'Phalcon\Paginator\Factory' => 'Phalcon\Paginator\PaginatorFactory',
|
||||
'Phalcon\Session\Adapter' => 'Phalcon\Session\Adapter\AbstractAdapter',
|
||||
'Phalcon\Session\Adapter\Files' => 'Phalcon\Session\Adapter\Stream',
|
||||
'Phalcon\Session\Factory' => 'Phalcon\Session\Manager',
|
||||
'Phalcon\Translate\Adapter' => 'Phalcon\Translate\Adapter\AbstractAdapter',
|
||||
'Phalcon\Translate\Factory' => 'Phalcon\Translate\TranslateFactory',
|
||||
'Phalcon\Validation\CombinedFieldsValidator' => 'Phalcon\Validation\AbstractCombinedFieldsValidator',
|
||||
'Phalcon\Validation\Message' => 'Phalcon\Messages\Message',
|
||||
'Phalcon\Validation\Message\Group' => 'Phalcon\Messages\Messages',
|
||||
'Phalcon\Validation\Validator' => 'Phalcon\Validation\AbstractValidator',
|
||||
'Phalcon\Text' => 'Phalcon\Helper\Str',
|
||||
'Phalcon\Session\AdapterInterface' => 'SessionHandlerInterface',
|
||||
]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'isResource', 'isComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'addResource', 'addComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'addResourceAccess', 'addComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'dropResourceAccess', 'dropComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'getActiveResource', 'getActiveComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'getResources', 'getComponents'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'isResource', 'isComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'addResource', 'addComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'addResourceAccess', 'addComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'dropResourceAccess', 'dropComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'getResources', 'getComponents'),
|
||||
new MethodCallRename('Phalcon\Cli\Console', 'addModules', 'registerModules'),
|
||||
new MethodCallRename('Phalcon\Dispatcher', 'setModelBinding', 'setModelBinder'),
|
||||
new MethodCallRename('Phalcon\Assets\Manager', 'addResource', 'addAsset'),
|
||||
new MethodCallRename('Phalcon\Assets\Manager', 'addResourceByType', 'addAssetByType'),
|
||||
new MethodCallRename('Phalcon\Assets\Manager', 'collectionResourcesByType', 'collectionAssetsByType'),
|
||||
new MethodCallRename('Phalcon\Http\RequestInterface', 'isSecureRequest', 'isSecure'),
|
||||
new MethodCallRename('Phalcon\Http\RequestInterface', 'isSoapRequested', 'isSoap'),
|
||||
new MethodCallRename('Phalcon\Paginator', 'getPaginate', 'paginate'),
|
||||
new MethodCallRename('Phalcon\Mvc\Model\Criteria', 'order', 'orderBy'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'isResource', 'isComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'addResource', 'addComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'addResourceAccess', 'addComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'dropResourceAccess', 'dropComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'getActiveResource', 'getActiveComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\AdapterInterface', 'getResources', 'getComponents'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'isResource', 'isComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'addResource', 'addComponent'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'addResourceAccess', 'addComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'dropResourceAccess', 'dropComponentAccess'),
|
||||
new MethodCallRename('Phalcon\Acl\Adapter\Memory', 'getResources', 'getComponents'),
|
||||
new MethodCallRename('Phalcon\Cli\Console', 'addModules', 'registerModules'),
|
||||
new MethodCallRename('Phalcon\Dispatcher', 'setModelBinding', 'setModelBinder'),
|
||||
new MethodCallRename('Phalcon\Assets\Manager', 'addResource', 'addAsset'),
|
||||
new MethodCallRename('Phalcon\Assets\Manager', 'addResourceByType', 'addAssetByType'),
|
||||
new MethodCallRename('Phalcon\Assets\Manager', 'collectionResourcesByType', 'collectionAssetsByType'),
|
||||
new MethodCallRename('Phalcon\Http\RequestInterface', 'isSecureRequest', 'isSecure'),
|
||||
new MethodCallRename('Phalcon\Http\RequestInterface', 'isSoapRequested', 'isSoap'),
|
||||
new MethodCallRename('Phalcon\Paginator', 'getPaginate', 'paginate'),
|
||||
new MethodCallRename('Phalcon\Mvc\Model\Criteria', 'order', 'orderBy'),
|
||||
]);
|
||||
|
||||
$services->set(RenameConstantRector::class)
|
||||
->call('configure', [[
|
||||
RenameConstantRector::OLD_TO_NEW_CONSTANTS => [
|
||||
'FILTER_SPECIAL_CHARS' => 'FILTER_SPECIAL',
|
||||
'FILTER_ALPHANUM' => 'FILTER_ALNUM',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'FILTER_SPECIAL_CHARS' => 'FILTER_SPECIAL',
|
||||
'FILTER_ALPHANUM' => 'FILTER_ALNUM',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@ use Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;
|
|||
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
|
||||
use Rector\Removing\ValueObject\RemoveFuncCallArg;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
@ -15,10 +14,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(ContinueToBreakInSwitchRector::class);
|
||||
|
||||
$services->set(RemoveFuncCallArgRector::class)
|
||||
->call('configure', [[
|
||||
RemoveFuncCallArgRector::REMOVED_FUNCTION_ARGUMENTS => ValueObjectInliner::inline([
|
||||
// see https://www.php.net/manual/en/function.ldap-first-attribute.php
|
||||
new RemoveFuncCallArg('ldap_first_attribute', 2),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
// see https://www.php.net/manual/en/function.ldap-first-attribute.php
|
||||
new RemoveFuncCallArg('ldap_first_attribute', 2),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -10,11 +10,9 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'mysqli_param_count' => 'mysqli_stmt_param_count',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'mysqli_param_count' => 'mysqli_stmt_param_count',
|
||||
]);
|
||||
|
||||
$services->set(RemoveReferenceFromCallRector::class);
|
||||
|
||||
|
|
|
@ -12,45 +12,43 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(PowToExpRector::class);
|
||||
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'mcrypt_generic_end' => 'mcrypt_generic_deinit',
|
||||
'set_socket_blocking' => 'stream_set_blocking',
|
||||
'ocibindbyname' => 'oci_bind_by_name',
|
||||
'ocicancel' => 'oci_cancel',
|
||||
'ocicolumnisnull' => 'oci_field_is_null',
|
||||
'ocicolumnname' => 'oci_field_name',
|
||||
'ocicolumnprecision' => 'oci_field_precision',
|
||||
'ocicolumnscale' => 'oci_field_scale',
|
||||
'ocicolumnsize' => 'oci_field_size',
|
||||
'ocicolumntype' => 'oci_field_type',
|
||||
'ocicolumntyperaw' => 'oci_field_type_raw',
|
||||
'ocicommit' => 'oci_commit',
|
||||
'ocidefinebyname' => 'oci_define_by_name',
|
||||
'ocierror' => 'oci_error',
|
||||
'ociexecute' => 'oci_execute',
|
||||
'ocifetch' => 'oci_fetch',
|
||||
'ocifetchstatement' => 'oci_fetch_all',
|
||||
'ocifreecursor' => 'oci_free_statement',
|
||||
'ocifreestatement' => 'oci_free_statement',
|
||||
'ociinternaldebug' => 'oci_internal_debug',
|
||||
'ocilogoff' => 'oci_close',
|
||||
'ocilogon' => 'oci_connect',
|
||||
'ocinewcollection' => 'oci_new_collection',
|
||||
'ocinewcursor' => 'oci_new_cursor',
|
||||
'ocinewdescriptor' => 'oci_new_descriptor',
|
||||
'ocinlogon' => 'oci_new_connect',
|
||||
'ocinumcols' => 'oci_num_fields',
|
||||
'ociparse' => 'oci_parse',
|
||||
'ociplogon' => 'oci_pconnect',
|
||||
'ociresult' => 'oci_result',
|
||||
'ocirollback' => 'oci_rollback',
|
||||
'ocirowcount' => 'oci_num_rows',
|
||||
'ociserverversion' => 'oci_server_version',
|
||||
'ocisetprefetch' => 'oci_set_prefetch',
|
||||
'ocistatementtype' => 'oci_statement_type',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'mcrypt_generic_end' => 'mcrypt_generic_deinit',
|
||||
'set_socket_blocking' => 'stream_set_blocking',
|
||||
'ocibindbyname' => 'oci_bind_by_name',
|
||||
'ocicancel' => 'oci_cancel',
|
||||
'ocicolumnisnull' => 'oci_field_is_null',
|
||||
'ocicolumnname' => 'oci_field_name',
|
||||
'ocicolumnprecision' => 'oci_field_precision',
|
||||
'ocicolumnscale' => 'oci_field_scale',
|
||||
'ocicolumnsize' => 'oci_field_size',
|
||||
'ocicolumntype' => 'oci_field_type',
|
||||
'ocicolumntyperaw' => 'oci_field_type_raw',
|
||||
'ocicommit' => 'oci_commit',
|
||||
'ocidefinebyname' => 'oci_define_by_name',
|
||||
'ocierror' => 'oci_error',
|
||||
'ociexecute' => 'oci_execute',
|
||||
'ocifetch' => 'oci_fetch',
|
||||
'ocifetchstatement' => 'oci_fetch_all',
|
||||
'ocifreecursor' => 'oci_free_statement',
|
||||
'ocifreestatement' => 'oci_free_statement',
|
||||
'ociinternaldebug' => 'oci_internal_debug',
|
||||
'ocilogoff' => 'oci_close',
|
||||
'ocilogon' => 'oci_connect',
|
||||
'ocinewcollection' => 'oci_new_collection',
|
||||
'ocinewcursor' => 'oci_new_cursor',
|
||||
'ocinewdescriptor' => 'oci_new_descriptor',
|
||||
'ocinlogon' => 'oci_new_connect',
|
||||
'ocinumcols' => 'oci_num_fields',
|
||||
'ociparse' => 'oci_parse',
|
||||
'ociplogon' => 'oci_pconnect',
|
||||
'ociresult' => 'oci_result',
|
||||
'ocirollback' => 'oci_rollback',
|
||||
'ocirowcount' => 'oci_num_rows',
|
||||
'ociserverversion' => 'oci_server_version',
|
||||
'ocisetprefetch' => 'oci_set_prefetch',
|
||||
'ocistatementtype' => 'oci_statement_type',
|
||||
]);
|
||||
|
||||
# inspired by level in psalm - https://github.com/vimeo/psalm/blob/82e0bcafac723fdf5007a31a7ae74af1736c9f6f/tests/FileManipulationTest.php#L1063
|
||||
$services->set(AddDefaultValueForUndefinedVariableRector::class);
|
||||
|
|
|
@ -26,19 +26,17 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(UnsetCastRector::class);
|
||||
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
# and imagewbmp
|
||||
'jpeg2wbmp' => 'imagecreatefromjpeg',
|
||||
# or imagewbmp
|
||||
'png2wbmp' => 'imagecreatefrompng',
|
||||
#migration72.deprecated.gmp_random-function
|
||||
# http://php.net/manual/en/migration72.deprecated.php
|
||||
# or gmp_random_range
|
||||
'gmp_random' => 'gmp_random_bits',
|
||||
'read_exif_data' => 'exif_read_data',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
# and imagewbmp
|
||||
'jpeg2wbmp' => 'imagecreatefromjpeg',
|
||||
# or imagewbmp
|
||||
'png2wbmp' => 'imagecreatefrompng',
|
||||
#migration72.deprecated.gmp_random-function
|
||||
# http://php.net/manual/en/migration72.deprecated.php
|
||||
# or gmp_random_range
|
||||
'gmp_random' => 'gmp_random_bits',
|
||||
'read_exif_data' => 'exif_read_data',
|
||||
]);
|
||||
|
||||
$services->set(GetClassOnNullRector::class);
|
||||
|
||||
|
|
|
@ -24,25 +24,23 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(SensitiveHereNowDocRector::class);
|
||||
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_3
|
||||
'image2wbmp' => 'imagewbmp',
|
||||
'mbregex_encoding' => 'mb_regex_encoding',
|
||||
'mbereg' => 'mb_ereg',
|
||||
'mberegi' => 'mb_eregi',
|
||||
'mbereg_replace' => 'mb_ereg_replace',
|
||||
'mberegi_replace' => 'mb_eregi_replace',
|
||||
'mbsplit' => 'mb_split',
|
||||
'mbereg_match' => 'mb_ereg_match',
|
||||
'mbereg_search' => 'mb_ereg_search',
|
||||
'mbereg_search_pos' => 'mb_ereg_search_pos',
|
||||
'mbereg_search_regs' => 'mb_ereg_search_regs',
|
||||
'mbereg_search_init' => 'mb_ereg_search_init',
|
||||
'mbereg_search_getregs' => 'mb_ereg_search_getregs',
|
||||
'mbereg_search_getpos' => 'mb_ereg_search_getpos',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_3
|
||||
'image2wbmp' => 'imagewbmp',
|
||||
'mbregex_encoding' => 'mb_regex_encoding',
|
||||
'mbereg' => 'mb_ereg',
|
||||
'mberegi' => 'mb_eregi',
|
||||
'mbereg_replace' => 'mb_ereg_replace',
|
||||
'mberegi_replace' => 'mb_eregi_replace',
|
||||
'mbsplit' => 'mb_split',
|
||||
'mbereg_match' => 'mb_ereg_match',
|
||||
'mbereg_search' => 'mb_ereg_search',
|
||||
'mbereg_search_pos' => 'mb_ereg_search_pos',
|
||||
'mbereg_search_regs' => 'mb_ereg_search_regs',
|
||||
'mbereg_search_init' => 'mb_ereg_search_init',
|
||||
'mbereg_search_getregs' => 'mb_ereg_search_getregs',
|
||||
'mbereg_search_getpos' => 'mb_ereg_search_getpos',
|
||||
]);
|
||||
|
||||
$services->set(StringifyStrNeedlesRector::class);
|
||||
$services->set(JsonThrowOnErrorRector::class);
|
||||
|
|
|
@ -25,17 +25,15 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(TypedPropertyRector::class);
|
||||
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
#the_real_type
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'is_real' => 'is_float',
|
||||
#apache_request_headers_function
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'apache_request_headers' => 'getallheaders',
|
||||
//'hebrevc' => ['nl2br', 'hebrev'],
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
#the_real_type
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'is_real' => 'is_float',
|
||||
#apache_request_headers_function
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'apache_request_headers' => 'getallheaders',
|
||||
//'hebrevc' => ['nl2br', 'hebrev'],
|
||||
]);
|
||||
|
||||
$services->set(ArrayKeyExistsOnPropertyRector::class);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
|||
use Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
||||
use Rector\Transform\ValueObject\StaticCallToFuncCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
@ -37,13 +36,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(StrEndsWithRector::class);
|
||||
|
||||
$services->set(StaticCallToFuncCallRector::class)
|
||||
->call('configure', [[
|
||||
StaticCallToFuncCallRector::STATIC_CALLS_TO_FUNCTIONS => ValueObjectInliner::inline([
|
||||
new StaticCallToFuncCall('Nette\Utils\Strings', 'startsWith', 'str_starts_with'),
|
||||
new StaticCallToFuncCall('Nette\Utils\Strings', 'endsWith', 'str_ends_with'),
|
||||
new StaticCallToFuncCall('Nette\Utils\Strings', 'contains', 'str_contains'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new StaticCallToFuncCall('Nette\Utils\Strings', 'startsWith', 'str_starts_with'),
|
||||
new StaticCallToFuncCall('Nette\Utils\Strings', 'endsWith', 'str_ends_with'),
|
||||
new StaticCallToFuncCall('Nette\Utils\Strings', 'contains', 'str_contains'),
|
||||
]);
|
||||
|
||||
$services->set(StringableForToStringRector::class);
|
||||
$services->set(ClassOnObjectRector::class);
|
||||
|
@ -55,60 +52,52 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
// nette\utils and Strings::replace()
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentAdder('Nette\Utils\Strings', 'replace', 2, 'replacement', ''),
|
||||
]),
|
||||
]]);
|
||||
->configure([new ArgumentAdder('Nette\Utils\Strings', 'replace', 2, 'replacement', '')]);
|
||||
$services->set(RemoveParentCallWithoutParentRector::class);
|
||||
$services->set(SetStateToStaticRector::class);
|
||||
$services->set(FinalPrivateToPrivateVisibilityRector::class);
|
||||
// @see https://php.watch/versions/8.0/pgsql-aliases-deprecated
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'pg_clientencoding' => 'pg_client_encoding',
|
||||
'pg_cmdtuples' => 'pg_affected_rows',
|
||||
'pg_errormessage' => 'pg_last_error',
|
||||
'pg_fieldisnull' => 'pg_field_is_null',
|
||||
'pg_fieldname' => 'pg_field_name',
|
||||
'pg_fieldnum' => 'pg_field_num',
|
||||
'pg_fieldprtlen' => 'pg_field_prtlen',
|
||||
'pg_fieldsize' => 'pg_field_size',
|
||||
'pg_fieldtype' => 'pg_field_type',
|
||||
'pg_freeresult' => 'pg_free_result',
|
||||
'pg_getlastoid' => 'pg_last_oid',
|
||||
'pg_loclose' => 'pg_lo_close',
|
||||
'pg_locreate' => 'pg_lo_create',
|
||||
'pg_loexport' => 'pg_lo_export',
|
||||
'pg_loimport' => 'pg_lo_import',
|
||||
'pg_loopen' => 'pg_lo_open',
|
||||
'pg_loread' => 'pg_lo_read',
|
||||
'pg_loreadall' => 'pg_lo_read_all',
|
||||
'pg_lounlink' => 'pg_lo_unlink',
|
||||
'pg_lowrite' => 'pg_lo_write',
|
||||
'pg_numfields' => 'pg_num_fields',
|
||||
'pg_numrows' => 'pg_num_rows',
|
||||
'pg_result' => 'pg_fetch_result',
|
||||
'pg_setclientencoding' => 'pg_set_client_encoding',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'pg_clientencoding' => 'pg_client_encoding',
|
||||
'pg_cmdtuples' => 'pg_affected_rows',
|
||||
'pg_errormessage' => 'pg_last_error',
|
||||
'pg_fieldisnull' => 'pg_field_is_null',
|
||||
'pg_fieldname' => 'pg_field_name',
|
||||
'pg_fieldnum' => 'pg_field_num',
|
||||
'pg_fieldprtlen' => 'pg_field_prtlen',
|
||||
'pg_fieldsize' => 'pg_field_size',
|
||||
'pg_fieldtype' => 'pg_field_type',
|
||||
'pg_freeresult' => 'pg_free_result',
|
||||
'pg_getlastoid' => 'pg_last_oid',
|
||||
'pg_loclose' => 'pg_lo_close',
|
||||
'pg_locreate' => 'pg_lo_create',
|
||||
'pg_loexport' => 'pg_lo_export',
|
||||
'pg_loimport' => 'pg_lo_import',
|
||||
'pg_loopen' => 'pg_lo_open',
|
||||
'pg_loread' => 'pg_lo_read',
|
||||
'pg_loreadall' => 'pg_lo_read_all',
|
||||
'pg_lounlink' => 'pg_lo_unlink',
|
||||
'pg_lowrite' => 'pg_lo_write',
|
||||
'pg_numfields' => 'pg_num_fields',
|
||||
'pg_numrows' => 'pg_num_rows',
|
||||
'pg_result' => 'pg_fetch_result',
|
||||
'pg_setclientencoding' => 'pg_set_client_encoding',
|
||||
]);
|
||||
$services->set(OptionalParametersAfterRequiredRector::class);
|
||||
|
||||
$services->set(FunctionArgumentDefaultValueReplacerRector::class)
|
||||
->call('configure', [[
|
||||
FunctionArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '', '!='),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '!', '!='),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'g', 'gt'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'l', 'lt'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'n', 'ne'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '', '!='),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '!', '!='),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'g', 'gt'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'l', 'lt'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'gte', 'ge'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'n', 'ne'),
|
||||
]);
|
||||
|
||||
$services->set(Php8ResourceReturnToObjectRector::class);
|
||||
};
|
||||
|
|
|
@ -6,36 +6,31 @@ use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
|||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
// @see http://www.phpspec.net/en/stable/manual/upgrading-to-phpspec-3.html
|
||||
new MethodCallRename('PhpSpec\ServiceContainer', 'set', 'define'),
|
||||
new MethodCallRename('PhpSpec\ServiceContainer', 'setShared', 'define'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
// @see http://www.phpspec.net/en/stable/manual/upgrading-to-phpspec-3.html
|
||||
new MethodCallRename('PhpSpec\ServiceContainer', 'set', 'define'),
|
||||
new MethodCallRename('PhpSpec\ServiceContainer', 'setShared', 'define'),
|
||||
]);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'PhpSpec\Console\IO' => 'PhpSpec\Console\ConsoleIO',
|
||||
'PhpSpec\IO\IOInterface' => 'PhpSpec\IO\IO',
|
||||
'PhpSpec\Locator\ResourceInterface' => 'PhpSpec\Locator\Resource',
|
||||
'PhpSpec\Locator\ResourceLocatorInterface' => 'PhpSpec\Locator\ResourceLocator',
|
||||
'PhpSpec\Formatter\Presenter\PresenterInterface' => 'PhpSpec\Formatter\Presenter\Presenter',
|
||||
'PhpSpec\CodeGenerator\Generator\GeneratorInterface' => 'PhpSpec\CodeGenerator\Generator\Generator',
|
||||
'PhpSpec\Extension\ExtensionInterface' => 'PhpSpec\Extension',
|
||||
'Phpspec\CodeAnalysis\AccessInspectorInterface' => 'Phpspec\CodeAnalysis\AccessInspector',
|
||||
'Phpspec\Event\EventInterface' => 'Phpspec\Event\PhpSpecEvent',
|
||||
'PhpSpec\Formatter\Presenter\Differ\EngineInterface' => 'PhpSpec\Formatter\Presenter\Differ\DifferEngine',
|
||||
'PhpSpec\Matcher\MatcherInterface' => 'PhpSpec\Matcher\Matcher',
|
||||
'PhpSpec\Matcher\MatchersProviderInterface' => 'PhpSpec\Matcher\MatchersProvider',
|
||||
'PhpSpec\SpecificationInterface' => 'PhpSpec\Specification',
|
||||
'PhpSpec\Runner\Maintainer\MaintainerInterface' => 'PhpSpec\Runner\Maintainer\Maintainer',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'PhpSpec\Console\IO' => 'PhpSpec\Console\ConsoleIO',
|
||||
'PhpSpec\IO\IOInterface' => 'PhpSpec\IO\IO',
|
||||
'PhpSpec\Locator\ResourceInterface' => 'PhpSpec\Locator\Resource',
|
||||
'PhpSpec\Locator\ResourceLocatorInterface' => 'PhpSpec\Locator\ResourceLocator',
|
||||
'PhpSpec\Formatter\Presenter\PresenterInterface' => 'PhpSpec\Formatter\Presenter\Presenter',
|
||||
'PhpSpec\CodeGenerator\Generator\GeneratorInterface' => 'PhpSpec\CodeGenerator\Generator\Generator',
|
||||
'PhpSpec\Extension\ExtensionInterface' => 'PhpSpec\Extension',
|
||||
'Phpspec\CodeAnalysis\AccessInspectorInterface' => 'Phpspec\CodeAnalysis\AccessInspector',
|
||||
'Phpspec\Event\EventInterface' => 'Phpspec\Event\PhpSpecEvent',
|
||||
'PhpSpec\Formatter\Presenter\Differ\EngineInterface' => 'PhpSpec\Formatter\Presenter\Differ\DifferEngine',
|
||||
'PhpSpec\Matcher\MatcherInterface' => 'PhpSpec\Matcher\Matcher',
|
||||
'PhpSpec\Matcher\MatchersProviderInterface' => 'PhpSpec\Matcher\MatchersProvider',
|
||||
'PhpSpec\SpecificationInterface' => 'PhpSpec\Specification',
|
||||
'PhpSpec\Runner\Maintainer\MaintainerInterface' => 'PhpSpec\Runner\Maintainer\Maintainer',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@ use PHPStan\Type\MixedType;
|
|||
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
@ -15,9 +14,5 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$arrayType = new ArrayType(new MixedType(), new MixedType());
|
||||
|
||||
$services->set(AddReturnTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddReturnTypeDeclarationRector::METHOD_RETURN_TYPES => ValueObjectInliner::inline([
|
||||
new AddReturnTypeDeclaration('PhpSpec\ObjectBehavior', 'getMatchers', $arrayType),
|
||||
]),
|
||||
]]);
|
||||
->configure([new AddReturnTypeDeclaration('PhpSpec\ObjectBehavior', 'getMatchers', $arrayType)]);
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,6 +41,9 @@ parameters:
|
|||
checkGenericClassInNonGenericObjectType: false
|
||||
|
||||
excludePaths:
|
||||
# temp rule
|
||||
- src/Rector/ConfigureRector.php
|
||||
|
||||
# temporary stinrgable migration from template type provider
|
||||
- src/Console/Command/InitCommand.php
|
||||
- bin/generate-changelog.php
|
||||
|
|
26
rector.php
26
rector.php
|
@ -21,26 +21,24 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$containerConfigurator->import(LevelSetList::UP_TO_PHP_80);
|
||||
|
||||
// include sets
|
||||
$containerConfigurator->import(SetList::CODING_STYLE);
|
||||
$containerConfigurator->import(SetList::CODING_STYLE_ADVANCED);
|
||||
$containerConfigurator->import(SetList::CODE_QUALITY);
|
||||
$containerConfigurator->import(SetList::DEAD_CODE);
|
||||
$containerConfigurator->import(SetList::PRIVATIZATION);
|
||||
$containerConfigurator->import(SetList::NAMING);
|
||||
$containerConfigurator->import(SetList::TYPE_DECLARATION);
|
||||
$containerConfigurator->import(SetList::EARLY_RETURN);
|
||||
$containerConfigurator->import(SetList::TYPE_DECLARATION_STRICT);
|
||||
$containerConfigurator->import(NetteSetList::NETTE_UTILS_CODE_QUALITY);
|
||||
$containerConfigurator->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
|
||||
// $containerConfigurator->import(SetList::CODING_STYLE);
|
||||
// $containerConfigurator->import(SetList::CODING_STYLE_ADVANCED);
|
||||
// $containerConfigurator->import(SetList::CODE_QUALITY);
|
||||
// $containerConfigurator->import(SetList::DEAD_CODE);
|
||||
// $containerConfigurator->import(SetList::PRIVATIZATION);
|
||||
// $containerConfigurator->import(SetList::NAMING);
|
||||
// $containerConfigurator->import(SetList::TYPE_DECLARATION);
|
||||
// $containerConfigurator->import(SetList::EARLY_RETURN);
|
||||
// $containerConfigurator->import(SetList::TYPE_DECLARATION_STRICT);
|
||||
// $containerConfigurator->import(NetteSetList::NETTE_UTILS_CODE_QUALITY);
|
||||
// $containerConfigurator->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
// phpunit
|
||||
$services->set(PreferThisOrSelfMethodCallRector::class)
|
||||
->configure([
|
||||
PreferThisOrSelfMethodCallRector::TYPE_TO_PREFERENCE => [
|
||||
TestCase::class => PreferenceSelfThis::PREFER_THIS(),
|
||||
],
|
||||
TestCase::class => PreferenceSelfThis::PREFER_THIS(),
|
||||
]);
|
||||
|
||||
$services->set(ReturnArrayClassMethodToYieldRector::class)
|
||||
|
|
|
@ -13,7 +13,6 @@ use Rector\Tests\Arguments\Rector\ClassMethod\ArgumentAdderRector\Source\SomeCla
|
|||
use Rector\Tests\Arguments\Rector\ClassMethod\ArgumentAdderRector\Source\SomeContainerBuilder;
|
||||
use Rector\Tests\Arguments\Rector\ClassMethod\ArgumentAdderRector\Source\SomeParentClient;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
@ -21,46 +20,37 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$arrayType = new ArrayType(new MixedType(), new MixedType());
|
||||
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
// covers https://github.com/rectorphp/rector/issues/4267
|
||||
new ArgumentAdder(
|
||||
SomeContainerBuilder::class,
|
||||
'sendResetLinkResponse',
|
||||
0,
|
||||
'request',
|
||||
null,
|
||||
new ObjectType('Illuminate\Http\Illuminate\Http')
|
||||
),
|
||||
new ArgumentAdder(SomeContainerBuilder::class, 'compile', 0, 'isCompiled', false),
|
||||
new ArgumentAdder(
|
||||
SomeContainerBuilder::class,
|
||||
'addCompilerPass',
|
||||
2,
|
||||
'priority',
|
||||
0,
|
||||
new IntegerType()
|
||||
),
|
||||
// scoped
|
||||
new ArgumentAdder(
|
||||
SomeParentClient::class,
|
||||
'submit',
|
||||
2,
|
||||
'serverParameters',
|
||||
[],
|
||||
$arrayType,
|
||||
ArgumentAddingScope::SCOPE_PARENT_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
SomeParentClient::class,
|
||||
'submit',
|
||||
2,
|
||||
'serverParameters',
|
||||
[],
|
||||
$arrayType,
|
||||
ArgumentAddingScope::SCOPE_CLASS_METHOD
|
||||
),
|
||||
new ArgumentAdder(SomeClass::class, 'withoutTypeOrDefaultValue', 0, 'arguments', [], $arrayType),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
// covers https://github.com/rectorphp/rector/issues/4267
|
||||
new ArgumentAdder(
|
||||
SomeContainerBuilder::class,
|
||||
'sendResetLinkResponse',
|
||||
0,
|
||||
'request',
|
||||
null,
|
||||
new ObjectType('Illuminate\Http\Illuminate\Http')
|
||||
),
|
||||
new ArgumentAdder(SomeContainerBuilder::class, 'compile', 0, 'isCompiled', false),
|
||||
new ArgumentAdder(SomeContainerBuilder::class, 'addCompilerPass', 2, 'priority', 0, new IntegerType()),
|
||||
// scoped
|
||||
new ArgumentAdder(
|
||||
SomeParentClient::class,
|
||||
'submit',
|
||||
2,
|
||||
'serverParameters',
|
||||
[],
|
||||
$arrayType,
|
||||
ArgumentAddingScope::SCOPE_PARENT_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
SomeParentClient::class,
|
||||
'submit',
|
||||
2,
|
||||
'serverParameters',
|
||||
[],
|
||||
$arrayType,
|
||||
ArgumentAddingScope::SCOPE_CLASS_METHOD
|
||||
),
|
||||
new ArgumentAdder(SomeClass::class, 'withoutTypeOrDefaultValue', 0, 'arguments', [], $arrayType),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,64 +5,61 @@ declare(strict_types=1);
|
|||
use Rector\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueRector;
|
||||
use Rector\Arguments\ValueObject\ReplaceArgumentDefaultValue;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReplaceArgumentDefaultValueRector::class)
|
||||
->call('configure', [[
|
||||
ReplaceArgumentDefaultValueRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
->configure([
|
||||
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Symfony\Component\DependencyInjection\Definition',
|
||||
'setScope',
|
||||
0,
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder::SCOPE_PROTOTYPE',
|
||||
false
|
||||
),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'parse', 1, [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP'),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'parse', 1, [
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT'),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'parse', 1, false, 0),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'parse',
|
||||
1,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'dump', 3, [
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::DUMP_OBJECT'),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'dump',
|
||||
3,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Symfony\Component\DependencyInjection\Definition',
|
||||
'setScope',
|
||||
0,
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder::SCOPE_PROTOTYPE',
|
||||
false
|
||||
),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'parse', 1, [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP'),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'parse', 1, [
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT'),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'parse', 1, false, 0),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'parse',
|
||||
1,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
new ReplaceArgumentDefaultValue('Symfony\Component\Yaml\Yaml', 'dump', 3, [
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::DUMP_OBJECT'),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'dump',
|
||||
3,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueRector\Source\SomeClassWithAnyDefaultValue',
|
||||
'someMethod',
|
||||
0,
|
||||
ReplaceArgumentDefaultValue::ANY_VALUE_BEFORE,
|
||||
[]
|
||||
),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueRector\Source\SomeClassWithAnyDefaultValue',
|
||||
'paramWithNull',
|
||||
0,
|
||||
null,
|
||||
[]
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueRector\Source\SomeClassWithAnyDefaultValue',
|
||||
'someMethod',
|
||||
0,
|
||||
ReplaceArgumentDefaultValue::ANY_VALUE_BEFORE,
|
||||
[]
|
||||
),
|
||||
new ReplaceArgumentDefaultValue(
|
||||
'Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueRector\Source\SomeClassWithAnyDefaultValue',
|
||||
'paramWithNull',
|
||||
0,
|
||||
null,
|
||||
[]
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,21 +5,18 @@ declare(strict_types=1);
|
|||
use Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector;
|
||||
use Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(FunctionArgumentDefaultValueReplacerRector::class)
|
||||
->call('configure', [[
|
||||
FunctionArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '', '!='),
|
||||
new ReplaceFuncCallArgumentDefaultValue(
|
||||
'some_function',
|
||||
0,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, 'lte', 'le'),
|
||||
new ReplaceFuncCallArgumentDefaultValue('version_compare', 2, '', '!='),
|
||||
new ReplaceFuncCallArgumentDefaultValue(
|
||||
'some_function',
|
||||
0,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,14 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Arguments\Rector\FuncCall\SwapFuncCallArgumentsRector;
|
||||
use Rector\Arguments\ValueObject\SwapFuncCallArguments;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(SwapFuncCallArgumentsRector::class)
|
||||
->call('configure', [[
|
||||
SwapFuncCallArgumentsRector::FUNCTION_ARGUMENT_SWAPS => ValueObjectInliner::inline(
|
||||
[new SwapFuncCallArguments('some_function', [1, 0])]
|
||||
),
|
||||
]]);
|
||||
->configure([new SwapFuncCallArguments('some_function', [1, 0])]);
|
||||
};
|
||||
|
|
|
@ -8,12 +8,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(MoveServicesBySuffixToDirectoryRector::class)
|
||||
->call('configure', [[
|
||||
MoveServicesBySuffixToDirectoryRector::GROUP_NAMES_BY_SUFFIX => [
|
||||
'Repository',
|
||||
'Command',
|
||||
'Mapper',
|
||||
'Controller',
|
||||
],
|
||||
]]);
|
||||
->configure(['Repository', 'Command', 'Mapper', 'Controller']);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,11 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(MoveValueObjectsToValueObjectDirectoryRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
MoveValueObjectsToValueObjectDirectoryRector::TYPES => [ObviousValueObjectInterface::class],
|
||||
MoveValueObjectsToValueObjectDirectoryRector::SUFFIXES => ['Search'],
|
||||
MoveValueObjectsToValueObjectDirectoryRector::ENABLE_VALUE_OBJECT_GUESSING => true,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -10,7 +10,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(OrderAttributesRector::class)
|
||||
->call('configure', [[
|
||||
OrderAttributesRector::ATTRIBUTES_ORDER => [FirstAttribute::class, SecondAttribute::class],
|
||||
]]);
|
||||
->configure([FirstAttribute::class, SecondAttribute::class]);
|
||||
};
|
||||
|
|
|
@ -8,17 +8,14 @@ use Rector\CodingStyle\ValueObject\ReturnArrayClassMethodToYield;
|
|||
use Rector\Tests\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Source\EventSubscriberInterface;
|
||||
use Rector\Tests\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Source\ParentTestCase;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReturnArrayClassMethodToYieldRector::class)
|
||||
->call('configure', [[
|
||||
ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => ValueObjectInliner::inline([
|
||||
new ReturnArrayClassMethodToYield(EventSubscriberInterface::class, 'getSubscribedEvents'),
|
||||
new ReturnArrayClassMethodToYield(ParentTestCase::class, 'provide*'),
|
||||
new ReturnArrayClassMethodToYield(ParentTestCase::class, 'dataProvider*'),
|
||||
new ReturnArrayClassMethodToYield(TestCase::class, 'provideData'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ReturnArrayClassMethodToYield(EventSubscriberInterface::class, 'getSubscribedEvents'),
|
||||
new ReturnArrayClassMethodToYield(ParentTestCase::class, 'provide*'),
|
||||
new ReturnArrayClassMethodToYield(ParentTestCase::class, 'dataProvider*'),
|
||||
new ReturnArrayClassMethodToYield(TestCase::class, 'provideData'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,16 +9,13 @@ use Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
|
|||
use Rector\Tests\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
use Rector\Tests\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\SomeAbstractTestCase;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(PreferThisOrSelfMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
PreferThisOrSelfMethodCallRector::TYPE_TO_PREFERENCE => [
|
||||
SomeAbstractTestCase::class => ValueObjectInliner::inline(PreferenceSelfThis::PREFER_SELF()),
|
||||
BeLocalClass::class => ValueObjectInliner::inline(PreferenceSelfThis::PREFER_THIS()),
|
||||
TestCase::class => ValueObjectInliner::inline(PreferenceSelfThis::PREFER_SELF()),
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
SomeAbstractTestCase::class => PreferenceSelfThis::PREFER_SELF(),
|
||||
BeLocalClass::class => PreferenceSelfThis::PREFER_THIS(),
|
||||
TestCase::class => PreferenceSelfThis::PREFER_SELF(),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -18,9 +18,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
NormalParamClass::class => NormalReturnClass::class,
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
NormalParamClass::class => NormalReturnClass::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,14 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Composer\Rector\AddPackageToRequireComposerRector;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AddPackageToRequireComposerRector::class)
|
||||
->call('configure', [[
|
||||
AddPackageToRequireComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('vendor1/package3', '^3.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new PackageAndVersion('vendor1/package3', '^3.0')]);
|
||||
};
|
||||
|
|
|
@ -5,16 +5,13 @@ declare(strict_types=1);
|
|||
use Rector\Composer\Rector\AddPackageToRequireDevComposerRector;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AddPackageToRequireDevComposerRector::class)
|
||||
->call('configure', [[
|
||||
AddPackageToRequireDevComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('vendor1/package3', '^3.0'),
|
||||
new PackageAndVersion('vendor1/package1', '^3.0'),
|
||||
new PackageAndVersion('vendor1/package2', '^3.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new PackageAndVersion('vendor1/package3', '^3.0'),
|
||||
new PackageAndVersion('vendor1/package1', '^3.0'),
|
||||
new PackageAndVersion('vendor1/package2', '^3.0'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,14 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Composer\Rector\ChangePackageVersionComposerRector;
|
||||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ChangePackageVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ChangePackageVersionComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('vendor1/package3', '^15.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new PackageAndVersion('vendor1/package3', '^15.0')]);
|
||||
};
|
||||
|
|
|
@ -7,21 +7,12 @@ use Rector\Composer\Rector\ReplacePackageAndVersionComposerRector;
|
|||
use Rector\Composer\ValueObject\PackageAndVersion;
|
||||
use Rector\Composer\ValueObject\ReplacePackageAndVersion;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReplacePackageAndVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ReplacePackageAndVersionComposerRector::REPLACE_PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new ReplacePackageAndVersion('vendor1/package2', 'vendor2/package1', '^3.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new ReplacePackageAndVersion('vendor1/package2', 'vendor2/package1', '^3.0')]);
|
||||
|
||||
$services->set(ChangePackageVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ChangePackageVersionComposerRector::PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new PackageAndVersion('vendor1/package3', '~3.0.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new PackageAndVersion('vendor1/package3', '~3.0.0')]);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemovePackageComposerRector::class)
|
||||
->call('configure', [[
|
||||
RemovePackageComposerRector::PACKAGE_NAMES => ['vendor1/package3', 'vendor1/package1', 'vendor1/package2'],
|
||||
]]);
|
||||
->configure(['vendor1/package3', 'vendor1/package1', 'vendor1/package2']);
|
||||
};
|
||||
|
|
|
@ -5,17 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Composer\Rector\RenamePackageComposerRector;
|
||||
use Rector\Composer\ValueObject\RenamePackage;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenamePackageComposerRector::class)
|
||||
->call('configure', [
|
||||
[
|
||||
RenamePackageComposerRector::RENAME_PACKAGES =>
|
||||
ValueObjectInliner::inline(
|
||||
[new RenamePackage('foo/bar', 'baz/bar'), new RenamePackage('foo/baz', 'baz/baz')]
|
||||
),
|
||||
],
|
||||
]);
|
||||
->configure([new RenamePackage('foo/bar', 'baz/bar'), new RenamePackage('foo/baz', 'baz/baz')]);
|
||||
};
|
||||
|
|
|
@ -5,14 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Composer\Rector\ReplacePackageAndVersionComposerRector;
|
||||
use Rector\Composer\ValueObject\ReplacePackageAndVersion;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReplacePackageAndVersionComposerRector::class)
|
||||
->call('configure', [[
|
||||
ReplacePackageAndVersionComposerRector::REPLACE_PACKAGES_AND_VERSIONS => ValueObjectInliner::inline([
|
||||
new ReplacePackageAndVersion('vendor1/package1', 'vendor1/package3', '^4.0'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new ReplacePackageAndVersion('vendor1/package1', 'vendor1/package3', '^4.0')]);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveAnnotationRector::class)
|
||||
->call('configure', [[
|
||||
RemoveAnnotationRector::ANNOTATIONS_TO_REMOVE => [
|
||||
'method',
|
||||
'JMS\DiExtraBundle\Annotation\InjectParams',
|
||||
],
|
||||
]]);
|
||||
->configure(['method', 'JMS\DiExtraBundle\Annotation\InjectParams']);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemovePhpVersionIdCheckRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
RemovePhpVersionIdCheckRector::PHP_VERSION_CONSTRAINT => PhpVersion::PHP_80,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,9 +9,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AddMethodParentCallRector::class)
|
||||
->call('configure', [[
|
||||
AddMethodParentCallRector::METHODS_BY_PARENT_TYPES => [
|
||||
ParentClassWithNewConstructor::class => '__construct',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
ParentClassWithNewConstructor::class => '__construct',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(DowngradeParameterTypeWideningRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
DowngradeParameterTypeWideningRector::SAFE_TYPES => [RectorInterface::class],
|
||||
DowngradeParameterTypeWideningRector::SAFE_TYPES_TO_METHODS => [
|
||||
ContainerInterface::class => ['setParameter', 'getParameter', 'hasParameter'],
|
||||
],
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,20 +5,17 @@ declare(strict_types=1);
|
|||
use Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector;
|
||||
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(DowngradeAttributeToAnnotationRector::class)
|
||||
->call('configure', [[
|
||||
DowngradeAttributeToAnnotationRector::ATTRIBUTE_TO_ANNOTATION => ValueObjectInliner::inline([
|
||||
new DowngradeAttributeToAnnotation(
|
||||
'Symfony\Component\Routing\Annotation\Route',
|
||||
'Symfony\Component\Routing\Annotation\Route'
|
||||
),
|
||||
new DowngradeAttributeToAnnotation('Symfony\Contracts\Service\Attribute\Required', 'required'),
|
||||
new DowngradeAttributeToAnnotation('Attribute', 'Attribute'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new DowngradeAttributeToAnnotation(
|
||||
'Symfony\Component\Routing\Annotation\Route',
|
||||
'Symfony\Component\Routing\Annotation\Route'
|
||||
),
|
||||
new DowngradeAttributeToAnnotation('Symfony\Contracts\Service\Attribute\Required', 'required'),
|
||||
new DowngradeAttributeToAnnotation('Attribute', 'Attribute'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,19 +7,11 @@ use Rector\Generics\ValueObject\GenericClassMethodParam;
|
|||
use Rector\Tests\Generics\Rector\ClassMethod\GenericClassMethodParamRector\Source\Contract\GenericSearchInterface;
|
||||
use Rector\Tests\Generics\Rector\ClassMethod\GenericClassMethodParamRector\Source\SomeMapperInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(GenericClassMethodParamRector::class)
|
||||
->call('configure', [[
|
||||
GenericClassMethodParamRector::GENERIC_CLASS_METHOD_PARAMS => ValueObjectInliner::inline([
|
||||
new GenericClassMethodParam(
|
||||
SomeMapperInterface::class,
|
||||
'getParams',
|
||||
0,
|
||||
GenericSearchInterface::class
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new GenericClassMethodParam(SomeMapperInterface::class, 'getParams', 0, GenericSearchInterface::class),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(StringClassNameToClassConstantRector::class)
|
||||
->call('configure', [[
|
||||
StringClassNameToClassConstantRector::CLASSES_TO_SKIP => ['Nette\*', 'Error', 'Exception'],
|
||||
]]);
|
||||
->configure(['Nette\*', 'Error', 'Exception']);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReservedObjectRector::class)
|
||||
->call('configure', [[
|
||||
ReservedObjectRector::RESERVED_KEYWORDS_TO_REPLACEMENTS => [
|
||||
'ReservedObject' => 'SmartObject',
|
||||
'Object' => 'AnotherSmartObject',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'ReservedObject' => 'SmartObject',
|
||||
'Object' => 'AnotherSmartObject',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReservedFnFunctionRector::class)
|
||||
->call('configure', [[
|
||||
ReservedFnFunctionRector::RESERVED_NAMES_TO_NEW_ONES => [
|
||||
// for testing purposes of "fn" even on PHP 7.3-
|
||||
'reservedFn' => 'f',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
// for testing purposes of "fn" even on PHP 7.3-
|
||||
'reservedFn' => 'f',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AddLiteralSeparatorToNumberRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
AddLiteralSeparatorToNumberRector::LIMIT_VALUE => 1_000_000,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(TypedPropertyRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
TypedPropertyRector::CLASS_LIKE_TYPE_ONLY => true,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(TypedPropertyRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
TypedPropertyRector::CLASS_LIKE_TYPE_ONLY => true,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(TypedPropertyRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
TypedPropertyRector::PRIVATE_PROPERTY_ONLY => true,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@ use Rector\Php80\ValueObject\AnnotationToAttribute;
|
|||
use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Annotation\Apple;
|
||||
use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\Apple as AppleAttribute;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
@ -18,13 +17,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AnnotationToAttributeRector::class)
|
||||
->call('configure', [[
|
||||
AnnotationToAttributeRector::ANNOTATION_TO_ATTRIBUTE => ValueObjectInliner::inline([
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Entity'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Id'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Column'),
|
||||
->configure([
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Entity'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Id'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Column'),
|
||||
|
||||
new AnnotationToAttribute(Apple::class, AppleAttribute::class),
|
||||
]),
|
||||
]]);
|
||||
new AnnotationToAttribute(Apple::class, AppleAttribute::class),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@ use Rector\Php80\ValueObject\AnnotationToAttribute;
|
|||
use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\GenericAnnotation;
|
||||
use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Response;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
@ -18,25 +17,23 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(AnnotationToAttributeRector::class)
|
||||
->call('configure', [[
|
||||
AnnotationToAttributeRector::ANNOTATION_TO_ATTRIBUTE => ValueObjectInliner::inline([
|
||||
// use always this annotation to test inner part of annotation - arguments, arrays, calls...
|
||||
new AnnotationToAttribute(GenericAnnotation::class),
|
||||
->configure([
|
||||
// use always this annotation to test inner part of annotation - arguments, arrays, calls...
|
||||
new AnnotationToAttribute(GenericAnnotation::class),
|
||||
|
||||
new AnnotationToAttribute('inject', 'Nette\DI\Attributes\Inject'),
|
||||
new AnnotationToAttribute('inject', 'Nette\DI\Attributes\Inject'),
|
||||
|
||||
new AnnotationToAttribute(Response::class),
|
||||
new AnnotationToAttribute('Symfony\Component\Routing\Annotation\Route'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Entity'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Index'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\JoinColumn'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\InverseJoinColumn'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\ManyToMany'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\JoinTable'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\UniqueConstraint'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Table'),
|
||||
// validation
|
||||
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\All'),
|
||||
]),
|
||||
]]);
|
||||
new AnnotationToAttribute(Response::class),
|
||||
new AnnotationToAttribute('Symfony\Component\Routing\Annotation\Route'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Entity'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Index'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\JoinColumn'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\InverseJoinColumn'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\ManyToMany'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\JoinTable'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\UniqueConstraint'),
|
||||
new AnnotationToAttribute('Doctrine\ORM\Mapping\Table'),
|
||||
// validation
|
||||
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\All'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DoctrineAnnotationClassToAttributeRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
DoctrineAnnotationClassToAttributeRector::REMOVE_ANNOTATIONS => false,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,20 +6,17 @@ use Rector\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector;
|
|||
use Rector\Privatization\ValueObject\ReplaceStringWithClassConstant;
|
||||
use Rector\Tests\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector\Source\Order;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReplaceStringWithClassConstantRector::class)
|
||||
->call('configure', [[
|
||||
ReplaceStringWithClassConstantRector::REPLACE_STRING_WITH_CLASS_CONSTANT => ValueObjectInliner::inline([
|
||||
new ReplaceStringWithClassConstant(
|
||||
'Rector\Tests\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector\FixtureCaseInsensitive\ReplaceWithConstant',
|
||||
'call',
|
||||
0,
|
||||
Order::class,
|
||||
true
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ReplaceStringWithClassConstant(
|
||||
'Rector\Tests\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector\FixtureCaseInsensitive\ReplaceWithConstant',
|
||||
'call',
|
||||
0,
|
||||
Order::class,
|
||||
true
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,19 +6,16 @@ use Rector\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector;
|
|||
use Rector\Privatization\ValueObject\ReplaceStringWithClassConstant;
|
||||
use Rector\Tests\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector\Source\Placeholder;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ReplaceStringWithClassConstantRector::class)
|
||||
->call('configure', [[
|
||||
ReplaceStringWithClassConstantRector::REPLACE_STRING_WITH_CLASS_CONSTANT => ValueObjectInliner::inline([
|
||||
new ReplaceStringWithClassConstant(
|
||||
'Rector\Tests\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector\Fixture\ReplaceWithConstant',
|
||||
'call',
|
||||
0,
|
||||
Placeholder::class
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ReplaceStringWithClassConstant(
|
||||
'Rector\Tests\Privatization\Rector\MethodCall\ReplaceStringWithClassConstantRector\Fixture\ReplaceWithConstant',
|
||||
'call',
|
||||
0,
|
||||
Placeholder::class
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,22 +8,19 @@ use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\Persis
|
|||
use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\RemoveInTheMiddle;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ArgumentRemoverRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentRemoverRector::REMOVED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentRemover(Persister::class, 'getSelectJoinColumnSQL', 4, null), new ArgumentRemover(
|
||||
Yaml::class,
|
||||
'parse',
|
||||
1,
|
||||
['Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS', 'hey', 55, 5.5]
|
||||
),
|
||||
new ArgumentRemover(RemoveInTheMiddle::class, 'run', 1, [
|
||||
'name' => 'second',
|
||||
]),
|
||||
->configure([
|
||||
new ArgumentRemover(Persister::class, 'getSelectJoinColumnSQL', 4, null), new ArgumentRemover(
|
||||
Yaml::class,
|
||||
'parse',
|
||||
1,
|
||||
['Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS', 'hey', 55, 5.5]
|
||||
),
|
||||
new ArgumentRemover(RemoveInTheMiddle::class, 'run', 1, [
|
||||
'name' => 'second',
|
||||
]),
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveInterfacesRector::class)
|
||||
->call('configure', [[
|
||||
RemoveInterfacesRector::INTERFACES_TO_REMOVE => [SomeInterface::class],
|
||||
]]);
|
||||
->configure([SomeInterface::class]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveParentRector::class)
|
||||
->call('configure', [[
|
||||
RemoveParentRector::PARENT_TYPES_TO_REMOVE => [ParentTypeToBeRemoved::class],
|
||||
]]);
|
||||
->configure([ParentTypeToBeRemoved::class]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveTraitUseRector::class)
|
||||
->call('configure', [[
|
||||
RemoveTraitUseRector::TRAITS_TO_REMOVE => [TraitToBeRemoved::class],
|
||||
]]);
|
||||
->configure([TraitToBeRemoved::class]);
|
||||
};
|
||||
|
|
|
@ -5,16 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
|
||||
use Rector\Removing\ValueObject\RemoveFuncCallArg;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveFuncCallArgRector::class)
|
||||
->call('configure', [[
|
||||
RemoveFuncCallArgRector::REMOVED_FUNCTION_ARGUMENTS => ValueObjectInliner::inline([
|
||||
|
||||
new RemoveFuncCallArg('ldap_first_attribute', 2),
|
||||
|
||||
]),
|
||||
]]);
|
||||
->configure([new RemoveFuncCallArg('ldap_first_attribute', 2)]);
|
||||
};
|
||||
|
|
|
@ -5,19 +5,16 @@ declare(strict_types=1);
|
|||
use Rector\Removing\Rector\FuncCall\RemoveFuncCallRector;
|
||||
use Rector\Removing\ValueObject\RemoveFuncCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RemoveFuncCallRector::class)
|
||||
->call('configure', [[
|
||||
RemoveFuncCallRector::REMOVE_FUNC_CALLS => ValueObjectInliner::inline([
|
||||
new RemoveFuncCall('ini_get', [
|
||||
0 => ['y2k_compliance', 'safe_mode', 'magic_quotes_runtime'],
|
||||
]),
|
||||
new RemoveFuncCall('ini_set', [
|
||||
0 => ['y2k_compliance', 'safe_mode', 'magic_quotes_runtime'],
|
||||
]),
|
||||
->configure([
|
||||
new RemoveFuncCall('ini_get', [
|
||||
0 => ['y2k_compliance', 'safe_mode', 'magic_quotes_runtime'],
|
||||
]),
|
||||
]]);
|
||||
new RemoveFuncCall('ini_set', [
|
||||
0 => ['y2k_compliance', 'safe_mode', 'magic_quotes_runtime'],
|
||||
]),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,22 +8,14 @@ use Rector\Renaming\ValueObject\RenameClassConstFetch;
|
|||
use Rector\Tests\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector\Source\DifferentClass;
|
||||
use Rector\Tests\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector\Source\LocalFormEvents;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameClassConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassConstFetchRector::CLASS_CONSTANT_RENAME => ValueObjectInliner::inline([
|
||||
new RenameClassConstFetch(LocalFormEvents::class, 'PRE_BIND', 'PRE_SUBMIT'),
|
||||
new RenameClassConstFetch(LocalFormEvents::class, 'BIND', 'SUBMIT'),
|
||||
new RenameClassConstFetch(LocalFormEvents::class, 'POST_BIND', 'POST_SUBMIT'),
|
||||
new RenameClassAndConstFetch(
|
||||
LocalFormEvents::class,
|
||||
'OLD_CONSTANT',
|
||||
DifferentClass::class,
|
||||
'NEW_CONSTANT'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new RenameClassConstFetch(LocalFormEvents::class, 'PRE_BIND', 'PRE_SUBMIT'),
|
||||
new RenameClassConstFetch(LocalFormEvents::class, 'BIND', 'SUBMIT'),
|
||||
new RenameClassConstFetch(LocalFormEvents::class, 'POST_BIND', 'POST_SUBMIT'),
|
||||
new RenameClassAndConstFetch(LocalFormEvents::class, 'OLD_CONSTANT', DifferentClass::class, 'NEW_CONSTANT'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameConstantRector::class)
|
||||
->call('configure', [[
|
||||
RenameConstantRector::OLD_TO_NEW_CONSTANTS => [
|
||||
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
|
||||
'OLD_CONSTANT' => 'NEW_CONSTANT',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
|
||||
'OLD_CONSTANT' => 'NEW_CONSTANT',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,18 +5,15 @@ declare(strict_types=1);
|
|||
use Rector\Renaming\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector;
|
||||
use Rector\Renaming\ValueObject\PseudoNamespaceToNamespace;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(PseudoNamespaceToNamespaceRector::class)
|
||||
->call('configure', [[
|
||||
PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES => ValueObjectInliner::inline([
|
||||
new PseudoNamespaceToNamespace('PHPUnit_', ['PHPUnit_Framework_MockObject_MockObject']),
|
||||
new PseudoNamespaceToNamespace('ChangeMe_', ['KeepMe_']),
|
||||
new PseudoNamespaceToNamespace(
|
||||
'Rector_Tests_Renaming_Rector_FileWithoutNamespace_PseudoNamespaceToNamespaceRector_Fixture_'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new PseudoNamespaceToNamespace('PHPUnit_', ['PHPUnit_Framework_MockObject_MockObject']),
|
||||
new PseudoNamespaceToNamespace('ChangeMe_', ['KeepMe_']),
|
||||
new PseudoNamespaceToNamespace(
|
||||
'Rector_Tests_Renaming_Rector_FileWithoutNamespace_PseudoNamespaceToNamespaceRector_Fixture_'
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -12,9 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'service' => 'Symfony\Component\DependencyInjection\Loader\Configurator\service',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'service' => 'Symfony\Component\DependencyInjection\Loader\Configurator\service',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'view' => 'Laravel\Templating\render',
|
||||
'sprintf' => 'Safe\sprintf',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'view' => 'Laravel\Templating\render',
|
||||
'sprintf' => 'Safe\sprintf',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -10,20 +10,17 @@ use Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source\CustomType
|
|||
use Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source\Foo;
|
||||
use Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source\SomeSubscriber;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename(AbstractType::class, 'setDefaultOptions', 'configureOptions'),
|
||||
new MethodCallRename('Nette\Utils\Html', 'add', 'addHtml'),
|
||||
new MethodCallRename(CustomType::class, 'notify', '__invoke'),
|
||||
new MethodCallRename(SomeSubscriber::class, 'old', 'new'),
|
||||
new MethodCallRename(Foo::class, 'old', 'new'),
|
||||
// with array key
|
||||
new MethodCallRenameWithArrayKey('Nette\Utils\Html', 'addToArray', 'addToHtmlArray', 'hey'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new MethodCallRename(AbstractType::class, 'setDefaultOptions', 'configureOptions'),
|
||||
new MethodCallRename('Nette\Utils\Html', 'add', 'addHtml'),
|
||||
new MethodCallRename(CustomType::class, 'notify', '__invoke'),
|
||||
new MethodCallRename(SomeSubscriber::class, 'old', 'new'),
|
||||
new MethodCallRename(Foo::class, 'old', 'new'),
|
||||
// with array key
|
||||
new MethodCallRenameWithArrayKey('Nette\Utils\Html', 'addToArray', 'addToHtmlArray', 'hey'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -16,10 +16,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
OldClass::class => NewClass::class,
|
||||
SomeServiceClassFirstNamespace::class => SomeServiceClass::class,
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
OldClass::class => NewClass::class,
|
||||
SomeServiceClassFirstNamespace::class => SomeServiceClass::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@ use Rector\Renaming\ValueObject\MethodCallRename;
|
|||
use Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\NewClassWithNewMethod;
|
||||
use Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\OldClassWithMethod;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
@ -17,16 +16,10 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
OldClassWithMethod::class => NewClassWithNewMethod::class,
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
OldClassWithMethod::class => NewClassWithNewMethod::class,
|
||||
]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename(NewClassWithNewMethod::class, 'someMethod', 'someNewMethod'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new MethodCallRename(NewClassWithNewMethod::class, 'someMethod', 'someNewMethod')]);
|
||||
};
|
||||
|
|
|
@ -9,10 +9,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'ThisClassDoesNotExistAnymore' => 'NewClassThatDoesNotExistEither',
|
||||
'App\NotHereClass\AndNamespace' => 'NewClassThatDoesNotExistEither',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'ThisClassDoesNotExistAnymore' => 'NewClassThatDoesNotExistEither',
|
||||
'App\NotHereClass\AndNamespace' => 'NewClassThatDoesNotExistEither',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,13 +8,11 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameNamespaceRector::class)
|
||||
->call('configure', [[
|
||||
RenameNamespaceRector::OLD_TO_NEW_NAMESPACES => [
|
||||
'OldNamespace' => 'NewNamespace',
|
||||
'OldNamespaceWith\OldSplitNamespace' => 'NewNamespaceWith\NewSplitNamespace',
|
||||
'Old\Long\AnyNamespace' => 'Short\AnyNamespace',
|
||||
'PHPUnit_Framework_' => 'PHPUnit\Framework\\',
|
||||
'Foo\Bar' => 'Foo\Tmp',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'OldNamespace' => 'NewNamespace',
|
||||
'OldNamespaceWith\OldSplitNamespace' => 'NewNamespaceWith\NewSplitNamespace',
|
||||
'Old\Long\AnyNamespace' => 'Short\AnyNamespace',
|
||||
'PHPUnit_Framework_' => 'PHPUnit\Framework\\',
|
||||
'Foo\Bar' => 'Foo\Tmp',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,37 +6,34 @@ use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
|
|||
use Rector\Renaming\ValueObject\RenameProperty;
|
||||
use Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Source\ClassWithProperties;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenamePropertyRector::class)
|
||||
->call('configure', [[
|
||||
RenamePropertyRector::RENAMED_PROPERTIES => ValueObjectInliner::inline([
|
||||
->configure([
|
||||
|
||||
new RenameProperty(ClassWithProperties::class, 'oldProperty', 'newProperty'),
|
||||
new RenameProperty(ClassWithProperties::class, 'anotherOldProperty', 'anotherNewProperty'),
|
||||
new RenameProperty(ClassWithProperties::class, 'oldProperty', 'newProperty'),
|
||||
new RenameProperty(ClassWithProperties::class, 'anotherOldProperty', 'anotherNewProperty'),
|
||||
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Fixture\ClassWithOldProperty',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Fixture\ClassWithOldProperty2',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Fixture\DoNotChangeToPropertyExists',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Source\ParentClassWithOldProperty',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Fixture\ClassWithOldProperty',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Fixture\ClassWithOldProperty2',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Fixture\DoNotChangeToPropertyExists',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
new RenameProperty(
|
||||
'Rector\Tests\Renaming\Rector\PropertyFetch\RenamePropertyRector\Source\ParentClassWithOldProperty',
|
||||
'oldProperty',
|
||||
'newProperty'
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,22 +7,19 @@ use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector;
|
|||
use Rector\Renaming\ValueObject\RenameStaticMethod;
|
||||
use Rector\Tests\Renaming\Rector\StaticCall\RenameStaticMethodRector\Source\FormMacros;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameStaticMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => ValueObjectInliner::inline([
|
||||
->configure([
|
||||
|
||||
new RenameStaticMethod(Html::class, 'add', Html::class, 'addHtml'),
|
||||
new RenameStaticMethod(
|
||||
FormMacros::class,
|
||||
'renderFormBegin',
|
||||
'Nette\Bridges\FormsLatte\Runtime',
|
||||
'renderFormBegin'
|
||||
),
|
||||
new RenameStaticMethod(Html::class, 'add', Html::class, 'addHtml'),
|
||||
new RenameStaticMethod(
|
||||
FormMacros::class,
|
||||
'renderFormBegin',
|
||||
'Nette\Bridges\FormsLatte\Runtime',
|
||||
'renderFormBegin'
|
||||
),
|
||||
|
||||
]),
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,9 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(RenameStringRector::class)
|
||||
->call('configure', [[
|
||||
RenameStringRector::STRING_CHANGES => [
|
||||
'ROLE_PREVIOUS_ADMIN' => 'IS_IMPERSONATOR',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'ROLE_PREVIOUS_ADMIN' => 'IS_IMPERSONATOR',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,17 +5,9 @@ declare(strict_types=1);
|
|||
use Rector\Restoration\Rector\Namespace_\CompleteImportForPartialAnnotationRector;
|
||||
use Rector\Restoration\ValueObject\CompleteImportForPartialAnnotation;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(CompleteImportForPartialAnnotationRector::class)
|
||||
->call(
|
||||
'configure',
|
||||
[[
|
||||
CompleteImportForPartialAnnotationRector::USE_IMPORTS_TO_RESTORE => ValueObjectInliner::inline([
|
||||
new CompleteImportForPartialAnnotation('Doctrine\ORM\Mapping', 'ORM'),
|
||||
]),
|
||||
]]
|
||||
);
|
||||
->configure([new CompleteImportForPartialAnnotation('Doctrine\ORM\Mapping', 'ORM')]);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(BooleanInBooleanNotRuleFixerRector::class)
|
||||
->call('configure', [[
|
||||
->configure([
|
||||
BooleanInBooleanNotRuleFixerRector::TREAT_AS_NON_EMPTY => true,
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,14 +7,9 @@ use Rector\Tests\Transform\Rector\Assign\DimFetchAssignToMethodCallRector\Source
|
|||
use Rector\Transform\Rector\Assign\DimFetchAssignToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\DimFetchAssignToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DimFetchAssignToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
DimFetchAssignToMethodCallRector::DIM_FETCH_ASSIGN_TO_METHOD_CALL => ValueObjectInliner::inline([
|
||||
new DimFetchAssignToMethodCall(SomeRouteList::class, SomeRoute::class, 'addRoute'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new DimFetchAssignToMethodCall(SomeRouteList::class, SomeRoute::class, 'addRoute')]);
|
||||
};
|
||||
|
|
|
@ -7,15 +7,12 @@ use Rector\Tests\Transform\Rector\Assign\GetAndSetToMethodCallRector\Source\Some
|
|||
use Rector\Transform\Rector\Assign\GetAndSetToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\GetAndSetToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(GetAndSetToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
GetAndSetToMethodCallRector::TYPE_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new GetAndSetToMethodCall(SomeContainer::class, 'getService', 'addService'),
|
||||
new GetAndSetToMethodCall(Klarka::class, 'get', 'set'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new GetAndSetToMethodCall(SomeContainer::class, 'getService', 'addService'),
|
||||
new GetAndSetToMethodCall(Klarka::class, 'get', 'set'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,14 +6,11 @@ use Rector\Tests\Transform\Rector\Assign\PropertyAssignToMethodCallRector\Source
|
|||
use Rector\Transform\Rector\Assign\PropertyAssignToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\PropertyAssignToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(PropertyAssignToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
PropertyAssignToMethodCallRector::PROPERTY_ASSIGNS_TO_METHODS_CALLS => ValueObjectInliner::inline([
|
||||
new PropertyAssignToMethodCall(ChoiceControl::class, 'checkAllowedValues', 'checkDefaultValue'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new PropertyAssignToMethodCall(ChoiceControl::class, 'checkAllowedValues', 'checkDefaultValue'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,25 +7,20 @@ use Rector\Tests\Transform\Rector\Assign\PropertyFetchToMethodCallRector\Source\
|
|||
use Rector\Transform\Rector\Assign\PropertyFetchToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(PropertyFetchToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
PropertyFetchToMethodCallRector::PROPERTIES_TO_METHOD_CALLS => ValueObjectInliner::inline(
|
||||
[
|
||||
->configure([
|
||||
|
||||
new PropertyFetchToMethodCall(Translator::class, 'locale', 'getLocale', 'setLocale'),
|
||||
new PropertyFetchToMethodCall(Generator::class, 'word', 'word'),
|
||||
new PropertyFetchToMethodCall(
|
||||
'Rector\Tests\Transform\Rector\Assign\PropertyFetchToMethodCallRector\Fixture\Fixture2',
|
||||
'parameter',
|
||||
'getConfig',
|
||||
null,
|
||||
['parameter']
|
||||
),
|
||||
]
|
||||
new PropertyFetchToMethodCall(Translator::class, 'locale', 'getLocale', 'setLocale'),
|
||||
new PropertyFetchToMethodCall(Generator::class, 'word', 'word'),
|
||||
new PropertyFetchToMethodCall(
|
||||
'Rector\Tests\Transform\Rector\Assign\PropertyFetchToMethodCallRector\Fixture\Fixture2',
|
||||
'parameter',
|
||||
'getConfig',
|
||||
null,
|
||||
['parameter']
|
||||
),
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,16 +5,13 @@ declare(strict_types=1);
|
|||
use Rector\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector;
|
||||
use Rector\Transform\ValueObject\AttributeKeyToClassConstFetch;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AttributeKeyToClassConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
AttributeKeyToClassConstFetchRector::ATTRIBUTE_KEYS_TO_CLASS_CONST_FETCHES => ValueObjectInliner::inline([
|
||||
new AttributeKeyToClassConstFetch('Doctrine\ORM\Mapping\Column', 'type', 'Doctrine\DBAL\Types\Types', [
|
||||
'string' => 'STRING',
|
||||
]),
|
||||
->configure([
|
||||
new AttributeKeyToClassConstFetch('Doctrine\ORM\Mapping\Column', 'type', 'Doctrine\DBAL\Types\Types', [
|
||||
'string' => 'STRING',
|
||||
]),
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,16 +6,9 @@ use Rector\Tests\Transform\Rector\ClassMethod\SingleToManyMethodRector\Source\On
|
|||
use Rector\Transform\Rector\ClassMethod\SingleToManyMethodRector;
|
||||
use Rector\Transform\ValueObject\SingleToManyMethod;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(SingleToManyMethodRector::class)
|
||||
->call('configure', [[
|
||||
SingleToManyMethodRector::SINGLES_TO_MANY_METHODS => ValueObjectInliner::inline([
|
||||
|
||||
new SingleToManyMethod(OneToManyInterface::class, 'getNode', 'getNodes'),
|
||||
|
||||
]),
|
||||
]]);
|
||||
->configure([new SingleToManyMethod(OneToManyInterface::class, 'getNode', 'getNodes')]);
|
||||
};
|
||||
|
|
|
@ -6,14 +6,9 @@ use Rector\Tests\Transform\Rector\ClassMethod\WrapReturnRector\Source\SomeReturn
|
|||
use Rector\Transform\Rector\ClassMethod\WrapReturnRector;
|
||||
use Rector\Transform\ValueObject\WrapReturn;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(WrapReturnRector::class)
|
||||
->call('configure', [[
|
||||
WrapReturnRector::TYPE_METHOD_WRAPS => ValueObjectInliner::inline([
|
||||
new WrapReturn(SomeReturnClass::class, 'getItem', true),
|
||||
]),
|
||||
]]);
|
||||
->configure([new WrapReturn(SomeReturnClass::class, 'getItem', true)]);
|
||||
};
|
||||
|
|
|
@ -10,9 +10,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AddInterfaceByTraitRector::class)
|
||||
->call('configure', [[
|
||||
AddInterfaceByTraitRector::INTERFACE_BY_TRAIT => [
|
||||
SomeTrait::class => SomeInterface::class,
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
SomeTrait::class => SomeInterface::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -10,9 +10,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(MergeInterfacesRector::class)
|
||||
->call('configure', [[
|
||||
MergeInterfacesRector::OLD_TO_NEW_INTERFACES => [
|
||||
SomeOldInterface::class => SomeInterface::class,
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
SomeOldInterface::class => SomeInterface::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -9,15 +9,12 @@ use Rector\Tests\Transform\Rector\Class_\ParentClassToTraitsRector\Source\SomeTr
|
|||
use Rector\Transform\Rector\Class_\ParentClassToTraitsRector;
|
||||
use Rector\Transform\ValueObject\ParentClassToTraits;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ParentClassToTraitsRector::class)
|
||||
->call('configure', [[
|
||||
ParentClassToTraitsRector::PARENT_CLASS_TO_TRAITS => ValueObjectInliner::inline([
|
||||
new ParentClassToTraits(ParentObject::class, [SomeTrait::class]),
|
||||
new ParentClassToTraits(AnotherParentObject::class, [SomeTrait::class, SecondTrait::class]),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ParentClassToTraits(ParentObject::class, [SomeTrait::class]),
|
||||
new ParentClassToTraits(AnotherParentObject::class, [SomeTrait::class, SecondTrait::class]),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,21 +6,18 @@ use Rector\Transform\Rector\FuncCall\ArgumentFuncCallToMethodCallRector;
|
|||
use Rector\Transform\ValueObject\ArgumentFuncCallToMethodCall;
|
||||
use Rector\Transform\ValueObject\ArrayFuncCallToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ArgumentFuncCallToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentFuncCallToMethodCallRector::FUNCTIONS_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new ArgumentFuncCallToMethodCall('view', 'Illuminate\Contracts\View\Factory', 'make'),
|
||||
new ArgumentFuncCallToMethodCall('route', 'Illuminate\Routing\UrlGenerator', 'route'),
|
||||
new ArgumentFuncCallToMethodCall('back', 'Illuminate\Routing\Redirector', 'back', 'back'),
|
||||
new ArgumentFuncCallToMethodCall('broadcast', 'Illuminate\Contracts\Broadcasting\Factory', 'event'),
|
||||
]),
|
||||
ArgumentFuncCallToMethodCallRector::ARRAY_FUNCTIONS_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new ArrayFuncCallToMethodCall('config', 'Illuminate\Contracts\Config\Repository', 'set', 'get'),
|
||||
new ArrayFuncCallToMethodCall('session', 'Illuminate\Session\SessionManager', 'put', 'get'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new ArgumentFuncCallToMethodCall('view', 'Illuminate\Contracts\View\Factory', 'make'),
|
||||
new ArgumentFuncCallToMethodCall('route', 'Illuminate\Routing\UrlGenerator', 'route'),
|
||||
new ArgumentFuncCallToMethodCall('back', 'Illuminate\Routing\Redirector', 'back', 'back'),
|
||||
new ArgumentFuncCallToMethodCall('broadcast', 'Illuminate\Contracts\Broadcasting\Factory', 'event'),
|
||||
|
||||
new ArrayFuncCallToMethodCall('config', 'Illuminate\Contracts\Config\Repository', 'set', 'get'),
|
||||
new ArrayFuncCallToMethodCall('session', 'Illuminate\Session\SessionManager', 'put', 'get'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -8,10 +8,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(FuncCallToConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
FuncCallToConstFetchRector::FUNCTIONS_TO_CONSTANTS => [
|
||||
'php_sapi_name' => 'PHP_SAPI',
|
||||
'pi' => 'M_PI',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'php_sapi_name' => 'PHP_SAPI',
|
||||
'pi' => 'M_PI',
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,23 +6,20 @@ use Rector\Tests\Transform\Rector\FuncCall\FuncCallToMethodCallRector\Source\Som
|
|||
use Rector\Transform\Rector\FuncCall\FuncCallToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\FuncCallToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(FuncCallToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
FuncCallToMethodCallRector::FUNC_CALL_TO_CLASS_METHOD_CALL => ValueObjectInliner::inline([
|
||||
new FuncCallToMethodCall('view', 'Namespaced\SomeRenderer', 'render'),
|
||||
->configure([
|
||||
new FuncCallToMethodCall('view', 'Namespaced\SomeRenderer', 'render'),
|
||||
|
||||
new FuncCallToMethodCall('translate', SomeTranslator::class, 'translateMethod'),
|
||||
new FuncCallToMethodCall('translate', SomeTranslator::class, 'translateMethod'),
|
||||
|
||||
new FuncCallToMethodCall(
|
||||
'Rector\Tests\Transform\Rector\Function_\FuncCallToMethodCallRector\Source\some_view_function',
|
||||
'Namespaced\SomeRenderer',
|
||||
'render'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
new FuncCallToMethodCall(
|
||||
'Rector\Tests\Transform\Rector\Function_\FuncCallToMethodCallRector\Source\some_view_function',
|
||||
'Namespaced\SomeRenderer',
|
||||
'render'
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -5,15 +5,12 @@ declare(strict_types=1);
|
|||
use Rector\Transform\Rector\FuncCall\FuncCallToStaticCallRector;
|
||||
use Rector\Transform\ValueObject\FuncCallToStaticCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(FuncCallToStaticCallRector::class)
|
||||
->call('configure', [[
|
||||
FuncCallToStaticCallRector::FUNC_CALLS_TO_STATIC_CALLS => ValueObjectInliner::inline([
|
||||
new FuncCallToStaticCall('view', 'SomeStaticClass', 'render'),
|
||||
new FuncCallToStaticCall('SomeNamespaced\view', 'AnotherStaticClass', 'render'),
|
||||
]),
|
||||
]]);
|
||||
->configure([
|
||||
new FuncCallToStaticCall('view', 'SomeStaticClass', 'render'),
|
||||
new FuncCallToStaticCall('SomeNamespaced\view', 'AnotherStaticClass', 'render'),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -6,14 +6,9 @@ use Rector\Tests\Transform\Rector\Isset_\UnsetAndIssetToMethodCallRector\Source\
|
|||
use Rector\Transform\Rector\Isset_\UnsetAndIssetToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\UnsetAndIssetToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(UnsetAndIssetToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
UnsetAndIssetToMethodCallRector::ISSET_UNSET_TO_METHOD_CALL => ValueObjectInliner::inline([
|
||||
new UnsetAndIssetToMethodCall(LocalContainer::class, 'hasService', 'removeService'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new UnsetAndIssetToMethodCall(LocalContainer::class, 'hasService', 'removeService')]);
|
||||
};
|
||||
|
|
|
@ -6,14 +6,9 @@ use Rector\Tests\Transform\Rector\MethodCall\CallableInMethodCallToVariableRecto
|
|||
use Rector\Transform\Rector\MethodCall\CallableInMethodCallToVariableRector;
|
||||
use Rector\Transform\ValueObject\CallableInMethodCallToVariable;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(CallableInMethodCallToVariableRector::class)
|
||||
->call('configure', [[
|
||||
CallableInMethodCallToVariableRector::CALLABLE_IN_METHOD_CALL_TO_VARIABLE => ValueObjectInliner::inline([
|
||||
new CallableInMethodCallToVariable(DummyCache::class, 'save', 1),
|
||||
]),
|
||||
]]);
|
||||
->configure([new CallableInMethodCallToVariable(DummyCache::class, 'save', 1)]);
|
||||
};
|
||||
|
|
|
@ -6,22 +6,17 @@ use Rector\Tests\Transform\Rector\MethodCall\MethodCallToAnotherMethodCallWithAr
|
|||
use Rector\Transform\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector;
|
||||
use Rector\Transform\ValueObject\MethodCallToAnotherMethodCallWithArguments;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$configuration = ValueObjectInliner::inline([
|
||||
new MethodCallToAnotherMethodCallWithArguments(
|
||||
NetteServiceDefinition::class,
|
||||
'setInject',
|
||||
'addTag',
|
||||
['inject']
|
||||
),
|
||||
]);
|
||||
|
||||
$services->set(MethodCallToAnotherMethodCallWithArgumentsRector::class)
|
||||
->call('configure', [[
|
||||
MethodCallToAnotherMethodCallWithArgumentsRector::METHOD_CALL_RENAMES_WITH_ADDED_ARGUMENTS => $configuration,
|
||||
]]);
|
||||
->configure([
|
||||
new MethodCallToAnotherMethodCallWithArguments(
|
||||
NetteServiceDefinition::class,
|
||||
'setInject',
|
||||
'addTag',
|
||||
['inject']
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -7,14 +7,9 @@ use Rector\Tests\Transform\Rector\MethodCall\MethodCallToMethodCallRector\Source
|
|||
use Rector\Transform\Rector\MethodCall\MethodCallToMethodCallRector;
|
||||
use Rector\Transform\ValueObject\MethodCallToMethodCall;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(MethodCallToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
MethodCallToMethodCallRector::METHOD_CALLS_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new MethodCallToMethodCall(FirstDependency::class, 'go', SecondDependency::class, 'away'),
|
||||
]),
|
||||
]]);
|
||||
->configure([new MethodCallToMethodCall(FirstDependency::class, 'go', SecondDependency::class, 'away')]);
|
||||
};
|
||||
|
|
|
@ -8,9 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(MethodCallToPropertyFetchRector::class)
|
||||
->call('configure', [[
|
||||
MethodCallToPropertyFetchRector::METHOD_CALL_TO_PROPERTY_FETCHES => [
|
||||
'getEntityManager' => 'entityManager',
|
||||
],
|
||||
]]);
|
||||
->configure([
|
||||
'getEntityManager' => 'entityManager',
|
||||
]);
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user