Updated Rector to commit 7eb5e75cda2e0dc95198ec3841084792fac844fb

7eb5e75cda [Php80] Copy PhpDocInfo values on ClassPropertyAssignToConstructorPromotionRector (#744)
This commit is contained in:
Tomas Votruba 2021-08-23 11:12:57 +00:00
parent 901492ce0d
commit c7b2129f64
10 changed files with 54 additions and 27 deletions

View File

@ -4,6 +4,7 @@ declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDocManipulator;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\Type\Constant\ConstantArrayType;
@ -11,6 +12,7 @@ use PHPStan\Type\MixedType;
use PHPStan\Type\NeverType;
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
use Rector\PHPStanStaticTypeMapper\ValueObject\TypeKind;
use Rector\StaticTypeMapper\StaticTypeMapper;
@ -108,4 +110,20 @@ final class PhpDocTypeChanger
$phpDocInfo->addTagValueNode($paramTagValueNode);
}
}
public function copyPropertyDocToParam(\PhpParser\Node\Stmt\Property $property, \PhpParser\Node\Param $param) : void
{
$phpDocInfo = $property->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO);
if (!$phpDocInfo) {
return;
}
$varTag = $phpDocInfo->getVarTagValueNode();
if (!$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode) {
return;
}
if ($varTag->description !== '') {
return;
}
$phpDocInfo->removeByType(\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode::class);
$param->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $phpDocInfo);
}
}

View File

@ -11,6 +11,7 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use Rector\Core\NodeAnalyzer\ParamAnalyzer;
use Rector\Core\Rector\AbstractRector;
@ -47,12 +48,17 @@ final class ClassPropertyAssignToConstructorPromotionRector extends \Rector\Core
* @var \Rector\Core\NodeAnalyzer\ParamAnalyzer
*/
private $paramAnalyzer;
public function __construct(\Rector\Php80\NodeAnalyzer\PromotedPropertyCandidateResolver $promotedPropertyCandidateResolver, \Rector\Naming\VariableRenamer $variableRenamer, \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover $varTagRemover, \Rector\Core\NodeAnalyzer\ParamAnalyzer $paramAnalyzer)
/**
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger
*/
private $phpDocTypeChanger;
public function __construct(\Rector\Php80\NodeAnalyzer\PromotedPropertyCandidateResolver $promotedPropertyCandidateResolver, \Rector\Naming\VariableRenamer $variableRenamer, \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover $varTagRemover, \Rector\Core\NodeAnalyzer\ParamAnalyzer $paramAnalyzer, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger)
{
$this->promotedPropertyCandidateResolver = $promotedPropertyCandidateResolver;
$this->variableRenamer = $variableRenamer;
$this->varTagRemover = $varTagRemover;
$this->paramAnalyzer = $paramAnalyzer;
$this->phpDocTypeChanger = $phpDocTypeChanger;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
@ -126,6 +132,7 @@ CODE_SAMPLE
// Copy over attributes of the "old" property
$param->attrGroups = $property->attrGroups;
$this->processNullableType($property, $param);
$this->phpDocTypeChanger->copyPropertyDocToParam($property, $param);
}
return $node;
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '241f8a9ce1d19a0dc10149269ce9a4cd588eeb0c';
public const PACKAGE_VERSION = '7eb5e75cda2e0dc95198ec3841084792fac844fb';
/**
* @var string
*/
public const RELEASE_DATE = '2021-08-23 00:28:19';
public const RELEASE_DATE = '2021-08-23 13:00:47';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210823\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5::getLoader();
return ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5
class ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf979915633a4fb02a1a77a010cc44dcf::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitf979915633a4fb02a1a77a010cc44dcf::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireec438f0546354141ffe5ff8d6012e3e5($fileIdentifier, $file);
composerRequiref979915633a4fb02a1a77a010cc44dcf($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequireec438f0546354141ffe5ff8d6012e3e5($fileIdentifier, $file)
function composerRequiref979915633a4fb02a1a77a010cc44dcf($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5
class ComposerStaticInitf979915633a4fb02a1a77a010cc44dcf
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3853,9 +3853,9 @@ class ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitec438f0546354141ffe5ff8d6012e3e5::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitf979915633a4fb02a1a77a010cc44dcf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf979915633a4fb02a1a77a010cc44dcf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf979915633a4fb02a1a77a010cc44dcf::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1835,12 +1835,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/console.git",
"reference": "45daf168036763f04bf9b2f84190d16addceaa57"
"reference": "2be7b5c3d5f3833f7ba09544c0b8440314b52bcf"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/45daf168036763f04bf9b2f84190d16addceaa57",
"reference": "45daf168036763f04bf9b2f84190d16addceaa57",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/2be7b5c3d5f3833f7ba09544c0b8440314b52bcf",
"reference": "2be7b5c3d5f3833f7ba09544c0b8440314b52bcf",
"shasum": ""
},
"require": {
@ -1878,7 +1878,7 @@
"symfony\/lock": "",
"symfony\/process": ""
},
"time": "2021-08-13T15:54:02+00:00",
"time": "2021-08-22T21:55:58+00:00",
"default-branch": true,
"type": "library",
"installation-source": "dist",

File diff suppressed because one or more lines are too long

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20210823\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5', false) && !interface_exists('ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5', false) && !trait_exists('ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5', false)) {
spl_autoload_call('RectorPrefix20210823\ComposerAutoloaderInitec438f0546354141ffe5ff8d6012e3e5');
if (!class_exists('ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf', false) && !interface_exists('ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf', false) && !trait_exists('ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf', false)) {
spl_autoload_call('RectorPrefix20210823\ComposerAutoloaderInitf979915633a4fb02a1a77a010cc44dcf');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20210823\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210823\print_node(...func_get_args());
}
}
if (!function_exists('composerRequireec438f0546354141ffe5ff8d6012e3e5')) {
function composerRequireec438f0546354141ffe5ff8d6012e3e5() {
return \RectorPrefix20210823\composerRequireec438f0546354141ffe5ff8d6012e3e5(...func_get_args());
if (!function_exists('composerRequiref979915633a4fb02a1a77a010cc44dcf')) {
function composerRequiref979915633a4fb02a1a77a010cc44dcf() {
return \RectorPrefix20210823\composerRequiref979915633a4fb02a1a77a010cc44dcf(...func_get_args());
}
}
if (!function_exists('parseArgs')) {

View File

@ -408,8 +408,10 @@ final class ProgressBar
}
$this->output->clear($lineCount);
} else {
if ($this->formatLineCount > 0) {
$this->cursor->moveUp($this->formatLineCount);
for ($i = 0; $i < $this->formatLineCount; ++$i) {
$this->cursor->moveToColumn(1);
$this->cursor->clearLine();
$this->cursor->moveUp();
}
$this->cursor->moveToColumn(1);
$this->cursor->clearLine();