Updated Rector to commit 2acb78be7361011f47c301344d8bb8ef4aa0e33d

2acb78be73 [Php55] Handle crash on direct $ without double quote backreference on PregReplaceEModifierRector (#3369)
This commit is contained in:
Tomas Votruba 2023-02-11 12:25:19 +00:00
parent 3483839cce
commit baa729956a
11 changed files with 50 additions and 25 deletions

View File

@ -68,7 +68,7 @@ final class StrposMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
/**
* @return FuncCall|BooleanNot
*/
public function refactorStrStartsWith(StrStartsWith $strStartsWith) : ?\PhpParser\Node
public function refactorStrStartsWith(StrStartsWith $strStartsWith) : Node
{
$strposFuncCall = $strStartsWith->getFuncCall();
$strposFuncCall->name = new Name('str_starts_with');

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit8792656c5a6f6154a3bacb00157b89fa::getLoader();
return ComposerAutoloaderInitdc0f80dd4cd1cee4fb82aec5d83057f7::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit8792656c5a6f6154a3bacb00157b89fa
class ComposerAutoloaderInitdc0f80dd4cd1cee4fb82aec5d83057f7
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit8792656c5a6f6154a3bacb00157b89fa
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit8792656c5a6f6154a3bacb00157b89fa', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitdc0f80dd4cd1cee4fb82aec5d83057f7', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit8792656c5a6f6154a3bacb00157b89fa', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitdc0f80dd4cd1cee4fb82aec5d83057f7', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitdc0f80dd4cd1cee4fb82aec5d83057f7::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitdc0f80dd4cd1cee4fb82aec5d83057f7::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa
class ComposerStaticInitdc0f80dd4cd1cee4fb82aec5d83057f7
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3098,9 +3098,9 @@ class ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8792656c5a6f6154a3bacb00157b89fa::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitdc0f80dd4cd1cee4fb82aec5d83057f7::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitdc0f80dd4cd1cee4fb82aec5d83057f7::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitdc0f80dd4cd1cee4fb82aec5d83057f7::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1915,12 +1915,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "98e591c916851fd98ee865a5e8e2d35f309291b7"
"reference": "fc1c39f708ac6211f0be78cb7261a5dc8cb5610e"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/98e591c916851fd98ee865a5e8e2d35f309291b7",
"reference": "98e591c916851fd98ee865a5e8e2d35f309291b7",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/fc1c39f708ac6211f0be78cb7261a5dc8cb5610e",
"reference": "fc1c39f708ac6211f0be78cb7261a5dc8cb5610e",
"shasum": ""
},
"require": {
@ -1944,7 +1944,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-02-11T11:27:42+00:00",
"time": "2023-02-11T12:19:09+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1982,12 +1982,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "d974dcc702dfdba514fe181941f2ee3a4621fe75"
"reference": "c7bd7e5f22f38e585d57dbb6eb73941b8beafed6"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/d974dcc702dfdba514fe181941f2ee3a4621fe75",
"reference": "d974dcc702dfdba514fe181941f2ee3a4621fe75",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/c7bd7e5f22f38e585d57dbb6eb73941b8beafed6",
"reference": "c7bd7e5f22f38e585d57dbb6eb73941b8beafed6",
"shasum": ""
},
"require": {
@ -2016,7 +2016,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-02-10T11:42:21+00:00",
"time": "2023-02-11T12:06:37+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@ class InvocationMockerDynamicReturnTypeExtension implements DynamicMethodReturnT
{
return $methodReflection->getName() !== 'getMatcher';
}
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : ?\PHPStan\Type\Type
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : Type
{
return $scope->getType($methodCall->var);
}

View File

@ -20,7 +20,7 @@ class MockBuilderDynamicReturnTypeExtension implements DynamicMethodReturnTypeEx
{
return !in_array($methodReflection->getName(), ['getMock', 'getMockForAbstractClass', 'getMockForTrait'], \true);
}
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : ?\PHPStan\Type\Type
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : Type
{
return $scope->getType($methodCall->var);
}

View File

@ -27,7 +27,7 @@ class MockObjectDynamicReturnTypeExtension implements DynamicMethodReturnTypeExt
{
return $methodReflection->getName() === 'expects';
}
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : ?\PHPStan\Type\Type
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : Type
{
$type = $scope->getType($methodCall->var);
if (!$type instanceof IntersectionType) {

View File

@ -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 ea9cf46'), '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 98e591c'), '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 d974dcc'), '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 1b148e3'));
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 ea9cf46'), '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 fc1c39f'), '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 c7bd7e5'), '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 1b148e3'));
private function __construct()
{
}

View File

@ -24,6 +24,7 @@ use Rector\Core\Util\Reflection\PrivatesAccessor;
use Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer;
use Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -54,12 +55,18 @@ final class DowngradeCovariantReturnTypeRector extends AbstractRector
* @var \Rector\Core\Util\Reflection\PrivatesAccessor
*/
private $privatesAccessor;
public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ReturnTagRemover $returnTagRemover, ReflectionResolver $reflectionResolver, PrivatesAccessor $privatesAccessor)
/**
* @readonly
* @var \Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer
*/
private $unionTypeAnalyzer;
public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ReturnTagRemover $returnTagRemover, ReflectionResolver $reflectionResolver, PrivatesAccessor $privatesAccessor, UnionTypeAnalyzer $unionTypeAnalyzer)
{
$this->phpDocTypeChanger = $phpDocTypeChanger;
$this->returnTagRemover = $returnTagRemover;
$this->reflectionResolver = $reflectionResolver;
$this->privatesAccessor = $privatesAccessor;
$this->unionTypeAnalyzer = $unionTypeAnalyzer;
}
public function getRuleDefinition() : RuleDefinition
{
@ -206,9 +213,27 @@ CODE_SAMPLE
if ($parentReturnType->equals($returnType)) {
continue;
}
if ($this->isNullable($parentReturnType, $returnType)) {
continue;
}
// This is an ancestor class with a different return type
return $parentReturnType;
}
return new MixedType();
}
private function isNullable(Type $parentReturnType, Type $returnType) : bool
{
if (!$parentReturnType instanceof \PHPStan\Type\UnionType) {
return \false;
}
if (!$this->unionTypeAnalyzer->isNullable($parentReturnType)) {
return \false;
}
foreach ($parentReturnType->getTypes() as $type) {
if ($type->equals($returnType)) {
return \true;
}
}
return \false;
}
}