mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 24384c10ed4f6b41d3f84b9d7b2903c3c5bbafe9
24384c10ed
[Php 8] Enable RenamePropertyToMatchTypeRector (#168)
This commit is contained in:
parent
6b9c9cbaf5
commit
11b9fe9deb
151
rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php
Normal file
151
rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Naming\PropertyRenamer;
|
||||
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver;
|
||||
use Rector\Naming\ParamRenamer\ParamRenamer;
|
||||
use Rector\Naming\ValueObject\ParamRename;
|
||||
use Rector\Naming\ValueObjectFactory\ParamRenameFactory;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class PropertyPromotionRenamer
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
/**
|
||||
* @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver
|
||||
*/
|
||||
private $matchParamTypeExpectedNameResolver;
|
||||
/**
|
||||
* @var \Rector\Naming\ValueObjectFactory\ParamRenameFactory
|
||||
*/
|
||||
private $paramRenameFactory;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
/**
|
||||
* @var \Rector\Naming\ParamRenamer\ParamRenamer
|
||||
*/
|
||||
private $paramRenamer;
|
||||
/**
|
||||
* @var \Rector\Naming\PropertyRenamer\PropertyFetchRenamer
|
||||
*/
|
||||
private $propertyFetchRenamer;
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(\Rector\Core\Php\PhpVersionProvider $phpVersionProvider, \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, \Rector\Naming\ValueObjectFactory\ParamRenameFactory $paramRenameFactory, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory, \Rector\Naming\ParamRenamer\ParamRenamer $paramRenamer, \Rector\Naming\PropertyRenamer\PropertyFetchRenamer $propertyFetchRenamer, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
$this->matchParamTypeExpectedNameResolver = $matchParamTypeExpectedNameResolver;
|
||||
$this->paramRenameFactory = $paramRenameFactory;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->paramRenamer = $paramRenamer;
|
||||
$this->propertyFetchRenamer = $propertyFetchRenamer;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
public function renamePropertyPromotion(\PhpParser\Node\Stmt\ClassLike $classLike) : void
|
||||
{
|
||||
if (!$this->phpVersionProvider->isAtLeastPhpVersion(\Rector\Core\ValueObject\PhpVersionFeature::PROPERTY_PROMOTION)) {
|
||||
return;
|
||||
}
|
||||
$constructClassMethod = $classLike->getMethod(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
|
||||
if (!$constructClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return;
|
||||
}
|
||||
// resolve possible and existing param names
|
||||
$blockingParamNames = $this->resolveBlockingParamNames($constructClassMethod);
|
||||
foreach ($constructClassMethod->params as $param) {
|
||||
if ($param->flags === 0) {
|
||||
continue;
|
||||
}
|
||||
// promoted property
|
||||
$desiredPropertyName = $this->matchParamTypeExpectedNameResolver->resolve($param);
|
||||
if ($desiredPropertyName === null) {
|
||||
continue;
|
||||
}
|
||||
if (\in_array($desiredPropertyName, $blockingParamNames, \true)) {
|
||||
continue;
|
||||
}
|
||||
$currentParamName = $this->nodeNameResolver->getName($param);
|
||||
if ($this->isNameSuffixed($currentParamName, $desiredPropertyName)) {
|
||||
continue;
|
||||
}
|
||||
$this->renameParamVarName($classLike, $constructClassMethod, $desiredPropertyName, $param);
|
||||
}
|
||||
}
|
||||
private function renameParamVarName(\PhpParser\Node\Stmt\ClassLike $classLike, \PhpParser\Node\Stmt\ClassMethod $classMethod, string $desiredPropertyName, \PhpParser\Node\Param $param) : void
|
||||
{
|
||||
$classMethodPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
|
||||
$currentParamName = $this->nodeNameResolver->getName($param);
|
||||
$this->propertyFetchRenamer->renamePropertyFetchesInClass($classLike, $currentParamName, $desiredPropertyName);
|
||||
/** @var string $paramVarName */
|
||||
$paramVarName = $param->var->name;
|
||||
$this->renameParamDoc($classMethodPhpDocInfo, $param, $paramVarName, $desiredPropertyName);
|
||||
$param->var->name = $desiredPropertyName;
|
||||
}
|
||||
private function renameParamDoc(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PhpParser\Node\Param $param, string $paramVarName, string $desiredPropertyName) : void
|
||||
{
|
||||
$paramTagValueNode = $phpDocInfo->getParamTagValueNodeByName($paramVarName);
|
||||
if (!$paramTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
|
||||
return;
|
||||
}
|
||||
$paramRename = $this->paramRenameFactory->createFromResolvedExpectedName($param, $desiredPropertyName);
|
||||
if (!$paramRename instanceof \Rector\Naming\ValueObject\ParamRename) {
|
||||
return;
|
||||
}
|
||||
$this->paramRenamer->rename($paramRename);
|
||||
}
|
||||
/**
|
||||
* Sometimes the bare type is not enough.
|
||||
* This allows prefixing type in variable names, e.g. "Type $firstType"
|
||||
*/
|
||||
private function isNameSuffixed(string $currentParamName, string $desiredPropertyName) : bool
|
||||
{
|
||||
$currentNameLowercased = \strtolower($currentParamName);
|
||||
$expectedNameLowercased = \strtolower($desiredPropertyName);
|
||||
return \substr_compare($currentNameLowercased, $expectedNameLowercased, -\strlen($expectedNameLowercased)) === 0;
|
||||
}
|
||||
/**
|
||||
* @return int[]|string[]
|
||||
*/
|
||||
private function resolveBlockingParamNames(\PhpParser\Node\Stmt\ClassMethod $classMethod) : array
|
||||
{
|
||||
$futureParamNames = [];
|
||||
foreach ($classMethod->params as $param) {
|
||||
$futureParamName = $this->matchParamTypeExpectedNameResolver->resolve($param);
|
||||
if ($futureParamName === null) {
|
||||
continue;
|
||||
}
|
||||
$futureParamNames[] = $futureParamName;
|
||||
}
|
||||
// remove null values
|
||||
$futureParamNames = \array_filter($futureParamNames);
|
||||
if ($futureParamNames === []) {
|
||||
return [];
|
||||
}
|
||||
// resolve duplicated names
|
||||
$blockingParamNames = [];
|
||||
$valuesToCount = \array_count_values($futureParamNames);
|
||||
foreach ($valuesToCount as $value => $count) {
|
||||
if ($count < 2) {
|
||||
continue;
|
||||
}
|
||||
$blockingParamNames[] = $value;
|
||||
}
|
||||
return $blockingParamNames;
|
||||
}
|
||||
}
|
@ -7,22 +7,13 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver;
|
||||
use Rector\Naming\ExpectedNameResolver\MatchPropertyTypeExpectedNameResolver;
|
||||
use Rector\Naming\ParamRenamer\ParamRenamer;
|
||||
use Rector\Naming\PropertyRenamer\MatchTypePropertyRenamer;
|
||||
use Rector\Naming\PropertyRenamer\PropertyFetchRenamer;
|
||||
use Rector\Naming\ValueObject\ParamRename;
|
||||
use Rector\Naming\PropertyRenamer\PropertyPromotionRenamer;
|
||||
use Rector\Naming\ValueObject\PropertyRename;
|
||||
use Rector\Naming\ValueObjectFactory\ParamRenameFactory;
|
||||
use Rector\Naming\ValueObjectFactory\PropertyRenameFactory;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -48,30 +39,15 @@ final class RenamePropertyToMatchTypeRector extends \Rector\Core\Rector\Abstract
|
||||
*/
|
||||
private $matchPropertyTypeExpectedNameResolver;
|
||||
/**
|
||||
* @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver
|
||||
* @var \Rector\Naming\PropertyRenamer\PropertyPromotionRenamer
|
||||
*/
|
||||
private $matchParamTypeExpectedNameResolver;
|
||||
/**
|
||||
* @var \Rector\Naming\PropertyRenamer\PropertyFetchRenamer
|
||||
*/
|
||||
private $propertyFetchRenamer;
|
||||
/**
|
||||
* @var \Rector\Naming\ValueObjectFactory\ParamRenameFactory
|
||||
*/
|
||||
private $paramRenameFactory;
|
||||
/**
|
||||
* @var \Rector\Naming\ParamRenamer\ParamRenamer
|
||||
*/
|
||||
private $paramRenamer;
|
||||
public function __construct(\Rector\Naming\PropertyRenamer\MatchTypePropertyRenamer $matchTypePropertyRenamer, \Rector\Naming\ValueObjectFactory\PropertyRenameFactory $propertyRenameFactory, \Rector\Naming\ExpectedNameResolver\MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver, \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, \Rector\Naming\PropertyRenamer\PropertyFetchRenamer $propertyFetchRenamer, \Rector\Naming\ValueObjectFactory\ParamRenameFactory $paramRenameFactory, \Rector\Naming\ParamRenamer\ParamRenamer $paramRenamer)
|
||||
private $propertyPromotionRenamer;
|
||||
public function __construct(\Rector\Naming\PropertyRenamer\MatchTypePropertyRenamer $matchTypePropertyRenamer, \Rector\Naming\ValueObjectFactory\PropertyRenameFactory $propertyRenameFactory, \Rector\Naming\ExpectedNameResolver\MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver, \Rector\Naming\PropertyRenamer\PropertyPromotionRenamer $propertyPromotionRenamer)
|
||||
{
|
||||
$this->matchTypePropertyRenamer = $matchTypePropertyRenamer;
|
||||
$this->propertyRenameFactory = $propertyRenameFactory;
|
||||
$this->matchPropertyTypeExpectedNameResolver = $matchPropertyTypeExpectedNameResolver;
|
||||
$this->matchParamTypeExpectedNameResolver = $matchParamTypeExpectedNameResolver;
|
||||
$this->propertyFetchRenamer = $propertyFetchRenamer;
|
||||
$this->paramRenameFactory = $paramRenameFactory;
|
||||
$this->paramRenamer = $paramRenamer;
|
||||
$this->propertyPromotionRenamer = $propertyPromotionRenamer;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
@ -118,7 +94,7 @@ CODE_SAMPLE
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$this->refactorClassProperties($node);
|
||||
$this->renamePropertyPromotion($node);
|
||||
$this->propertyPromotionRenamer->renamePropertyPromotion($node);
|
||||
if (!$this->hasChanged) {
|
||||
return null;
|
||||
}
|
||||
@ -142,62 +118,4 @@ CODE_SAMPLE
|
||||
$this->hasChanged = \true;
|
||||
}
|
||||
}
|
||||
private function renamePropertyPromotion(\PhpParser\Node\Stmt\ClassLike $classLike) : void
|
||||
{
|
||||
if (!$this->isAtLeastPhpVersion(\Rector\Core\ValueObject\PhpVersionFeature::PROPERTY_PROMOTION)) {
|
||||
return;
|
||||
}
|
||||
$constructClassMethod = $classLike->getMethod(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
|
||||
if (!$constructClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return;
|
||||
}
|
||||
$desiredPropertyNames = [];
|
||||
foreach ($constructClassMethod->params as $key => $param) {
|
||||
if ($param->flags === 0) {
|
||||
continue;
|
||||
}
|
||||
// promoted property
|
||||
$desiredPropertyName = $this->matchParamTypeExpectedNameResolver->resolve($param);
|
||||
if ($desiredPropertyName === null) {
|
||||
continue;
|
||||
}
|
||||
if (\in_array($desiredPropertyName, $desiredPropertyNames, \true)) {
|
||||
return;
|
||||
}
|
||||
$desiredPropertyNames[$key] = $desiredPropertyName;
|
||||
}
|
||||
$this->renameParamVarName($classLike, $constructClassMethod, $desiredPropertyNames);
|
||||
}
|
||||
/**
|
||||
* @param string[] $desiredPropertyNames
|
||||
*/
|
||||
private function renameParamVarName(\PhpParser\Node\Stmt\ClassLike $classLike, \PhpParser\Node\Stmt\ClassMethod $constructClassMethod, array $desiredPropertyNames) : void
|
||||
{
|
||||
$keys = \array_keys($desiredPropertyNames);
|
||||
$params = $constructClassMethod->params;
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($constructClassMethod);
|
||||
foreach ($params as $key => $param) {
|
||||
if (\in_array($key, $keys, \true)) {
|
||||
$currentName = $this->getName($param);
|
||||
$desiredPropertyName = $desiredPropertyNames[$key];
|
||||
$this->propertyFetchRenamer->renamePropertyFetchesInClass($classLike, $currentName, $desiredPropertyName);
|
||||
/** @var string $paramVarName */
|
||||
$paramVarName = $param->var->name;
|
||||
$this->renameParamDoc($phpDocInfo, $param, $paramVarName, $desiredPropertyName);
|
||||
$param->var->name = $desiredPropertyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
private function renameParamDoc(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PhpParser\Node\Param $param, string $paramVarName, string $desiredPropertyName) : void
|
||||
{
|
||||
$paramTagValueNode = $phpDocInfo->getParamTagValueNodeByName($paramVarName);
|
||||
if (!$paramTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
|
||||
return;
|
||||
}
|
||||
$paramRename = $this->paramRenameFactory->createFromResolvedExpectedName($param, $desiredPropertyName);
|
||||
if (!$paramRename instanceof \Rector\Naming\ValueObject\ParamRename) {
|
||||
return;
|
||||
}
|
||||
$this->paramRenamer->rename($paramRename);
|
||||
}
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ final class RenameForeachValueVariableToMatchMethodCallReturnTypeRector extends
|
||||
/**
|
||||
* @var \Rector\Naming\Matcher\ForeachMatcher
|
||||
*/
|
||||
private $varValueAndCallForeachMatcher;
|
||||
public function __construct(\Rector\Naming\Guard\BreakingVariableRenameGuard $breakingVariableRenameGuard, \Rector\Naming\Naming\ExpectedNameResolver $expectedNameResolver, \Rector\Naming\NamingConvention\NamingConventionAnalyzer $namingConventionAnalyzer, \Rector\Naming\VariableRenamer $variableRenamer, \Rector\Naming\Matcher\ForeachMatcher $varValueAndCallForeachMatcher)
|
||||
private $foreachMatcher;
|
||||
public function __construct(\Rector\Naming\Guard\BreakingVariableRenameGuard $breakingVariableRenameGuard, \Rector\Naming\Naming\ExpectedNameResolver $expectedNameResolver, \Rector\Naming\NamingConvention\NamingConventionAnalyzer $namingConventionAnalyzer, \Rector\Naming\VariableRenamer $variableRenamer, \Rector\Naming\Matcher\ForeachMatcher $foreachMatcher)
|
||||
{
|
||||
$this->breakingVariableRenameGuard = $breakingVariableRenameGuard;
|
||||
$this->expectedNameResolver = $expectedNameResolver;
|
||||
$this->namingConventionAnalyzer = $namingConventionAnalyzer;
|
||||
$this->variableRenamer = $variableRenamer;
|
||||
$this->varValueAndCallForeachMatcher = $varValueAndCallForeachMatcher;
|
||||
$this->foreachMatcher = $foreachMatcher;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
@ -87,7 +87,7 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$variableAndCallForeach = $this->varValueAndCallForeachMatcher->match($node);
|
||||
$variableAndCallForeach = $this->foreachMatcher->match($node);
|
||||
if (!$variableAndCallForeach instanceof \Rector\Naming\ValueObject\VariableAndCallForeach) {
|
||||
return null;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ final class VariableAndCallAssign
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr
|
||||
*/
|
||||
private $call;
|
||||
private $expr;
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr\Assign
|
||||
*/
|
||||
@ -36,13 +36,13 @@ final class VariableAndCallAssign
|
||||
*/
|
||||
private $functionLike;
|
||||
/**
|
||||
* @param FuncCall|StaticCall|MethodCall $call
|
||||
* @param FuncCall|StaticCall|MethodCall $expr
|
||||
* @param ClassMethod|Function_|Closure $functionLike
|
||||
*/
|
||||
public function __construct(\PhpParser\Node\Expr\Variable $variable, \PhpParser\Node\Expr $call, \PhpParser\Node\Expr\Assign $assign, string $variableName, \PhpParser\Node\FunctionLike $functionLike)
|
||||
public function __construct(\PhpParser\Node\Expr\Variable $variable, \PhpParser\Node\Expr $expr, \PhpParser\Node\Expr\Assign $assign, string $variableName, \PhpParser\Node\FunctionLike $functionLike)
|
||||
{
|
||||
$this->variable = $variable;
|
||||
$this->call = $call;
|
||||
$this->expr = $expr;
|
||||
$this->assign = $assign;
|
||||
$this->variableName = $variableName;
|
||||
$this->functionLike = $functionLike;
|
||||
@ -56,7 +56,7 @@ final class VariableAndCallAssign
|
||||
*/
|
||||
public function getCall()
|
||||
{
|
||||
return $this->call;
|
||||
return $this->expr;
|
||||
}
|
||||
public function getVariableName() : string
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ final class VariableAndCallForeach
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr
|
||||
*/
|
||||
private $call;
|
||||
private $expr;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -31,13 +31,13 @@ final class VariableAndCallForeach
|
||||
*/
|
||||
private $functionLike;
|
||||
/**
|
||||
* @param FuncCall|StaticCall|MethodCall $call
|
||||
* @param FuncCall|StaticCall|MethodCall $expr
|
||||
* @param ClassMethod|Function_|Closure $functionLike
|
||||
*/
|
||||
public function __construct(\PhpParser\Node\Expr\Variable $variable, \PhpParser\Node\Expr $call, string $variableName, \PhpParser\Node\FunctionLike $functionLike)
|
||||
public function __construct(\PhpParser\Node\Expr\Variable $variable, \PhpParser\Node\Expr $expr, string $variableName, \PhpParser\Node\FunctionLike $functionLike)
|
||||
{
|
||||
$this->variable = $variable;
|
||||
$this->call = $call;
|
||||
$this->expr = $expr;
|
||||
$this->variableName = $variableName;
|
||||
$this->functionLike = $functionLike;
|
||||
}
|
||||
@ -50,7 +50,7 @@ final class VariableAndCallForeach
|
||||
*/
|
||||
public function getCall()
|
||||
{
|
||||
return $this->call;
|
||||
return $this->expr;
|
||||
}
|
||||
public function getVariableName() : string
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ final class ClassPropertyAssignToConstructorPromotionRector extends \Rector\Core
|
||||
/**
|
||||
* @var \Rector\Php80\NodeAnalyzer\PromotedPropertyCandidateResolver
|
||||
*/
|
||||
private $promotedPropertyResolver;
|
||||
private $promotedPropertyCandidateResolver;
|
||||
/**
|
||||
* @var \Rector\Naming\VariableRenamer
|
||||
*/
|
||||
@ -39,9 +39,9 @@ final class ClassPropertyAssignToConstructorPromotionRector extends \Rector\Core
|
||||
* @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover
|
||||
*/
|
||||
private $varTagRemover;
|
||||
public function __construct(\Rector\Php80\NodeAnalyzer\PromotedPropertyCandidateResolver $promotedPropertyResolver, \Rector\Naming\VariableRenamer $variableRenamer, \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover $varTagRemover)
|
||||
public function __construct(\Rector\Php80\NodeAnalyzer\PromotedPropertyCandidateResolver $promotedPropertyCandidateResolver, \Rector\Naming\VariableRenamer $variableRenamer, \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover $varTagRemover)
|
||||
{
|
||||
$this->promotedPropertyResolver = $promotedPropertyResolver;
|
||||
$this->promotedPropertyCandidateResolver = $promotedPropertyCandidateResolver;
|
||||
$this->variableRenamer = $variableRenamer;
|
||||
$this->varTagRemover = $varTagRemover;
|
||||
}
|
||||
@ -83,7 +83,7 @@ CODE_SAMPLE
|
||||
if (!$this->isAtLeastPhpVersion(\Rector\Core\ValueObject\PhpVersionFeature::PROPERTY_PROMOTION)) {
|
||||
return null;
|
||||
}
|
||||
$promotionCandidates = $this->promotedPropertyResolver->resolveFromClass($node);
|
||||
$promotionCandidates = $this->promotedPropertyCandidateResolver->resolveFromClass($node);
|
||||
if ($promotionCandidates === []) {
|
||||
return null;
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c251806319f0f9e140a8ea0c9c3d7ba7c6529327';
|
||||
public const PACKAGE_VERSION = '24384c10ed4f6b41d3f84b9d7b2903c3c5bbafe9';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-18 18:01:14';
|
||||
public const RELEASE_DATE = '2021-06-18 19:18:23';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210618\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa::getLoader();
|
||||
return ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -2277,6 +2277,7 @@ return array(
|
||||
'Rector\\Naming\\PropertyRenamer\\BoolPropertyRenamer' => $baseDir . '/rules/Naming/PropertyRenamer/BoolPropertyRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\MatchTypePropertyRenamer' => $baseDir . '/rules/Naming/PropertyRenamer/MatchTypePropertyRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\PropertyFetchRenamer' => $baseDir . '/rules/Naming/PropertyRenamer/PropertyFetchRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\PropertyPromotionRenamer' => $baseDir . '/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\PropertyRenamer' => $baseDir . '/rules/Naming/PropertyRenamer/PropertyRenamer.php',
|
||||
'Rector\\Naming\\RectorNamingInflector' => $baseDir . '/rules/Naming/RectorNamingInflector.php',
|
||||
'Rector\\Naming\\Rector\\Assign\\RenameVariableToMatchMethodCallReturnTypeRector' => $baseDir . '/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php',
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa
|
||||
class ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08', '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\ComposerStaticInit6eb7042105862f732d268d726514ddaa::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit5247445f38fc915bbfb8da2f9f007f08::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit6eb7042105862f732d268d726514ddaa::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit5247445f38fc915bbfb8da2f9f007f08::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire6eb7042105862f732d268d726514ddaa($fileIdentifier, $file);
|
||||
composerRequire5247445f38fc915bbfb8da2f9f007f08($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire6eb7042105862f732d268d726514ddaa($fileIdentifier, $file)
|
||||
function composerRequire5247445f38fc915bbfb8da2f9f007f08($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit6eb7042105862f732d268d726514ddaa
|
||||
class ComposerStaticInit5247445f38fc915bbfb8da2f9f007f08
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -2632,6 +2632,7 @@ class ComposerStaticInit6eb7042105862f732d268d726514ddaa
|
||||
'Rector\\Naming\\PropertyRenamer\\BoolPropertyRenamer' => __DIR__ . '/../..' . '/rules/Naming/PropertyRenamer/BoolPropertyRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\MatchTypePropertyRenamer' => __DIR__ . '/../..' . '/rules/Naming/PropertyRenamer/MatchTypePropertyRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\PropertyFetchRenamer' => __DIR__ . '/../..' . '/rules/Naming/PropertyRenamer/PropertyFetchRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\PropertyPromotionRenamer' => __DIR__ . '/../..' . '/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php',
|
||||
'Rector\\Naming\\PropertyRenamer\\PropertyRenamer' => __DIR__ . '/../..' . '/rules/Naming/PropertyRenamer/PropertyRenamer.php',
|
||||
'Rector\\Naming\\RectorNamingInflector' => __DIR__ . '/../..' . '/rules/Naming/RectorNamingInflector.php',
|
||||
'Rector\\Naming\\Rector\\Assign\\RenameVariableToMatchMethodCallReturnTypeRector' => __DIR__ . '/../..' . '/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php',
|
||||
@ -3870,9 +3871,9 @@ class ComposerStaticInit6eb7042105862f732d268d726514ddaa
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6eb7042105862f732d268d726514ddaa::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6eb7042105862f732d268d726514ddaa::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6eb7042105862f732d268d726514ddaa::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit5247445f38fc915bbfb8da2f9f007f08::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit5247445f38fc915bbfb8da2f9f007f08::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit5247445f38fc915bbfb8da2f9f007f08::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
||||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210618\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa', false) && !interface_exists('ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa', false) && !trait_exists('ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa', false)) {
|
||||
spl_autoload_call('RectorPrefix20210618\ComposerAutoloaderInit6eb7042105862f732d268d726514ddaa');
|
||||
if (!class_exists('ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08', false) && !interface_exists('ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08', false) && !trait_exists('ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08', false)) {
|
||||
spl_autoload_call('RectorPrefix20210618\ComposerAutoloaderInit5247445f38fc915bbfb8da2f9f007f08');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210618\Doctrine\Inflector\Inflector');
|
||||
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20210618\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire6eb7042105862f732d268d726514ddaa')) {
|
||||
function composerRequire6eb7042105862f732d268d726514ddaa() {
|
||||
return \RectorPrefix20210618\composerRequire6eb7042105862f732d268d726514ddaa(...func_get_args());
|
||||
if (!function_exists('composerRequire5247445f38fc915bbfb8da2f9f007f08')) {
|
||||
function composerRequire5247445f38fc915bbfb8da2f9f007f08() {
|
||||
return \RectorPrefix20210618\composerRequire5247445f38fc915bbfb8da2f9f007f08(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user