Updated Rector to commit 240fa27dca3e215bdfea9b329558d495ea344aa0

240fa27dca  Move Reprint previous node of first node early to NodeAddingPostRector, mix html+php take 4 (#3290)
This commit is contained in:
Tomas Votruba 2023-01-15 18:55:14 +00:00
parent 635ae189f6
commit 99023d8977
11 changed files with 29 additions and 33 deletions

View File

@ -4,6 +4,8 @@ declare (strict_types=1);
namespace Rector\PostRector\Rector;
use PhpParser\Node;
use PhpParser\Node\Stmt\InlineHTML;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PostRector\Collector\NodesToAddCollector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -48,6 +50,11 @@ final class NodeAddingPostRector extends \Rector\PostRector\Rector\AbstractPostR
if ($nodesToAddBefore !== []) {
$this->nodesToAddCollector->clearNodesToAddBefore($node);
$newNodes = \array_merge($nodesToAddBefore, $newNodes);
$firstNodePreviousNode = $node->getAttribute(AttributeKey::PREVIOUS_NODE);
if ($firstNodePreviousNode instanceof InlineHTML && !$node instanceof InlineHTML) {
// re-print InlineHTML is safe
$firstNodePreviousNode->setAttribute(AttributeKey::ORIGINAL_NODE, null);
}
}
if ($newNodes === [$node]) {
return $node;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'ee9bacf6f6e76439ed9192ff39313977aef9c17b';
public const PACKAGE_VERSION = '240fa27dca3e215bdfea9b329558d495ea344aa0';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-01-15 19:35:38';
public const RELEASE_DATE = '2023-01-16 01:50:57';
/**
* @var int
*/

View File

@ -440,14 +440,7 @@ final class BetterStandardPrinter extends Standard implements NodePrinterInterfa
if (\strncmp($content, '<?php' . $this->nl . $this->nl . '?>', \strlen('<?php' . $this->nl . $this->nl . '?>')) === 0) {
return \substr($content, 10);
}
if (\strncmp($content, '?>' . $this->nl, \strlen('?>' . $this->nl)) !== 0) {
return $content;
}
if (\strpos($content, '<?php <?php' . $this->nl) === \false) {
return $content;
}
$content = \str_replace('<?php <?php' . $this->nl, '<?php' . $this->nl, $content);
return \substr($content, 3);
return $content;
}
/**
* @param \PhpParser\Node\Scalar\LNumber|\PhpParser\Node\Scalar\DNumber $lNumber

View File

@ -383,10 +383,6 @@ CODE_SAMPLE;
{
$firstNode = \current($nodes);
$firstNodePreviousNode = $firstNode->getAttribute(AttributeKey::PREVIOUS_NODE);
if ($firstNodePreviousNode instanceof InlineHTML && !$firstNode instanceof InlineHTML) {
// re-print InlineHTML is safe
$firstNodePreviousNode->setAttribute(AttributeKey::ORIGINAL_NODE, null);
}
if (!$firstNodePreviousNode instanceof Node && $node->hasAttribute(AttributeKey::PREVIOUS_NODE)) {
/** @var Node $previousNode */
$previousNode = $node->getAttribute(AttributeKey::PREVIOUS_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 ComposerAutoloaderInit89c2d3c6aee93ad3dd811a27ef14f818::getLoader();
return ComposerAutoloaderInit41dbe5449e0c816599f3c21de2aa8cd6::getLoader();

View File

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

View File

@ -1913,12 +1913,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "3966deef7984ffc03b35ae37c604a852a5971402"
"reference": "3e9c70cfbf3ed9690a4d9612ad998ebd041d12c1"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/3966deef7984ffc03b35ae37c604a852a5971402",
"reference": "3966deef7984ffc03b35ae37c604a852a5971402",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/3e9c70cfbf3ed9690a4d9612ad998ebd041d12c1",
"reference": "3e9c70cfbf3ed9690a4d9612ad998ebd041d12c1",
"shasum": ""
},
"require": {
@ -1937,7 +1937,7 @@
"rector\/rector-debugging": "dev-main",
"rector\/rector-generator": "^0.6.14",
"rector\/rector-src": "dev-main",
"symplify\/easy-ci": "^11.1",
"symplify\/easy-ci": "^11.2",
"symplify\/easy-coding-standard": "^11.1",
"symplify\/phpstan-extensions": "^11.1",
"symplify\/phpstan-rules": "^11.1",
@ -1947,7 +1947,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-01-15T02:05:25+00:00",
"time": "2023-01-15T13:28:08+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -1977,7 +1977,7 @@
"description": "Rector downgrade PHP rules",
"support": {
"issues": "https:\/\/github.com\/rectorphp\/rector-downgrade-php\/issues",
"source": "https:\/\/github.com\/rectorphp\/rector-downgrade-php\/tree\/main"
"source": "https:\/\/github.com\/rectorphp\/rector-downgrade-php\/tree\/0.14.3"
},
"install-path": "..\/rector\/rector-downgrade-php"
},

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f0c3c11'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3966dee'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2cfc0a5'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3b132c1'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f0c3c11'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3e9c70c'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2cfc0a5'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3b132c1'));
private function __construct()
{
}

View File

@ -16,7 +16,7 @@
"rector\/rector-debugging": "dev-main",
"rector\/rector-generator": "^0.6.14",
"rector\/rector-src": "dev-main",
"symplify\/easy-ci": "^11.1",
"symplify\/easy-ci": "^11.2",
"symplify\/easy-coding-standard": "^11.1",
"symplify\/phpstan-extensions": "^11.1",
"symplify\/phpstan-rules": "^11.1",