mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-21 10:32:24 +00:00
Updated Rector to commit de333f27982cd1b27450c6dfa87ec723b29fbc1c
de333f2798
[Php71] Skip re-assigned as array on AssignArrayToStringRector (#5261)
This commit is contained in:
parent
b83524f932
commit
5fa526e204
|
@ -143,10 +143,14 @@ CODE_SAMPLE
|
|||
return [];
|
||||
}
|
||||
$assignedArrayDimFetches = [];
|
||||
$this->traverseNodesWithCallable($node->stmts, function (Node $node) use($variableName, &$assignedArrayDimFetches) {
|
||||
$this->traverseNodesWithCallable($node->stmts, function (Node $node) use($variable, $variableName, &$assignedArrayDimFetches) {
|
||||
if (!$node instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isReAssignedAsArray($node, $variableName, $variable)) {
|
||||
$assignedArrayDimFetches = [];
|
||||
return NodeTraverser::STOP_TRAVERSAL;
|
||||
}
|
||||
if (!$node->var instanceof ArrayDimFetch) {
|
||||
return null;
|
||||
}
|
||||
|
@ -161,6 +165,16 @@ CODE_SAMPLE
|
|||
});
|
||||
return $assignedArrayDimFetches;
|
||||
}
|
||||
private function isReAssignedAsArray(Assign $assign, string $variableName, Variable $variable) : bool
|
||||
{
|
||||
if ($assign->var instanceof Variable && $this->isName($assign->var, $variableName) && !$this->nodeComparator->areSameNode($assign->var, $variable)) {
|
||||
$exprType = $this->nodeTypeResolver->getNativeType($assign->expr);
|
||||
if ($exprType->isArray()->yes()) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\Namespace_|\Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure $node
|
||||
*/
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '6a2af1878843ade4b1890f9a1a04f815cc600fa4';
|
||||
public const PACKAGE_VERSION = 'de333f27982cd1b27450c6dfa87ec723b29fbc1c';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-11-18 20:52:32';
|
||||
public const RELEASE_DATE = '2023-11-19 07:00:14';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
14
vendor/composer/installed.json
vendored
14
vendor/composer/installed.json
vendored
|
@ -858,17 +858,17 @@
|
|||
},
|
||||
{
|
||||
"name": "phpstan\/phpdoc-parser",
|
||||
"version": "1.24.2",
|
||||
"version_normalized": "1.24.2.0",
|
||||
"version": "1.24.3",
|
||||
"version_normalized": "1.24.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
||||
"reference": "bcad8d995980440892759db0c32acae7c8e79442"
|
||||
"reference": "12f01d214f1c73b9c91fdb3b1c415e4c70652083"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/bcad8d995980440892759db0c32acae7c8e79442",
|
||||
"reference": "bcad8d995980440892759db0c32acae7c8e79442",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/12f01d214f1c73b9c91fdb3b1c415e4c70652083",
|
||||
"reference": "12f01d214f1c73b9c91fdb3b1c415e4c70652083",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -885,7 +885,7 @@
|
|||
"phpunit\/phpunit": "^9.5",
|
||||
"symfony\/process": "^5.2"
|
||||
},
|
||||
"time": "2023-09-26T12:28:12+00:00",
|
||||
"time": "2023-11-18T20:15:32+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -902,7 +902,7 @@
|
|||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
|
||||
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.24.2"
|
||||
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.24.3"
|
||||
},
|
||||
"install-path": "..\/phpstan\/phpdoc-parser"
|
||||
},
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -8,7 +8,9 @@ use PHPStan\PhpDocParser\Ast;
|
|||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use function in_array;
|
||||
use function str_replace;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function substr_compare;
|
||||
use function trim;
|
||||
class TypeParser
|
||||
{
|
||||
|
@ -270,8 +272,10 @@ class TypeParser
|
|||
if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) {
|
||||
return \false;
|
||||
}
|
||||
$endTag = '</' . $htmlTagName . '>';
|
||||
$endTagSearchOffset = -strlen($endTag);
|
||||
while (!$tokens->isCurrentTokenType(Lexer::TOKEN_END)) {
|
||||
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET) && strpos($tokens->currentTokenValue(), '/' . $htmlTagName . '>') !== \false) {
|
||||
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET) && strpos($tokens->currentTokenValue(), '/' . $htmlTagName . '>') !== \false || substr_compare($tokens->currentTokenValue(), $endTag, $endTagSearchOffset) === 0) {
|
||||
return \true;
|
||||
}
|
||||
$tokens->next();
|
||||
|
|
Loading…
Reference in New Issue
Block a user