Updated Rector to commit 7f73d653b9ceb059f9d05e010a7c6120f23c77ac

7f73d653b9 [Traverser] Use specific Stmt: Declare_ and Namespace_ for init namespace stmt_key index on StmtKeyNodeVisitor (#4111)
This commit is contained in:
Tomas Votruba 2023-06-08 02:08:17 +00:00
parent a97ef30b94
commit 1d6fa53888
9 changed files with 42 additions and 38 deletions

View File

@ -4,9 +4,9 @@ declare (strict_types=1);
namespace Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor;
use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Declare_;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\NodeVisitorAbstract;
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
use Rector\NodeTypeResolver\Node\AttributeKey;
@ -18,18 +18,22 @@ final class StmtKeyNodeVisitor extends NodeVisitorAbstract implements ScopeResol
*/
public function beforeTraverse(array $nodes)
{
$currentNode = \current($nodes);
if (!$currentNode instanceof Stmt) {
if ($nodes === []) {
return null;
}
$statementDepth = $currentNode->getAttribute(AttributeKey::STATEMENT_DEPTH);
if ($statementDepth > 0 || $statementDepth === null) {
if (!$nodes[0] instanceof Declare_ && !$nodes[0] instanceof Namespace_) {
return null;
}
// on target node or no other root stmt, eg: only namespace without declare, no need reindex
// on target node or no other root stmt, eg: only namespace without declare, no need to index
if (\count($nodes) === 1) {
return null;
}
// ensure statement depth is 0 to avoid declare in deep statements
// eg: declare(ticks=1) @see https://www.php.net/manual/en/control-structures.declare.php#123674
$statementDepth = $nodes[0]->getAttribute(AttributeKey::STATEMENT_DEPTH);
if ($statementDepth > 0 || $statementDepth === null) {
return null;
}
foreach ($nodes as $key => $node) {
$node->setAttribute(AttributeKey::STMT_KEY, $key);
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'fe33aad6cbff85882e60ef2461e929d5b1957456';
public const PACKAGE_VERSION = '7f73d653b9ceb059f9d05e010a7c6120f23c77ac';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-06-07 16:07:15';
public const RELEASE_DATE = '2023-06-08 09:04:34';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

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

View File

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

View File

@ -871,17 +871,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.10.17",
"version_normalized": "1.10.17.0",
"version": "1.10.18",
"version_normalized": "1.10.18.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "8aca56455b40846865e4fac9d24b010a574dc362"
"reference": "52b6416c579663eebdd2f1d97df21971daf3b43f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/8aca56455b40846865e4fac9d24b010a574dc362",
"reference": "8aca56455b40846865e4fac9d24b010a574dc362",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/52b6416c579663eebdd2f1d97df21971daf3b43f",
"reference": "52b6416c579663eebdd2f1d97df21971daf3b43f",
"shasum": ""
},
"require": {
@ -890,7 +890,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2023-06-07T15:55:47+00:00",
"time": "2023-06-07T22:00:43+00:00",
"bin": [
"phpstan",
"phpstan.phar"

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmSAqGsACgkQUcZzBf/C
5cDCPw/+PAsJDfzyfAxZPEwmQaVZkQni62zrJiQc24kwe1HybP9ACSieryurRy5V
erD+7RmaK6YPTcE9K510mf7aGlR5zge489BBDPiIdOa9YWZGO1Z6YnuC8whzpNMP
yJZYDZHK8SiWOxDgmfABYvhXMQ2SErRYaeilEaSx4ZWCGUAJP49DCZiY7Z3op4gl
iOgbBbgrzNvM7E96B0JXoTYCSYslrHim4cG77nbgmte28XC/5fzGx0eE8WyYybF0
ro3xfps8DFQtvxuOBJvJi5k5ZP1Ltb8zjBbH/ZWuS6Nz3x7Jtr9tGlJnHI9txkRd
7Akh0i1B8CpacqA/5BPwKKsK/NlEKv7QmtBHpe5Uye+uVH8ak6LRCSYVZZXxFn8J
0l1qn9Erf5iYNE5ljoPIbm9mA4w99oUrYzY+0d6ixCjk5RzQK0Oo6k3phr5j/PdS
Gpr8T8Rzx1bvN4D0qm7r+Bw2krWeSxFYkwIEGLS/1oajf7pMIAjuR2JnvnMW4BZP
MhqPS2A2gmhjkpCdpYVe5a/kD+9WucMbVUTXN6GZmLWGKi/aXF1Q6CNXkazf6pHB
aCAoxEBmdwJb4n58oos9VTWVdrm/qddw1O/MCjgiJQGrV8P9zzqO5xcpMM+AAnsE
L2M0Arr07iFyzHI+0yGucQ2N9Ys52w4nxsCxo+cK2ItgoOBoM20=
=ZVYy
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmSA/fQACgkQUcZzBf/C
5cCwLA/+K91IrL7ggTr2A/gptErLu05s1wUZ0meZfNi+457tcWsspaI67gSiqxIH
cypjMFL7gvwedB9dxJct+e0Hmh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