Updated Rector to commit bea2e12a6d6e7a7b1eb1f7b6f82a0ec1e7c21f2c

bea2e12a6d [Privatization][TypeDeclaration] Skip inside class with @final docblock on PrivatizeFinalClassMethodRector and AddVoidReturnTypeWhereNoReturnRector (#3190)
This commit is contained in:
Tomas Votruba 2022-12-12 08:02:46 +00:00
parent 26753f8f8b
commit 5c3e98d25a
6 changed files with 26 additions and 17 deletions

View File

@ -4,10 +4,12 @@ declare (strict_types=1);
namespace Rector\Privatization\Rector\ClassMethod;
use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Reflection\ClassReflection;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
use Rector\Privatization\VisibilityGuard\ClassMethodVisibilityGuard;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -74,10 +76,11 @@ CODE_SAMPLE
if (!$classReflection instanceof ClassReflection) {
return null;
}
if (!$classReflection->isClass()) {
$class = $node->getAttribute(AttributeKey::PARENT_NODE);
if (!$class instanceof Class_) {
return null;
}
if (!$classReflection->isFinal()) {
if (!$class->isFinal()) {
return null;
}
if ($this->shouldSkipClassMethod($node)) {

View File

@ -6,6 +6,7 @@ namespace Rector\TypeDeclaration\Rector\ClassMethod;
use PhpParser\Node;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PHPStan\Reflection\ClassReflection;
@ -16,6 +17,7 @@ use Rector\Core\Contract\Rector\AllowEmptyConfigurableRectorInterface;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\TypeDeclaration\TypeInferer\SilentVoidResolver;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
@ -170,6 +172,10 @@ CODE_SAMPLE
if (!$classReflection instanceof ClassReflection) {
return \false;
}
return $classReflection->isFinal();
$node = $classMethod->getAttribute(AttributeKey::PARENT_NODE);
if (!$node instanceof Class_) {
return \false;
}
return $node->isFinal();
}
}

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '96c457badfd0c198a57a758c552ec82aee0049de';
public const PACKAGE_VERSION = 'bea2e12a6d6e7a7b1eb1f7b6f82a0ec1e7c21f2c';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-12-11 18:45:24';
public const RELEASE_DATE = '2022-12-12 08:58:28';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitfa35554e8ecb680533c5fb8896873474
class ComposerAutoloaderInitcaaf9e35911715a011b2dd61314f87c4
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitfa35554e8ecb680533c5fb8896873474
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitfa35554e8ecb680533c5fb8896873474', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitcaaf9e35911715a011b2dd61314f87c4', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitfa35554e8ecb680533c5fb8896873474', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitcaaf9e35911715a011b2dd61314f87c4', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitfa35554e8ecb680533c5fb8896873474::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitcaaf9e35911715a011b2dd61314f87c4::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitfa35554e8ecb680533c5fb8896873474::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInitcaaf9e35911715a011b2dd61314f87c4::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirefa35554e8ecb680533c5fb8896873474($fileIdentifier, $file);
composerRequirecaaf9e35911715a011b2dd61314f87c4($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitfa35554e8ecb680533c5fb8896873474
* @param string $file
* @return void
*/
function composerRequirefa35554e8ecb680533c5fb8896873474($fileIdentifier, $file)
function composerRequirecaaf9e35911715a011b2dd61314f87c4($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 ComposerStaticInitfa35554e8ecb680533c5fb8896873474
class ComposerStaticInitcaaf9e35911715a011b2dd61314f87c4
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3026,9 +3026,9 @@ class ComposerStaticInitfa35554e8ecb680533c5fb8896873474
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitfa35554e8ecb680533c5fb8896873474::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitfa35554e8ecb680533c5fb8896873474::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitfa35554e8ecb680533c5fb8896873474::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitcaaf9e35911715a011b2dd61314f87c4::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcaaf9e35911715a011b2dd61314f87c4::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcaaf9e35911715a011b2dd61314f87c4::$classMap;
}, null, ClassLoader::class);
}