Updated Rector to commit 58edce71bb42b06df87e863ee9bf3df4c7b65e27

58edce71bb [VendorPatch] Register nikic-php-parser-lib-phpparser-node-stmt-namespace-php into vendor-patches list (#2825)
This commit is contained in:
Tomas Votruba 2022-08-24 07:54:32 +00:00
parent 1c32360bbd
commit 88b118d794
10 changed files with 35 additions and 22 deletions

View File

@ -64,7 +64,7 @@ CODE_SAMPLE
return null;
}
$originalStmts = $node->stmts;
$cleanedStmts = $this->processCleanUpUnreachabelStmts($node->stmts);
$cleanedStmts = $this->processCleanUpUnreachabelStmts($node, $node->stmts);
if ($cleanedStmts === $originalStmts) {
return null;
}
@ -75,7 +75,7 @@ CODE_SAMPLE
* @param Stmt[] $stmts
* @return Stmt[]
*/
private function processCleanUpUnreachabelStmts(array $stmts) : array
private function processCleanUpUnreachabelStmts(StmtsAwareInterface $stmtsAware, array $stmts) : array
{
foreach ($stmts as $key => $stmt) {
if (!isset($stmts[$key - 1])) {
@ -83,7 +83,7 @@ CODE_SAMPLE
}
$previousStmt = $stmts[$key - 1];
// unset...
if ($this->terminatedNodeAnalyzer->isAlwaysTerminated($previousStmt, $stmt)) {
if ($this->terminatedNodeAnalyzer->isAlwaysTerminated($stmtsAware, $previousStmt, $stmt)) {
\array_splice($stmts, $key);
return $stmts;
}

View File

@ -21,7 +21,6 @@ use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\TryCatch;
@ -99,7 +98,7 @@ final class ChangedNodeScopeRefresher
}
private function reIndexNodeAttributes(Node $node) : void
{
if (($node instanceof Namespace_ || $node instanceof ClassLike || $node instanceof StmtsAwareInterface) && $node->stmts !== null) {
if (($node instanceof ClassLike || $node instanceof StmtsAwareInterface) && $node->stmts !== null) {
$node->stmts = \array_values($node->stmts);
}
if ($node instanceof FunctionLike) {

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'feda30ad318904b29f342ee1cfe4d81c103d4c40';
public const PACKAGE_VERSION = '58edce71bb42b06df87e863ee9bf3df4c7b65e27';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-08-24 09:25:46';
public const RELEASE_DATE = '2022-08-24 14:50:04';
/**
* @var int
*/

View File

@ -8,19 +8,24 @@ use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Exit_;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Break_;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Continue_;
use PhpParser\Node\Stmt\Else_;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Finally_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Goto_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\InlineHTML;
use PhpParser\Node\Stmt\Label;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Nop;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\Throw_;
use PhpParser\Node\Stmt\TryCatch;
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
final class TerminatedNodeAnalyzer
{
/**
@ -39,11 +44,14 @@ final class TerminatedNodeAnalyzer
* @var array<class-string<Node>>
*/
private const ALLOWED_CONTINUE_CURRENT_STMTS = [InlineHTML::class, Nop::class];
public function isAlwaysTerminated(Stmt $node, Stmt $currentStmt) : bool
public function isAlwaysTerminated(StmtsAwareInterface $stmtsAware, Stmt $node, Stmt $currentStmt) : bool
{
if (\in_array(\get_class($currentStmt), self::ALLOWED_CONTINUE_CURRENT_STMTS, \true)) {
return \false;
}
if (($stmtsAware instanceof FileWithoutNamespace || $stmtsAware instanceof Namespace_) && ($currentStmt instanceof ClassLike || $currentStmt instanceof Function_)) {
return \false;
}
if (!\in_array(\get_class($node), self::TERMINABLE_NODES_BY_ITS_STMTS, \true)) {
return $this->isTerminatedNode($node, $currentStmt);
}

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitf0dd96300d561a258f5be70df58f0989
class ComposerAutoloaderInit23a203334751054f9dcaf69831e79efd
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitf0dd96300d561a258f5be70df58f0989
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitf0dd96300d561a258f5be70df58f0989', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit23a203334751054f9dcaf69831e79efd', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitf0dd96300d561a258f5be70df58f0989', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit23a203334751054f9dcaf69831e79efd', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitf0dd96300d561a258f5be70df58f0989::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit23a203334751054f9dcaf69831e79efd::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitf0dd96300d561a258f5be70df58f0989::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit23a203334751054f9dcaf69831e79efd::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequiref0dd96300d561a258f5be70df58f0989($fileIdentifier, $file);
composerRequire23a203334751054f9dcaf69831e79efd($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitf0dd96300d561a258f5be70df58f0989
* @param string $file
* @return void
*/
function composerRequiref0dd96300d561a258f5be70df58f0989($fileIdentifier, $file)
function composerRequire23a203334751054f9dcaf69831e79efd($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 ComposerStaticInitf0dd96300d561a258f5be70df58f0989
class ComposerStaticInit23a203334751054f9dcaf69831e79efd
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3258,9 +3258,9 @@ class ComposerStaticInitf0dd96300d561a258f5be70df58f0989
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitf0dd96300d561a258f5be70df58f0989::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf0dd96300d561a258f5be70df58f0989::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf0dd96300d561a258f5be70df58f0989::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit23a203334751054f9dcaf69831e79efd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit23a203334751054f9dcaf69831e79efd::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit23a203334751054f9dcaf69831e79efd::$classMap;
}, null, ClassLoader::class);
}

View File

@ -572,7 +572,8 @@
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-stmt-foreach-php.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-stmt-if-php.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-stmt-case-php.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch"
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch"
]
},
"installation-source": "dist",

View File

@ -57,3 +57,7 @@ Source: https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/
Source: https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch
14
Source: https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch

View File

@ -4,7 +4,8 @@ declare (strict_types=1);
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
class Namespace_ extends Node\Stmt
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
class Namespace_ extends Node\Stmt implements StmtsAwareInterface
{
/* For use in the "kind" attribute */
const KIND_SEMICOLON = 1;