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; namespace Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor;
use PhpParser\Node; use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassLike; use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Declare_; use PhpParser\Node\Stmt\Declare_;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\NodeVisitorAbstract; use PhpParser\NodeVisitorAbstract;
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\Node\AttributeKey;
@ -18,18 +18,22 @@ final class StmtKeyNodeVisitor extends NodeVisitorAbstract implements ScopeResol
*/ */
public function beforeTraverse(array $nodes) public function beforeTraverse(array $nodes)
{ {
$currentNode = \current($nodes); if ($nodes === []) {
if (!$currentNode instanceof Stmt) {
return null; return null;
} }
$statementDepth = $currentNode->getAttribute(AttributeKey::STATEMENT_DEPTH); if (!$nodes[0] instanceof Declare_ && !$nodes[0] instanceof Namespace_) {
if ($statementDepth > 0 || $statementDepth === null) {
return null; 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) { if (\count($nodes) === 1) {
return null; 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) { foreach ($nodes as $key => $node) {
$node->setAttribute(AttributeKey::STMT_KEY, $key); $node->setAttribute(AttributeKey::STMT_KEY, $key);
} }

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'fe33aad6cbff85882e60ef2461e929d5b1957456'; public const PACKAGE_VERSION = '7f73d653b9ceb059f9d05e010a7c6120f23c77ac';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2023-06-07 16:07:15'; public const RELEASE_DATE = '2023-06-08 09:04:34';
/** /**
* @var int * @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'; 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 // autoload_real.php @generated by Composer
class ComposerAutoloaderInit4bea36e922988037890330b56507d2c2 class ComposerAutoloaderInit14157378de742e5984eef7e43b2391aa
{ {
private static $loader; private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit4bea36e922988037890330b56507d2c2
return self::$loader; 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__)); 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'; 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->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit4bea36e922988037890330b56507d2c2::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInit14157378de742e5984eef7e43b2391aa::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit4bea36e922988037890330b56507d2c2 class ComposerStaticInit14157378de742e5984eef7e43b2391aa
{ {
public static $files = array ( public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3031,9 +3031,9 @@ class ComposerStaticInit4bea36e922988037890330b56507d2c2
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit4bea36e922988037890330b56507d2c2::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit14157378de742e5984eef7e43b2391aa::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4bea36e922988037890330b56507d2c2::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit14157378de742e5984eef7e43b2391aa::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4bea36e922988037890330b56507d2c2::$classMap; $loader->classMap = ComposerStaticInit14157378de742e5984eef7e43b2391aa::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

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