mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-28 13:43:31 +00:00
Updated Rector to commit 715561ce71380357545db851fd44ad8b55948b6d
715561ce71
Introduces AddSensitiveParameterAttributeRector rule (#4342)
This commit is contained in:
parent
b30224c249
commit
4bb7391372
|
@ -1,4 +1,4 @@
|
||||||
# 368 Rules Overview
|
# 369 Rules Overview
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
- [Php81](#php81) (11)
|
- [Php81](#php81) (11)
|
||||||
|
|
||||||
- [Php82](#php82) (3)
|
- [Php82](#php82) (4)
|
||||||
|
|
||||||
- [Privatization](#privatization) (4)
|
- [Privatization](#privatization) (4)
|
||||||
|
|
||||||
|
@ -5734,6 +5734,45 @@ Refactor Spatie enum method calls
|
||||||
|
|
||||||
## Php82
|
## Php82
|
||||||
|
|
||||||
|
### AddSensitiveParameterAttributeRector
|
||||||
|
|
||||||
|
Add SensitiveParameter attribute to method and function configured parameters
|
||||||
|
|
||||||
|
:wrench: **configure it!**
|
||||||
|
|
||||||
|
- class: [`Rector\Php82\Rector\Param\AddSensitiveParameterAttributeRector`](../rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php)
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Rector\Config\RectorConfig;
|
||||||
|
use Rector\Php82\Rector\Param\AddSensitiveParameterAttributeRector;
|
||||||
|
|
||||||
|
return static function (RectorConfig $rectorConfig): void {
|
||||||
|
$rectorConfig->ruleWithConfiguration(AddSensitiveParameterAttributeRector::class, [
|
||||||
|
AddSensitiveParameterAttributeRector::SENSITIVE_PARAMETERS => [
|
||||||
|
'password',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
↓
|
||||||
|
|
||||||
|
```diff
|
||||||
|
class SomeClass
|
||||||
|
{
|
||||||
|
- public function run(string $password)
|
||||||
|
+ public function run(#[\SensitiveParameter] string $password)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### FilesystemIteratorSkipDotsRector
|
### FilesystemIteratorSkipDotsRector
|
||||||
|
|
||||||
Prior PHP 8.2 FilesystemIterator::SKIP_DOTS was always set and could not be removed, therefore FilesystemIterator::SKIP_DOTS is added in order to keep this behaviour.
|
Prior PHP 8.2 FilesystemIterator::SKIP_DOTS was always set and could not be removed, therefore FilesystemIterator::SKIP_DOTS is added in order to keep this behaviour.
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare (strict_types=1);
|
||||||
|
namespace Rector\Php82\Rector\Param;
|
||||||
|
|
||||||
|
use PhpParser\Node;
|
||||||
|
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||||
|
use Rector\Core\Rector\AbstractRector;
|
||||||
|
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||||
|
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
|
||||||
|
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||||
|
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||||
|
use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||||
|
/**
|
||||||
|
* @see \Rector\Tests\Php82\Rector\Param\AddSensitiveParameterAttributeRector\AddSensitiveParameterAttributeRectorTest
|
||||||
|
*/
|
||||||
|
class AddSensitiveParameterAttributeRector extends AbstractRector implements ConfigurableRectorInterface, MinPhpVersionInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer
|
||||||
|
*/
|
||||||
|
protected $phpAttributeAnalyzer;
|
||||||
|
public const SENSITIVE_PARAMETERS = 'sensitive_parameters';
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private $sensitiveParameters;
|
||||||
|
public function __construct(PhpAttributeAnalyzer $phpAttributeAnalyzer)
|
||||||
|
{
|
||||||
|
$this->phpAttributeAnalyzer = $phpAttributeAnalyzer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param mixed[] $configuration
|
||||||
|
*/
|
||||||
|
public function configure(array $configuration) : void
|
||||||
|
{
|
||||||
|
Assert::allString($configuration[self::SENSITIVE_PARAMETERS] ?? []);
|
||||||
|
$this->sensitiveParameters = (array) ($configuration[self::SENSITIVE_PARAMETERS] ?? []);
|
||||||
|
}
|
||||||
|
public function getNodeTypes() : array
|
||||||
|
{
|
||||||
|
return [Node\Param::class];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param Node\Param $node
|
||||||
|
*/
|
||||||
|
public function refactor(Node $node) : ?Node\Param
|
||||||
|
{
|
||||||
|
if (!$this->isNames($node, $this->sensitiveParameters)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ($this->phpAttributeAnalyzer->hasPhpAttribute($node, 'SensitiveParameter')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$node->attrGroups[] = new Node\AttributeGroup([new Node\Attribute(new Node\Name\FullyQualified('SensitiveParameter'))]);
|
||||||
|
return $node;
|
||||||
|
}
|
||||||
|
public function getRuleDefinition() : RuleDefinition
|
||||||
|
{
|
||||||
|
return new RuleDefinition('Add SensitiveParameter attribute to method and function configured parameters', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample(<<<'CODE_SAMPLE'
|
||||||
|
class SomeClass
|
||||||
|
{
|
||||||
|
public function run(string $password)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CODE_SAMPLE
|
||||||
|
, <<<'CODE_SAMPLE'
|
||||||
|
class SomeClass
|
||||||
|
{
|
||||||
|
public function run(#[\SensitiveParameter] string $password)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CODE_SAMPLE
|
||||||
|
, [self::SENSITIVE_PARAMETERS => ['password']])]);
|
||||||
|
}
|
||||||
|
public function provideMinPhpVersion() : int
|
||||||
|
{
|
||||||
|
return PhpVersionFeature::SENSITIVE_PARAMETER_ATTRIBUTE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'd50368339398499bb767e80634a4987577c44df5';
|
public const PACKAGE_VERSION = '715561ce71380357545db851fd44ad8b55948b6d';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-06-26 18:03:06';
|
public const RELEASE_DATE = '2023-06-26 19:51:49';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -508,4 +508,9 @@ final class PhpVersionFeature
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public const NULL_FALSE_TRUE_STANDALONE_TYPE = \Rector\Core\ValueObject\PhpVersion::PHP_82;
|
public const NULL_FALSE_TRUE_STANDALONE_TYPE = \Rector\Core\ValueObject\PhpVersion::PHP_82;
|
||||||
|
/**
|
||||||
|
* @see https://wiki.php.net/rfc/redact_parameters_in_back_traces
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public const SENSITIVE_PARAMETER_ATTRIBUTE = \Rector\Core\ValueObject\PhpVersion::PHP_82;
|
||||||
}
|
}
|
||||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit207444d1cfc1ae91e835bdbfc5c542cb::getLoader();
|
return ComposerAutoloaderInit2850f5fba6be0c35b9db1bcbf577cf41::getLoader();
|
||||||
|
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
|
@ -2344,6 +2344,7 @@ return array(
|
||||||
'Rector\\Php82\\Rector\\Class_\\ReadOnlyClassRector' => $baseDir . '/rules/Php82/Rector/Class_/ReadOnlyClassRector.php',
|
'Rector\\Php82\\Rector\\Class_\\ReadOnlyClassRector' => $baseDir . '/rules/Php82/Rector/Class_/ReadOnlyClassRector.php',
|
||||||
'Rector\\Php82\\Rector\\FuncCall\\Utf8DecodeEncodeToMbConvertEncodingRector' => $baseDir . '/rules/Php82/Rector/FuncCall/Utf8DecodeEncodeToMbConvertEncodingRector.php',
|
'Rector\\Php82\\Rector\\FuncCall\\Utf8DecodeEncodeToMbConvertEncodingRector' => $baseDir . '/rules/Php82/Rector/FuncCall/Utf8DecodeEncodeToMbConvertEncodingRector.php',
|
||||||
'Rector\\Php82\\Rector\\New_\\FilesystemIteratorSkipDotsRector' => $baseDir . '/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php',
|
'Rector\\Php82\\Rector\\New_\\FilesystemIteratorSkipDotsRector' => $baseDir . '/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php',
|
||||||
|
'Rector\\Php82\\Rector\\Param\\AddSensitiveParameterAttributeRector' => $baseDir . '/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php',
|
||||||
'Rector\\PhpAttribute\\AnnotationToAttributeMapper' => $baseDir . '/packages/PhpAttribute/AnnotationToAttributeMapper.php',
|
'Rector\\PhpAttribute\\AnnotationToAttributeMapper' => $baseDir . '/packages/PhpAttribute/AnnotationToAttributeMapper.php',
|
||||||
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayAnnotationToAttributeMapper' => $baseDir . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php',
|
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayAnnotationToAttributeMapper' => $baseDir . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php',
|
||||||
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayItemNodeAnnotationToAttributeMapper' => $baseDir . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php',
|
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayItemNodeAnnotationToAttributeMapper' => $baseDir . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php',
|
||||||
|
@ -2645,6 +2646,7 @@ return array(
|
||||||
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageHandlerInterfaceToAttributeRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php',
|
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageHandlerInterfaceToAttributeRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php',
|
||||||
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageSubscriberInterfaceToAttributeRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php',
|
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageSubscriberInterfaceToAttributeRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php',
|
||||||
'Rector\\Symfony\\Symfony62\\Rector\\MethodCall\\SimplifyFormRenderingRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php',
|
'Rector\\Symfony\\Symfony62\\Rector\\MethodCall\\SimplifyFormRenderingRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php',
|
||||||
|
'Rector\\Symfony\\Symfony63\\Rector\\Class_\\SignalableCommandInterfaceReturnTypeRector' => $vendorDir . '/rector/rector-symfony/rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php',
|
||||||
'Rector\\Symfony\\Twig134\\Rector\\Return_\\SimpleFunctionAndFilterRector' => $vendorDir . '/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php',
|
'Rector\\Symfony\\Twig134\\Rector\\Return_\\SimpleFunctionAndFilterRector' => $vendorDir . '/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php',
|
||||||
'Rector\\Symfony\\TypeAnalyzer\\ArrayUnionResponseTypeAnalyzer' => $vendorDir . '/rector/rector-symfony/src/TypeAnalyzer/ArrayUnionResponseTypeAnalyzer.php',
|
'Rector\\Symfony\\TypeAnalyzer\\ArrayUnionResponseTypeAnalyzer' => $vendorDir . '/rector/rector-symfony/src/TypeAnalyzer/ArrayUnionResponseTypeAnalyzer.php',
|
||||||
'Rector\\Symfony\\TypeAnalyzer\\ContainerAwareAnalyzer' => $vendorDir . '/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php',
|
'Rector\\Symfony\\TypeAnalyzer\\ContainerAwareAnalyzer' => $vendorDir . '/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php',
|
||||||
|
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit207444d1cfc1ae91e835bdbfc5c542cb
|
class ComposerAutoloaderInit2850f5fba6be0c35b9db1bcbf577cf41
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit207444d1cfc1ae91e835bdbfc5c542cb
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit207444d1cfc1ae91e835bdbfc5c542cb', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit2850f5fba6be0c35b9db1bcbf577cf41', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit207444d1cfc1ae91e835bdbfc5c542cb', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit2850f5fba6be0c35b9db1bcbf577cf41', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit2850f5fba6be0c35b9db1bcbf577cf41::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInit2850f5fba6be0c35b9db1bcbf577cf41::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
10
vendor/composer/autoload_static.php
vendored
10
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb
|
class ComposerStaticInit2850f5fba6be0c35b9db1bcbf577cf41
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
|
@ -2596,6 +2596,7 @@ class ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb
|
||||||
'Rector\\Php82\\Rector\\Class_\\ReadOnlyClassRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/Class_/ReadOnlyClassRector.php',
|
'Rector\\Php82\\Rector\\Class_\\ReadOnlyClassRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/Class_/ReadOnlyClassRector.php',
|
||||||
'Rector\\Php82\\Rector\\FuncCall\\Utf8DecodeEncodeToMbConvertEncodingRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/FuncCall/Utf8DecodeEncodeToMbConvertEncodingRector.php',
|
'Rector\\Php82\\Rector\\FuncCall\\Utf8DecodeEncodeToMbConvertEncodingRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/FuncCall/Utf8DecodeEncodeToMbConvertEncodingRector.php',
|
||||||
'Rector\\Php82\\Rector\\New_\\FilesystemIteratorSkipDotsRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php',
|
'Rector\\Php82\\Rector\\New_\\FilesystemIteratorSkipDotsRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php',
|
||||||
|
'Rector\\Php82\\Rector\\Param\\AddSensitiveParameterAttributeRector' => __DIR__ . '/../..' . '/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php',
|
||||||
'Rector\\PhpAttribute\\AnnotationToAttributeMapper' => __DIR__ . '/../..' . '/packages/PhpAttribute/AnnotationToAttributeMapper.php',
|
'Rector\\PhpAttribute\\AnnotationToAttributeMapper' => __DIR__ . '/../..' . '/packages/PhpAttribute/AnnotationToAttributeMapper.php',
|
||||||
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayAnnotationToAttributeMapper' => __DIR__ . '/../..' . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php',
|
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayAnnotationToAttributeMapper' => __DIR__ . '/../..' . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php',
|
||||||
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayItemNodeAnnotationToAttributeMapper' => __DIR__ . '/../..' . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php',
|
'Rector\\PhpAttribute\\AnnotationToAttributeMapper\\ArrayItemNodeAnnotationToAttributeMapper' => __DIR__ . '/../..' . '/packages/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php',
|
||||||
|
@ -2897,6 +2898,7 @@ class ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb
|
||||||
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageHandlerInterfaceToAttributeRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php',
|
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageHandlerInterfaceToAttributeRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php',
|
||||||
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageSubscriberInterfaceToAttributeRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php',
|
'Rector\\Symfony\\Symfony62\\Rector\\Class_\\MessageSubscriberInterfaceToAttributeRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php',
|
||||||
'Rector\\Symfony\\Symfony62\\Rector\\MethodCall\\SimplifyFormRenderingRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php',
|
'Rector\\Symfony\\Symfony62\\Rector\\MethodCall\\SimplifyFormRenderingRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php',
|
||||||
|
'Rector\\Symfony\\Symfony63\\Rector\\Class_\\SignalableCommandInterfaceReturnTypeRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php',
|
||||||
'Rector\\Symfony\\Twig134\\Rector\\Return_\\SimpleFunctionAndFilterRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php',
|
'Rector\\Symfony\\Twig134\\Rector\\Return_\\SimpleFunctionAndFilterRector' => __DIR__ . '/..' . '/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php',
|
||||||
'Rector\\Symfony\\TypeAnalyzer\\ArrayUnionResponseTypeAnalyzer' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeAnalyzer/ArrayUnionResponseTypeAnalyzer.php',
|
'Rector\\Symfony\\TypeAnalyzer\\ArrayUnionResponseTypeAnalyzer' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeAnalyzer/ArrayUnionResponseTypeAnalyzer.php',
|
||||||
'Rector\\Symfony\\TypeAnalyzer\\ContainerAwareAnalyzer' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php',
|
'Rector\\Symfony\\TypeAnalyzer\\ContainerAwareAnalyzer' => __DIR__ . '/..' . '/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php',
|
||||||
|
@ -3096,9 +3098,9 @@ class ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb
|
||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit2850f5fba6be0c35b9db1bcbf577cf41::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit2850f5fba6be0c35b9db1bcbf577cf41::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit207444d1cfc1ae91e835bdbfc5c542cb::$classMap;
|
$loader->classMap = ComposerStaticInit2850f5fba6be0c35b9db1bcbf577cf41::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -2121,12 +2121,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||||
"reference": "2e12a85562fa110257f945259bb14836c8a6374c"
|
"reference": "b5c56cbf2217ddc29be4f9016996b826c0dcc03a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/2e12a85562fa110257f945259bb14836c8a6374c",
|
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/b5c56cbf2217ddc29be4f9016996b826c0dcc03a",
|
||||||
"reference": "2e12a85562fa110257f945259bb14836c8a6374c",
|
"reference": "b5c56cbf2217ddc29be4f9016996b826c0dcc03a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2156,7 +2156,7 @@
|
||||||
"tomasvotruba\/type-coverage": "^0.2",
|
"tomasvotruba\/type-coverage": "^0.2",
|
||||||
"tomasvotruba\/unused-public": "^0.1"
|
"tomasvotruba\/unused-public": "^0.1"
|
||||||
},
|
},
|
||||||
"time": "2023-06-26T13:08:43+00:00",
|
"time": "2023-06-26T18:47:41+00:00",
|
||||||
"default-branch": true,
|
"default-branch": true,
|
||||||
"type": "rector-extension",
|
"type": "rector-extension",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||||
*/
|
*/
|
||||||
final class GeneratedConfig
|
final class GeneratedConfig
|
||||||
{
|
{
|
||||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fc2dbbd'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 06c6448'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c6bf48b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2e12a85'));
|
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fc2dbbd'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 06c6448'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c6bf48b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b5c56cb'));
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
11
vendor/rector/rector-symfony/config/sets/symfony/level/up-to-symfony-63.php
vendored
Normal file
11
vendor/rector/rector-symfony/config/sets/symfony/level/up-to-symfony-63.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare (strict_types=1);
|
||||||
|
namespace RectorPrefix202306;
|
||||||
|
|
||||||
|
use Rector\Config\RectorConfig;
|
||||||
|
use Rector\Symfony\Set\SymfonyLevelSetList;
|
||||||
|
use Rector\Symfony\Set\SymfonySetList;
|
||||||
|
return static function (RectorConfig $rectorConfig) : void {
|
||||||
|
$rectorConfig->sets([SymfonySetList::SYMFONY_63, SymfonyLevelSetList::UP_TO_SYMFONY_62]);
|
||||||
|
};
|
25
vendor/rector/rector-symfony/config/sets/symfony/symfony63.php
vendored
Normal file
25
vendor/rector/rector-symfony/config/sets/symfony/symfony63.php
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare (strict_types=1);
|
||||||
|
namespace RectorPrefix202306;
|
||||||
|
|
||||||
|
use Rector\Config\RectorConfig;
|
||||||
|
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||||
|
use Rector\Symfony\Symfony63\Rector\Class_\SignalableCommandInterfaceReturnTypeRector;
|
||||||
|
// @see https://github.com/symfony/symfony/blob/6.3/UPGRADE-6.3.md
|
||||||
|
// @see \Rector\Symfony\Tests\Set\Symfony63\Symfony63Test
|
||||||
|
return static function (RectorConfig $rectorConfig) : void {
|
||||||
|
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
|
||||||
|
// @see https://github.com/symfony/symfony/commit/b653adf426aedc66d16c5fc1cf71e261f20b9638
|
||||||
|
'Symfony\\Component\\DependencyInjection\\Attribute\\MapDecorated' => 'Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated',
|
||||||
|
// @see https://github.com/symfony/symfony/commit/20ab567385e3812ef661dae01a1fdc5d1bde2666
|
||||||
|
'Http\\Client\\HttpClient' => 'Psr\\Http\\Client\\ClientInterface',
|
||||||
|
// @see https://github.com/symfony/symfony/commit/9415b438b75204c72ff66b838307b73646393cbf
|
||||||
|
'Symfony\\Component\\Messenger\\EventListener\\StopWorkerOnSigtermSignalListener' => 'Symfony\\Component\\Messenger\\EventListener\\StopWorkerOnSignalsListener',
|
||||||
|
// @see https://github.com/symfony/symfony/commit/a7926b2d83f35fe53c41a28d8055490cc1955928
|
||||||
|
'Symfony\\Component\\Messenger\\Transport\\InMemoryTransport' => 'Symfony\\Component\\Messenger\\Transport\\InMemory\\InMemoryTransport',
|
||||||
|
'Symfony\\Component\\Messenger\\Transport\\InMemoryTransportFactory' => 'Symfony\\Component\\Messenger\\Transport\\InMemory\\InMemoryTransportFactory',
|
||||||
|
]);
|
||||||
|
// @see https://github.com/symfony/symfony/commit/1650e3861b5fcd931e5d3eb1dd84bad764020d8e
|
||||||
|
$rectorConfig->rule(SignalableCommandInterfaceReturnTypeRector::class);
|
||||||
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
# 81 Rules Overview
|
# 82 Rules Overview
|
||||||
|
|
||||||
## ActionSuffixRemoverRector
|
## ActionSuffixRemoverRector
|
||||||
|
|
||||||
|
@ -1546,6 +1546,22 @@ Change `$services->set("name_type",` SomeType::class) to bare type, useful since
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
## SignalableCommandInterfaceReturnTypeRector
|
||||||
|
|
||||||
|
Return int or false from `SignalableCommandInterface::handleSignal()` instead of void
|
||||||
|
|
||||||
|
- class: [`Rector\Symfony\Symfony63\Rector\Class_\SignalableCommandInterfaceReturnTypeRector`](../rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php)
|
||||||
|
|
||||||
|
```diff
|
||||||
|
-public function handleSignal(int $signal): void
|
||||||
|
+public function handleSignal(int $signal): int|false
|
||||||
|
{
|
||||||
|
+ return false;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
## SimpleFunctionAndFilterRector
|
## SimpleFunctionAndFilterRector
|
||||||
|
|
||||||
Changes Twig_Function_Method to Twig_SimpleFunction calls in Twig_Extension.
|
Changes Twig_Function_Method to Twig_SimpleFunction calls in Twig_Extension.
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rector\Symfony\Symfony63\Rector\Class_;
|
||||||
|
|
||||||
|
use PhpParser\Node;
|
||||||
|
use PhpParser\Node\Stmt\Class_;
|
||||||
|
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||||
|
use Rector\Symfony\NodeAnalyzer\ClassAnalyzer;
|
||||||
|
use Rector\VendorLocker\ParentClassMethodTypeOverrideGuard;
|
||||||
|
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||||
|
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||||
|
/**
|
||||||
|
* @see \Rector\Symfony\Tests\Symfony63\Rector\Class_\SignalableCommandInterfaceReturnTypeRector\SignalableCommandInterfaceReturnTypeRectorTest
|
||||||
|
*/
|
||||||
|
final class SignalableCommandInterfaceReturnTypeRector extends \Rector\Core\Rector\AbstractRector
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @readonly
|
||||||
|
* @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer
|
||||||
|
*/
|
||||||
|
private $classAnalyzer;
|
||||||
|
/**
|
||||||
|
* @readonly
|
||||||
|
* @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard
|
||||||
|
*/
|
||||||
|
private $parentClassMethodTypeOverrideGuard;
|
||||||
|
public function __construct(ClassAnalyzer $classAnalyzer, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard)
|
||||||
|
{
|
||||||
|
$this->classAnalyzer = $classAnalyzer;
|
||||||
|
$this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard;
|
||||||
|
}
|
||||||
|
public function getRuleDefinition() : RuleDefinition
|
||||||
|
{
|
||||||
|
return new RuleDefinition('Return int or false from SignalableCommandInterface::handleSignal() instead of void', [new CodeSample(<<<'CODE_SAMPLE'
|
||||||
|
public function handleSignal(int $signal): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CODE_SAMPLE
|
||||||
|
, <<<'CODE_SAMPLE'
|
||||||
|
|
||||||
|
public function handleSignal(int $signal): int|false
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CODE_SAMPLE
|
||||||
|
)]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getNodeTypes() : array
|
||||||
|
{
|
||||||
|
return [Class_::class];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param Class_ $node
|
||||||
|
*/
|
||||||
|
public function refactor(Node $node) : ?Node
|
||||||
|
{
|
||||||
|
if (!$this->classAnalyzer->hasImplements($node, 'Symfony\\Component\\Console\\Command\\SignalableCommandInterface')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$handleSignalMethod = $node->getMethod('handleSignal');
|
||||||
|
if (null === $handleSignalMethod) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$newType = new \PHPStan\Type\UnionType([new \PHPStan\Type\IntegerType(), new \PHPStan\Type\Constant\ConstantBooleanType(\false)]);
|
||||||
|
if ($this->parentClassMethodTypeOverrideGuard->shouldSkipReturnTypeChange($handleSignalMethod, $newType)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$handleSignalMethod->returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($newType, TypeKind::RETURN);
|
||||||
|
$handleSignalMethod->stmts[] = new Node\Stmt\Return_($this->nodeFactory->createFalse());
|
||||||
|
return $node;
|
||||||
|
}
|
||||||
|
}
|
|
@ -97,4 +97,8 @@ final class SymfonyLevelSetList implements SetListInterface
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const UP_TO_SYMFONY_62 = __DIR__ . '/../../config/sets/symfony/level/up-to-symfony-62.php';
|
public const UP_TO_SYMFONY_62 = __DIR__ . '/../../config/sets/symfony/level/up-to-symfony-62.php';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const UP_TO_SYMFONY_63 = __DIR__ . '/../../config/sets/symfony/level/up-to-symfony-63.php';
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,10 @@ final class SymfonySetList implements SetListInterface
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const SYMFONY_62 = __DIR__ . '/../../config/sets/symfony/symfony62.php';
|
public const SYMFONY_62 = __DIR__ . '/../../config/sets/symfony/symfony62.php';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const SYMFONY_63 = __DIR__ . '/../../config/sets/symfony/symfony63.php';
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user