Updated Rector to commit 780ef4010d45be3e89844dec073ce2078a10f96f

780ef4010d Deprecated PhpDocInfo::markAsChanged() to ensure doc block is changed directly in the Rector rule (#4987)
This commit is contained in:
Tomas Votruba 2023-09-11 14:54:44 +00:00
parent ec1242d290
commit 67ef720476
12 changed files with 46 additions and 41 deletions

View File

@ -105,7 +105,6 @@ final class PhpDocInfo
$this->phpDocNode->children[] = $phpDocChildNode;
// to give node more space
$this->makeMultiLined();
$this->markAsChanged();
}
public function getPhpDocNode() : PhpDocNode
{
@ -339,6 +338,7 @@ final class PhpDocInfo
return $this->phpDocNode->getTemplateTagValues();
}
/**
* @deprecated Change doc block and print directly in the node instead
* @internal
* Should be handled by attributes of phpdoc node - if stard_and_end is missing in one of nodes, it has been changed
* Similar to missing original node in php-aprser

View File

@ -10,7 +10,6 @@ final class CurlyListNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\
{
/**
* @var ArrayItemNode[]
* @readonly
*/
private $arrayItemNodes = [];
/**

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '8b8a0d1a5daa1064860c446bdd1f8a26ab06c20d';
public const PACKAGE_VERSION = '780ef4010d45be3e89844dec073ce2078a10f96f';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-09-11 16:27:17';
public const RELEASE_DATE = '2023-09-11 16:51:56';
/**
* @var int
*/

View File

@ -281,14 +281,6 @@ final class BetterStandardPrinter extends Standard
}
return parent::pScalar_String($string);
}
/**
* @param Node[] $nodes
*/
protected function pStmts(array $nodes, bool $indent = \true) : string
{
$this->moveCommentsFromAttributeObjectToCommentsAttribute($nodes);
return parent::pStmts($nodes, $indent);
}
/**
* "...$params) : ReturnType"
*

2
vendor/autoload.php vendored
View File

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

View File

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

View File

@ -1744,12 +1744,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
"reference": "41cefd342baef9a6531857c5f9c0efcd715577ef"
"reference": "3ce87fb0df0701fdf3210001ccf2a6cc4d732da4"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/41cefd342baef9a6531857c5f9c0efcd715577ef",
"reference": "41cefd342baef9a6531857c5f9c0efcd715577ef",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/3ce87fb0df0701fdf3210001ccf2a6cc4d732da4",
"reference": "3ce87fb0df0701fdf3210001ccf2a6cc4d732da4",
"shasum": ""
},
"require": {
@ -1774,7 +1774,7 @@
"tomasvotruba\/type-coverage": "^0.2",
"tomasvotruba\/unused-public": "^0.3"
},
"time": "2023-09-11T08:36:42+00:00",
"time": "2023-09-11T14:45:06+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1807,12 +1807,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "74058c221f6156f18958919b0c36a08a281ee919"
"reference": "8953c00043f49d5b50cbb2c08456dfff6034fb60"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/74058c221f6156f18958919b0c36a08a281ee919",
"reference": "74058c221f6156f18958919b0c36a08a281ee919",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/8953c00043f49d5b50cbb2c08456dfff6034fb60",
"reference": "8953c00043f49d5b50cbb2c08456dfff6034fb60",
"shasum": ""
},
"require": {
@ -1839,7 +1839,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-09-11T09:43:50+00:00",
"time": "2023-09-11T14:50:46+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1943,12 +1943,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "63f14d3034dca068762066ff72da4924ee697a85"
"reference": "ce640aa8d61ec8c266e47a4e5708c78949af5ac7"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/63f14d3034dca068762066ff72da4924ee697a85",
"reference": "63f14d3034dca068762066ff72da4924ee697a85",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/ce640aa8d61ec8c266e47a4e5708c78949af5ac7",
"reference": "ce640aa8d61ec8c266e47a4e5708c78949af5ac7",
"shasum": ""
},
"require": {
@ -1981,7 +1981,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-09-11T14:24:54+00:00",
"time": "2023-09-11T14:37:30+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

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' => NULL, 'version' => 'dev-main 41cefd3'), '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' => NULL, 'version' => 'dev-main 74058c2'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 2ccca33'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 63f14d3'));
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' => NULL, 'version' => 'dev-main 3ce87fb'), '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' => NULL, 'version' => 'dev-main 8953c00'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 2ccca33'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main ce640aa'));
private function __construct()
{
}

View File

@ -13,7 +13,9 @@ use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprTrueNode;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
use Rector\BetterPhpDocParser\PhpDocNodeVisitor\UnionTypeNodePhpDocNodeVisitor;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\MethodName;
use Rector\Doctrine\NodeAnalyzer\ConstructorAssignPropertyAnalyzer;
@ -43,15 +45,21 @@ final class MoveCurrentDateTimeDefaultInEntityToConstructorRector extends Abstra
* @var \Rector\Doctrine\NodeAnalyzer\ConstructorAssignPropertyAnalyzer
*/
private $constructorAssignPropertyAnalyzer;
/**
* @readonly
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
*/
private $docBlockUpdater;
/**
* @var bool
*/
private $hasChanged = \false;
public function __construct(ConstructorManipulator $constructorManipulator, ValueAssignFactory $valueAssignFactory, ConstructorAssignPropertyAnalyzer $constructorAssignPropertyAnalyzer)
public function __construct(ConstructorManipulator $constructorManipulator, ValueAssignFactory $valueAssignFactory, ConstructorAssignPropertyAnalyzer $constructorAssignPropertyAnalyzer, DocBlockUpdater $docBlockUpdater)
{
$this->constructorManipulator = $constructorManipulator;
$this->valueAssignFactory = $valueAssignFactory;
$this->constructorAssignPropertyAnalyzer = $constructorAssignPropertyAnalyzer;
$this->docBlockUpdater = $docBlockUpdater;
}
public function getRuleDefinition() : RuleDefinition
{
@ -156,9 +164,7 @@ CODE_SAMPLE
}
$this->hasChanged = \true;
}
if ($this->hasChanged) {
$phpDocInfo->markAsChanged();
}
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
$this->refactorClassWithRemovalDefault($class, $property);
}
private function refactorClassWithRemovalDefault(Class_ $class, Property $property) : void

