mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 5c1be93b80c3f7bfd8bd158ba0a55501a7acaefc
5c1be93b80
PHP 8.2 is supported (#3717)
This commit is contained in:
parent
65abab80de
commit
4f456a1654
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit66b3605b565e216252b50bdfc3076759::getLoader();
|
||||
return ComposerAutoloaderInit568258b7ddcb7bf1b274ef12b5bfe10d::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit66b3605b565e216252b50bdfc3076759
|
||||
class ComposerAutoloaderInit568258b7ddcb7bf1b274ef12b5bfe10d
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit66b3605b565e216252b50bdfc3076759
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit66b3605b565e216252b50bdfc3076759', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit568258b7ddcb7bf1b274ef12b5bfe10d', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit66b3605b565e216252b50bdfc3076759', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit568258b7ddcb7bf1b274ef12b5bfe10d', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit66b3605b565e216252b50bdfc3076759::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit568258b7ddcb7bf1b274ef12b5bfe10d::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit66b3605b565e216252b50bdfc3076759::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit568258b7ddcb7bf1b274ef12b5bfe10d::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit66b3605b565e216252b50bdfc3076759
|
||||
class ComposerStaticInit568258b7ddcb7bf1b274ef12b5bfe10d
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3152,9 +3152,9 @@ class ComposerStaticInit66b3605b565e216252b50bdfc3076759
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit66b3605b565e216252b50bdfc3076759::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit66b3605b565e216252b50bdfc3076759::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit66b3605b565e216252b50bdfc3076759::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit568258b7ddcb7bf1b274ef12b5bfe10d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit568258b7ddcb7bf1b274ef12b5bfe10d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit568258b7ddcb7bf1b274ef12b5bfe10d::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
@ -2128,12 +2128,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "11347bccc8b4adf8c5a40eb6acfc49aeab0b790e"
|
||||
"reference": "7ace160c8ab770c773aca150eda2f4eae5e4a0f0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/11347bccc8b4adf8c5a40eb6acfc49aeab0b790e",
|
||||
"reference": "11347bccc8b4adf8c5a40eb6acfc49aeab0b790e",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/7ace160c8ab770c773aca150eda2f4eae5e4a0f0",
|
||||
"reference": "7ace160c8ab770c773aca150eda2f4eae5e4a0f0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2163,7 +2163,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.0.9",
|
||||
"tomasvotruba\/unused-public": "^0.0.34"
|
||||
},
|
||||
"time": "2023-04-18T09:14:10+00:00",
|
||||
"time": "2023-05-01T11:28:54+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -2193,17 +2193,17 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian\/diff",
|
||||
"version": "5.0.1",
|
||||
"version_normalized": "5.0.1.0",
|
||||
"version": "5.0.3",
|
||||
"version_normalized": "5.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/sebastianbergmann\/diff.git",
|
||||
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02"
|
||||
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/sebastianbergmann\/diff\/zipball\/aae9a0a43bff37bd5d8d0311426c87bf36153f02",
|
||||
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02",
|
||||
"url": "https:\/\/api.github.com\/repos\/sebastianbergmann\/diff\/zipball\/912dc2fbe3e3c1e7873313cc801b100b6c68c87b",
|
||||
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2213,7 +2213,7 @@
|
|||
"phpunit\/phpunit": "^10.0",
|
||||
"symfony\/process": "^4.2 || ^5"
|
||||
},
|
||||
"time": "2023-03-23T05:12:41+00:00",
|
||||
"time": "2023-05-01T07:48:21+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -2251,7 +2251,7 @@
|
|||
"support": {
|
||||
"issues": "https:\/\/github.com\/sebastianbergmann\/diff\/issues",
|
||||
"security": "https:\/\/github.com\/sebastianbergmann\/diff\/security\/policy",
|
||||
"source": "https:\/\/github.com\/sebastianbergmann\/diff\/tree\/5.0.1"
|
||||
"source": "https:\/\/github.com\/sebastianbergmann\/diff\/tree\/5.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-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 03df9e3'), '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 23e55c6'), '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 dc4b405'), '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 11347bc'));
|
||||
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 03df9e3'), '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 23e55c6'), '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 dc4b405'), '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 7ace160'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Symfony\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
|
@ -43,6 +44,6 @@ final class FormAddMethodCallAnalyzer
|
|||
return \false;
|
||||
}
|
||||
$firstArg = $args[1];
|
||||
return $firstArg->value !== null;
|
||||
return $firstArg->value instanceof Expr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ final class LiteralCallLikeConstFetchReplacer
|
|||
if ($constantName === null) {
|
||||
return null;
|
||||
}
|
||||
$classConstFetch = $this->nodeFactory->createClassConstFetch($className, $constantName);
|
||||
$arg->value = $classConstFetch;
|
||||
$arg->value = $this->nodeFactory->createClassConstFetch($className, $constantName);
|
||||
return $callLike;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@ final class OnSuccessLogoutClassMethodFactory
|
|||
$this->replaceReturnResponseWithSetResponse($onLogoutSuccessClassMethod);
|
||||
$this->replaceRequestWithGetRequest($onLogoutSuccessClassMethod);
|
||||
$oldClassStmts = (array) $onLogoutSuccessClassMethod->stmts;
|
||||
$classStmts = \array_merge([$if], $oldClassStmts);
|
||||
$classMethod->stmts = $classStmts;
|
||||
$classMethod->stmts = \array_merge([$if], $oldClassStmts);
|
||||
return $classMethod;
|
||||
}
|
||||
private function replaceReturnResponseWithSetResponse(ClassMethod $classMethod) : void
|
||||
|
|
|
@ -99,8 +99,7 @@ CODE_SAMPLE
|
|||
if ($param->type !== null) {
|
||||
continue;
|
||||
}
|
||||
$paramTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType, TypeKind::PARAM);
|
||||
$param->type = $paramTypeNode;
|
||||
$param->type = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType, TypeKind::PARAM);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
if (!$hasChanged) {
|
||||
|
|
|
@ -6,8 +6,11 @@ namespace Rector\Symfony\Rector\ClassMethod;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\FamilyTree\NodeAnalyzer\ClassChildAnalyzer;
|
||||
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -21,9 +24,21 @@ final class RemoveUnusedRequestParamRector extends AbstractRector
|
|||
* @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer
|
||||
*/
|
||||
private $controllerAnalyzer;
|
||||
public function __construct(ControllerAnalyzer $controllerAnalyzer)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\FamilyTree\NodeAnalyzer\ClassChildAnalyzer
|
||||
*/
|
||||
private $classChildAnalyzer;
|
||||
public function __construct(ControllerAnalyzer $controllerAnalyzer, ReflectionResolver $reflectionResolver, ClassChildAnalyzer $classChildAnalyzer)
|
||||
{
|
||||
$this->controllerAnalyzer = $controllerAnalyzer;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->classChildAnalyzer = $classChildAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
|
@ -68,6 +83,9 @@ CODE_SAMPLE
|
|||
if (!$node->isPublic()) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isAbstract() || $this->hasAbstractParentClassMethod($node)) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->controllerAnalyzer->isInsideController($node)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -98,4 +116,12 @@ CODE_SAMPLE
|
|||
}
|
||||
return null;
|
||||
}
|
||||
private function hasAbstractParentClassMethod(ClassMethod $classMethod) : bool
|
||||
{
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);
|
||||
if (!$classReflection instanceof ClassReflection) {
|
||||
return \false;
|
||||
}
|
||||
return $this->classChildAnalyzer->hasAbstractParentClassMethod($classReflection, $this->getName($classMethod));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,9 +95,8 @@ CODE_SAMPLE
|
|||
if ($this->isObjectType($argumentValue, $this->objectType) || $this->isObjectType($argumentValue, $this->dataMapperObjectType)) {
|
||||
return null;
|
||||
}
|
||||
$propertyPathAccessor = new New_(new FullyQualified('Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\PropertyPathAccessor'));
|
||||
$newArgumentValue = new New_(new FullyQualified(self::DATAMAPPER_CLASS), [new Arg($propertyPathAccessor)]);
|
||||
$firstArg->value = $newArgumentValue;
|
||||
$new = new New_(new FullyQualified('Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\PropertyPathAccessor'));
|
||||
$firstArg->value = new New_(new FullyQualified(self::DATAMAPPER_CLASS), [new Arg($new)]);
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,18 @@
|
|||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [5.0.3] - 2023-05-01
|
||||
|
||||
### Changed
|
||||
|
||||
* [#119](https://github.com/sebastianbergmann/diff/pull/119): Improve performance of `TimeEfficientLongestCommonSubsequenceCalculator`
|
||||
|
||||
## [5.0.2] - 2023-05-01
|
||||
|
||||
### Changed
|
||||
|
||||
* [#118](https://github.com/sebastianbergmann/diff/pull/118): Improve performance of `MemoryEfficientLongestCommonSubsequenceCalculator`
|
||||
|
||||
## [5.0.1] - 2023-03-23
|
||||
|
||||
### Fixed
|
||||
|
@ -92,6 +104,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
|||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[5.0.3]: https://github.com/sebastianbergmann/diff/compare/5.0.2...5.0.3
|
||||
[5.0.2]: https://github.com/sebastianbergmann/diff/compare/5.0.1...5.0.2
|
||||
[5.0.1]: https://github.com/sebastianbergmann/diff/compare/5.0.0...5.0.1
|
||||
[5.0.0]: https://github.com/sebastianbergmann/diff/compare/4.0.4...5.0.0
|
||||
[4.0.4]: https://github.com/sebastianbergmann/diff/compare/4.0.3...4.0.4
|
||||
|
|
|
@ -202,3 +202,5 @@ The code above yields the output below:
|
|||
)
|
||||
)
|
||||
)
|
||||
|
||||
Note: If the chunk size is 0 lines, i.e., `getStartRange()` or `getEndRange()` return 0, the number of line returned by `getStart()` or `getEnd()` is one lower than one would expect. It is the line number after which the chunk should be inserted or deleted; in all other cases, it gives the first line number of the replaced range of lines.
|
||||
|
|
|
@ -4,7 +4,7 @@ If you believe you have found a security vulnerability in the library that is de
|
|||
|
||||
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
|
||||
|
||||
Instead, please send an email to `sebastian@phpunit.de`.
|
||||
Instead, please email `sebastian@phpunit.de`.
|
||||
|
||||
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
|
||||
|
||||
|
@ -22,9 +22,9 @@ This information will help us triage your report more quickly.
|
|||
|
||||
The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit.
|
||||
|
||||
The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in a HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes.
|
||||
The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in an HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes.
|
||||
|
||||
If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
|
||||
|
||||
Vulnerabilities specific to the use outside of a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
|
||||
Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
|
||||
|
||||
|
|
|
@ -65,7 +65,12 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
|
|||
if ($from[$i] === $to[$j]) {
|
||||
$current[$j + 1] = $prev[$j] + 1;
|
||||
} else {
|
||||
$current[$j + 1] = max($current[$j], $prev[$j + 1]);
|
||||
// don't use max() to avoid function call overhead
|
||||
if ($current[$j] > $prev[$j + 1]) {
|
||||
$current[$j + 1] = $current[$j];
|
||||
} else {
|
||||
$current[$j + 1] = $prev[$j + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,21 @@ final class TimeEfficientLongestCommonSubsequenceCalculator implements LongestCo
|
|||
for ($i = 1; $i <= $fromLength; $i++) {
|
||||
for ($j = 1; $j <= $toLength; $j++) {
|
||||
$o = $j * $width + $i;
|
||||
$matrix[$o] = max($matrix[$o - 1], $matrix[$o - $width], $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0);
|
||||
// don't use max() to avoid function call overhead
|
||||
$firstOrLast = $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0;
|
||||
if ($matrix[$o - 1] > $matrix[$o - $width]) {
|
||||
if ($firstOrLast > $matrix[$o - 1]) {
|
||||
$matrix[$o] = $firstOrLast;
|
||||
} else {
|
||||
$matrix[$o] = $matrix[$o - 1];
|
||||
}
|
||||
} else {
|
||||
if ($firstOrLast > $matrix[$o - $width]) {
|
||||
$matrix[$o] = $firstOrLast;
|
||||
} else {
|
||||
$matrix[$o] = $matrix[$o - $width];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$i = $fromLength;
|
||||
|
|
Loading…
Reference in New Issue