Updated Rector to commit 3555ee38b86510be3f9ccb35fbcc8ac080b02b70

3555ee38b8 [Printer] Handle add Node after Nop not first stmt (#3312)
This commit is contained in:
Tomas Votruba 2023-01-28 09:29:15 +00:00
parent 162b97da87
commit f0d1fd41e5
6 changed files with 27 additions and 28 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '33527d4e8d3b58bfebbac94330fd59f5be08b2b2';
public const PACKAGE_VERSION = '3555ee38b86510be3f9ccb35fbcc8ac080b02b70';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-01-27 15:22:36';
public const RELEASE_DATE = '2023-01-28 16:25:02';
/**
* @var int
*/

View File

@ -47,15 +47,15 @@ final class MixPhpHtmlDecorator
/**
* @param array<Node|null> $nodes
*/
public function decorateAfterNop(Nop $nop, array $nodes) : void
public function decorateAfterNop(Nop $nop, int $key, array $nodes) : void
{
if (!isset($nodes[1]) || $nodes[1] instanceof InlineHTML) {
if (!isset($nodes[$key + 1]) || $nodes[$key + 1] instanceof InlineHTML) {
return;
}
if (!$nodes[1] instanceof Stmt) {
if (!$nodes[$key + 1] instanceof Stmt) {
return;
}
$firstNodeAfterNop = $nodes[1];
$firstNodeAfterNop = $nodes[$key + 1];
if ($firstNodeAfterNop->getStartTokenPos() >= 0) {
return;
}

View File

@ -139,15 +139,8 @@ final class BetterStandardPrinter extends Standard implements NodePrinterInterfa
return $content;
}
$content = $this->cleanEndWithPHPOpenTag($lastStmt, $content);
/** @var Node $firstStmt */
$isFirstStmtReprinted = $firstStmt->getAttribute(AttributeKey::ORIGINAL_NODE) === null;
if (!$isFirstStmtReprinted) {
return $this->cleanSurplusTag($content);
}
if (!$firstStmt instanceof InlineHTML) {
return \str_replace('<?php <?php', '<?php', $content);
}
return $this->cleanSurplusTag($content);
$content = \str_replace('<?php <?php', '<?php', $content);
return $this->cleanSurplusTag($firstStmt, $content);
}
/**
* @param \PhpParser\Node|mixed[]|null $node
@ -445,8 +438,14 @@ final class BetterStandardPrinter extends Standard implements NodePrinterInterfa
}
return $content;
}
private function cleanSurplusTag(string $content) : string
private function cleanSurplusTag(Node $node, string $content) : string
{
if (!$node instanceof InlineHTML) {
return $content;
}
if (\strncmp($content, "?>\n", \strlen("?>\n")) === 0) {
return \substr($content, 3);
}
if (\strncmp($content, "<?php\n\n?>", \strlen("<?php\n\n?>")) === 0) {
return \substr($content, 10);
}
@ -508,8 +507,8 @@ final class BetterStandardPrinter extends Standard implements NodePrinterInterfa
if ($node instanceof InlineHTML && $hasDiff) {
$this->mixPhpHtmlDecorator->decorateInlineHTML($node, $key, $nodes);
}
if ($node instanceof Nop && $key === 0 && $hasDiff) {
$this->mixPhpHtmlDecorator->decorateAfterNop($node, $nodes);
if ($node instanceof Nop && $hasDiff) {
$this->mixPhpHtmlDecorator->decorateAfterNop($node, $key, $nodes);
}
$this->docBlockUpdater->updateNodeWithPhpDocInfo($node);
}

2
vendor/autoload.php vendored
View File

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

View File

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