View File

@ -18,6 +18,7 @@ use PHPStan\Type\StaticType;
use PHPStan\Type\ThisType;
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\Util\Reflection\PrivatesAccessor;
@ -60,13 +61,19 @@ final class DowngradeCovariantReturnTypeRector extends AbstractRector
* @var \Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer
*/
private $unionTypeAnalyzer;
public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ReturnTagRemover $returnTagRemover, ReflectionResolver $reflectionResolver, PrivatesAccessor $privatesAccessor, UnionTypeAnalyzer $unionTypeAnalyzer)
/**
* @readonly
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
*/
private $docBlockUpdater;
public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ReturnTagRemover $returnTagRemover, ReflectionResolver $reflectionResolver, PrivatesAccessor $privatesAccessor, UnionTypeAnalyzer $unionTypeAnalyzer, DocBlockUpdater $docBlockUpdater)
{
$this->phpDocTypeChanger = $phpDocTypeChanger;
$this->returnTagRemover = $returnTagRemover;
$this->reflectionResolver = $reflectionResolver;
$this->privatesAccessor = $privatesAccessor;
$this->unionTypeAnalyzer = $unionTypeAnalyzer;
$this->docBlockUpdater = $docBlockUpdater;
}
public function getRuleDefinition() : RuleDefinition
{
@ -184,6 +191,7 @@ CODE_SAMPLE
$type = $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType);
$this->phpDocTypeChanger->changeReturnType($classMethod, $phpDocInfo, $type);
$this->returnTagRemover->removeReturnTagIfUseless($phpDocInfo, $classMethod);
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
}
/**
* @param ClassReflection[] $parentClassesAndInterfaces