Updated Rector to commit b5f7a09fde1d6f9a22a877499c878bcdb553854b

b5f7a09fde  [Php81] Skip increment/decrement on ReadOnlyPropertyRector (#5267)
This commit is contained in:
Tomas Votruba 2023-11-21 00:08:52 +00:00
parent e071d037e3
commit 39ef72a680
4 changed files with 18 additions and 4 deletions

View File

@ -240,7 +240,11 @@ final class AttributeKey
/**
* @var string
*/
public const IS_PARAM_VAR = 'IS_PARAM_VAR';
public const IS_PARAM_VAR = 'is_param_var';
/**
* @var string
*/
public const IS_INCREMENT_OR_DECREMENT = 'is_increment_or_decrement';
/**
* @var string
*/

View File

@ -9,6 +9,10 @@ use PhpParser\Node\Attribute;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\PostDec;
use PhpParser\Node\Expr\PostInc;
use PhpParser\Node\Expr\PreDec;
use PhpParser\Node\Expr\PreInc;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticPropertyFetch;
use PhpParser\Node\Expr\Variable;
@ -72,6 +76,9 @@ final class ContextNodeVisitor extends NodeVisitorAbstract implements ScopeResol
$node->var->setAttribute(AttributeKey::IS_PARAM_VAR, \true);
return null;
}
if ($node instanceof PostDec || $node instanceof PostInc || $node instanceof PreDec || $node instanceof PreInc) {
$node->var->setAttribute(AttributeKey::IS_INCREMENT_OR_DECREMENT, \true);
}
$this->processContextInClass($node);
return null;
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '9fa5013b41ecee17113c56ad94f219bd1940e763';
public const PACKAGE_VERSION = 'b5f7a09fde1d6f9a22a877499c878bcdb553854b';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-11-19 22:46:19';
public const RELEASE_DATE = '2023-11-21 07:06:49';
/**
* @var int
*/

View File

@ -199,7 +199,10 @@ final class PropertyManipulator
if ($propertyFetch->getAttribute(AttributeKey::INSIDE_ARRAY_DIM_FETCH, \false)) {
return \true;
}
return $propertyFetch->getAttribute(AttributeKey::IS_USED_AS_ARG_BY_REF_VALUE, \false) === \true;
if ($propertyFetch->getAttribute(AttributeKey::IS_USED_AS_ARG_BY_REF_VALUE, \false) === \true) {
return \true;
}
return $propertyFetch->getAttribute(AttributeKey::IS_INCREMENT_OR_DECREMENT, \false) === \true;
}
private function hasAllowedNotReadonlyAnnotationOrAttribute(PhpDocInfo $phpDocInfo, Class_ $class) : bool
{