Skip to content

Commit

Permalink
Updated Rector to commit fb05cf0557a2d8e73386d461aa9fbadd931d1ee1
Browse files Browse the repository at this point in the history
rectorphp/rector-src@fb05cf0 [DX] Add withDowngradeSets() to better target downgrades (#6015)
  • Loading branch information
TomasVotruba committed Jun 23, 2024
1 parent 45b5cef commit f38e318
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '461fd66ef53130599155236b83bf16be1616d15b';
public const PACKAGE_VERSION = 'fb05cf0557a2d8e73386d461aa9fbadd931d1ee1';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-06-23 10:06:57';
public const RELEASE_DATE = '2024-06-23 04:31:10';
/**
* @var int
*/
Expand Down
30 changes: 30 additions & 0 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Rector\Set\Contract\SetProviderInterface;
use Rector\Set\Enum\SetGroup;
use Rector\Set\SetManager;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\FOSRestSetList;
Expand Down Expand Up @@ -726,4 +727,33 @@ public function registerService(string $className, ?string $alias = null, ?strin
$this->registerServices[] = new RegisteredService($className, $alias, $tag);
return $this;
}
public function withDowngradeSets(bool $php82 = \false, bool $php81 = \false, bool $php80 = \false, bool $php74 = \false, bool $php73 = \false, bool $php72 = \false, bool $php71 = \false) : self
{
$pickedArguments = \array_filter(\func_get_args());
if (\count($pickedArguments) !== 1) {
throw new InvalidConfigurationException('Pick only one PHP version target in "withDowngradeSets()". All rules down to this version will be used.');
}
if ($php82) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_82;
}
if ($php81) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_81;
}
if ($php80) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_80;
}
if ($php74) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_74;
}
if ($php73) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_73;
}
if ($php72) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_72;
}
if ($php71) {
$this->sets[] = DowngradeLevelSetList::DOWN_TO_PHP_71;
}
return $this;
}
}
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1869,12 +1869,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "9e6b97592cd6888b873b4240d77369011f639a8e"
"reference": "10b011df707ee0d625f8a9b74e5c872d84bd37c1"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/9e6b97592cd6888b873b4240d77369011f639a8e",
"reference": "9e6b97592cd6888b873b4240d77369011f639a8e",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/10b011df707ee0d625f8a9b74e5c872d84bd37c1",
"reference": "10b011df707ee0d625f8a9b74e5c872d84bd37c1",
"shasum": ""
},
"require": {
Expand Down Expand Up @@ -1904,7 +1904,7 @@
"tomasvotruba\/class-leak": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2024-06-23T01:01:11+00:00",
"time": "2024-06-23T02:26:32+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c3c91df'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main a16ded4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main eff5d58'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 9e6b975'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c3c91df'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main a16ded4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main eff5d58'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 10b011d'));
private function __construct()
{
}
Expand Down
17 changes: 17 additions & 0 deletions vendor/rector/rector-symfony/config/sets/symfony/symfony70.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,27 @@
namespace RectorPrefix202406;

use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Php80\ValueObject\AnnotationToAttribute;
use Rector\Renaming\Rector\Class_\RenameAttributeRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Rector\Renaming\ValueObject\RenameAttribute;
// @see https://github.com/symfony/symfony/blob/7.0/UPGRADE-7.0.md
return static function (RectorConfig $rectorConfig) : void {
// @see https://github.com/symfony/symfony/blob/7.0/UPGRADE-7.0.md#dependencyinjection
$rectorConfig->ruleWithConfiguration(RenameAttributeRector::class, [new RenameAttribute('Symfony\\Component\\DependencyInjection\\Attribute\\MapDecorated', 'Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated')]);
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
// @see https://github.com/symfony/symfony/blob/7.0/UPGRADE-7.0.md#frameworkbundle
'Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer' => 'Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface',
'Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer' => 'Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface',
// @see https://github.com/symfony/symfony/blob/7.0/UPGRADE-7.0.md#httpfoundation
'Symfony\\Component\\HttpFoundation\\RequestMatcher' => 'Symfony\\Component\\HttpFoundation\\ChainRequestMatcher',
'Symfony\\Component\\HttpFoundation\\ExpressionRequestMatcher' => 'Symfony\\Component\\HttpFoundation\\RequestMatcher\\ExpressionRequestMatcher',
]);
// @see https://github.com/symfony/symfony/pull/50826
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('Symfony\\Component\\HttpFoundation\\Request', 'getContentType', 'getContentTypeFormat')]);
// the "@required" was dropped, use attribute instead
$rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [new AnnotationToAttribute('required', 'Symfony\\Contracts\\Service\\Attribute\\Required')]);
};
10 changes: 6 additions & 4 deletions vendor/rector/rector-symfony/config/sets/symfony/symfony71.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\Class_\RenameAttributeRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Rector\Renaming\ValueObject\RenameAttribute;
// @see https://github.com/symfony/symfony/blob/7.1/UPGRADE-7.1.md
return static function (RectorConfig $rectorConfig) : void {
// @see https://github.com/symfony/symfony/blob/7.1/UPGRADE-7.1.md#dependencyinjection
$rectorConfig->ruleWithConfiguration(RenameAttributeRector::class, [new RenameAttribute('Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator', 'Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator'), new RenameAttribute('Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator', 'Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator')]);
};
return RectorConfig::configure()->withConfiguredRule(RenameAttributeRector::class, [new RenameAttribute('Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator', 'Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator'), new RenameAttribute('Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator', 'Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator')])->withConfiguredRule(RenameMethodRector::class, [
// typo fix
new MethodCallRename('̈́Symfony\\Component\\Serializer\\Context\\Normalizer\\AbstractNormalizerContextBuilder', 'withDefaultContructorArguments', 'withDefaultConstructorArguments'),
]);

0 comments on commit f38e318

Please sign in to comment.