Updated Rector to commit 53f549df59999185aba90f5043982dec1973d230

53f549df59 [DeadCode] Remove property comment same line on RemoveUnusedPrivatePropertyRector (#3547)
This commit is contained in:
Tomas Votruba 2023-04-01 19:30:08 +00:00
parent 4ee24449c6
commit 77c06429df
9 changed files with 51 additions and 33 deletions

View File

@ -5,6 +5,7 @@ namespace Rector\DeadCode\Rector\Property;
use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Nop;
use PhpParser\Node\Stmt\Property;
use Rector\Core\Contract\Rector\AllowEmptyConfigurableRectorInterface;
use Rector\Core\NodeManipulator\PropertyManipulator;
@ -78,7 +79,10 @@ CODE_SAMPLE
public function refactor(Node $node) : ?Node
{
$hasRemoved = \false;
foreach ($node->getProperties() as $property) {
foreach ($node->stmts as $key => $property) {
if (!$property instanceof Property) {
continue;
}
if ($this->shouldSkipProperty($property)) {
continue;
}
@ -89,11 +93,25 @@ CODE_SAMPLE
// when already asssigned to true
$isRemoved = $this->complexNodeRemover->removePropertyAndUsages($node, $property, $this->removeAssignSideEffect);
if ($isRemoved) {
$this->processRemoveSameLineComment($node, $property, $key);
$hasRemoved = \true;
}
}
return $hasRemoved ? $node : null;
}
private function processRemoveSameLineComment(Class_ $class, Property $property, int $key) : void
{
if (!isset($class->stmts[$key + 1])) {
return;
}
if (!$class->stmts[$key + 1] instanceof Nop) {
return;
}
if ($class->stmts[$key + 1]->getEndLine() !== $property->getStartLine()) {
return;
}
unset($class->stmts[$key + 1]);
}
private function shouldSkipProperty(Property $property) : bool
{
if (\count($property->props) !== 1) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'a66b295ddf18885a44d7b177ccf65a0014d25b5c';
public const PACKAGE_VERSION = '53f549df59999185aba90f5043982dec1973d230';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-04-02 00:04:33';
public const RELEASE_DATE = '2023-04-01 20:26:01';
/**
* @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 ComposerAutoloaderInit9b4a23a294637e32626a8d89df62e28b::getLoader();
return ComposerAutoloaderInitb0d35224fea6088630cb7d3bacad91ef::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9b4a23a294637e32626a8d89df62e28b
class ComposerAutoloaderInitb0d35224fea6088630cb7d3bacad91ef
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit9b4a23a294637e32626a8d89df62e28b
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9b4a23a294637e32626a8d89df62e28b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitb0d35224fea6088630cb7d3bacad91ef', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit9b4a23a294637e32626a8d89df62e28b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitb0d35224fea6088630cb7d3bacad91ef', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9b4a23a294637e32626a8d89df62e28b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitb0d35224fea6088630cb7d3bacad91ef::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit9b4a23a294637e32626a8d89df62e28b::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitb0d35224fea6088630cb7d3bacad91ef::$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 ComposerStaticInit9b4a23a294637e32626a8d89df62e28b
class ComposerStaticInitb0d35224fea6088630cb7d3bacad91ef
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3130,9 +3130,9 @@ class ComposerStaticInit9b4a23a294637e32626a8d89df62e28b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9b4a23a294637e32626a8d89df62e28b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9b4a23a294637e32626a8d89df62e28b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9b4a23a294637e32626a8d89df62e28b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitb0d35224fea6088630cb7d3bacad91ef::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb0d35224fea6088630cb7d3bacad91ef::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb0d35224fea6088630cb7d3bacad91ef::$classMap;
}, null, ClassLoader::class);
}

View File

@ -869,17 +869,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.10.9",
"version_normalized": "1.10.9.0",
"version": "1.10.10",
"version_normalized": "1.10.10.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "9b13dafe3d66693d20fe5729c3dde1d31bb64703"
"reference": "f1e22c9b17a879987f8743d81533250a5fff47f9"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/9b13dafe3d66693d20fe5729c3dde1d31bb64703",
"reference": "9b13dafe3d66693d20fe5729c3dde1d31bb64703",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/f1e22c9b17a879987f8743d81533250a5fff47f9",
"reference": "f1e22c9b17a879987f8743d81533250a5fff47f9",
"shasum": ""
},
"require": {
@ -888,7 +888,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2023-03-30T08:58:01+00:00",
"time": "2023-04-01T17:06:15+00:00",
"bin": [
"phpstan",
"phpstan.phar"

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmQlTwEACgkQUcZzBf/C
5cBI9w//awYBNMqoGBmyd+bev12bmzZPpUZPPI/4Ym4q4/DEOeLoRu7hurDa6foU
EohGFKhcGgi2s0BHOBbNXB2n2jdPDStN/sfCt01i7n08mkpVAH1ehGUX3HZPQP3Y
yksBaGxCTvZikzfW1fKp6Co2L9L/G+s98Q1IMwwLzvAjyrKiGFQQp96dgBz23d08
+95wOFdBakrb6TPAUEuV4ZR3BLf42HH+5Y9dBAKMNL02EFLzH2CPobJclFHa7c6S
BfBwvjKXH5ww2qwXGVOGh8yBGXRpqMdRDsAvgwD3xxWYuC9L3v7q04qOIG7dFvDY
970l8PZoKMGv/8SzZ791mXhP2i+7hjXe67hGWKTcos7Jfgu/etLsLhip7LfONr6W
/b6aIBRDHLfUUoJYn6Kij8GeRIgocStwtq6UgHp4OIszKGyBloSI5oHzdNGBvxbv
qNByTAxvJKGMeD4s7ECeV/Ioo+qgaulTGPD2mgl0d6/eFTw/E/yNOM2R8rK9fbE9
ESQVah6tAQvV08jsil1ASAtCnIv3JlxQQ6d8SaAo9F3ceVUp+cPw5NyqWYh24XCe
7qSdlPHUygW7Uk3BHl0vXKt6DBCI7ocXUXvqgKWQHtnBqFQEJBdfAVyzMB14ncxR
ySCirjiP0l6X6xIVeIcmnXqWQz0lO/oyUAYYkvlVMoU45dAsdbM=
=dE+u
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmQoZG4ACgkQUcZzBf/C
5cAuiA/+JiKBxNSz4F+LHnMYieeNhjt/Qu17+PwwCe461ZfBJbigCEBGvgdxzLLH
/awgFL/BSnf7+qWBi8Uj+sC51LT0eD06u1EepF2qs16DCily4oZTdtx/98t6go+5
Msu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