mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit cc3354aa8e764fd028f5de5ac1fb76e9304bdbbd
cc3354aa8e
[Parser] Remove next attribute usage on InlineCodeParser (#3864)
This commit is contained in:
parent
bd630a0db2
commit
9ae4a949d6
|
@ -54,10 +54,10 @@ abstract class AbstractTestCase extends TestCase
|
|||
}
|
||||
try {
|
||||
$object = self::$currentContainer->get($type);
|
||||
} catch (Throwable $e) {
|
||||
} catch (Throwable $throwable) {
|
||||
// clear compiled container cache, to trigger re-discovery
|
||||
RectorKernel::clearCache();
|
||||
throw $e;
|
||||
throw $throwable;
|
||||
}
|
||||
if ($object === null) {
|
||||
$message = \sprintf('Service "%s" was not found', $type);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\EarlyReturn\Rector\Return_;
|
||||
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
|
||||
|
@ -77,7 +78,7 @@ CODE_SAMPLE
|
|||
* @param Return_ $node
|
||||
* @return null|Node[]
|
||||
*/
|
||||
public function refactorWithScope(Node $node, \PHPStan\Analyser\Scope $scope) : ?array
|
||||
public function refactorWithScope(Node $node, Scope $scope) : ?array
|
||||
{
|
||||
if (!$node->expr instanceof BooleanOr) {
|
||||
return null;
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '3bdd519e03e957461a48105820c20b35706f036e';
|
||||
public const PACKAGE_VERSION = 'cc3354aa8e764fd028f5de5ac1fb76e9304bdbbd';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-05-15 16:54:24';
|
||||
public const RELEASE_DATE = '2023-05-16 00:46:02';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ final class RectorKernel
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CACHE_KEY = 'v7';
|
||||
private const CACHE_KEY = 'v8';
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface|null
|
||||
*/
|
||||
|
@ -52,11 +52,7 @@ final class RectorKernel
|
|||
if ($configFiles === []) {
|
||||
return $this->buildContainer([]);
|
||||
}
|
||||
if ($this->dumpFileCache) {
|
||||
$container = $this->buildCachedContainer($configFiles);
|
||||
} else {
|
||||
$container = $this->buildContainer($configFiles);
|
||||
}
|
||||
$container = $this->dumpFileCache ? $this->buildCachedContainer($configFiles) : $this->buildContainer($configFiles);
|
||||
return $this->container = $container;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,6 @@ use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual;
|
|||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\Cast\Bool_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
final class AssignAndBinaryMap
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -7,14 +7,14 @@ use RectorPrefix202305\Nette\Utils\FileSystem;
|
|||
use RectorPrefix202305\Nette\Utils\Strings;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Scalar\Encapsed;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\Node\Stmt;
|
||||
use Rector\Core\Contract\PhpParser\NodePrinterInterface;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\Core\Provider\CurrentFileProvider;
|
||||
use Rector\Core\Util\StringUtils;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
final class InlineCodeParser
|
||||
{
|
||||
/**
|
||||
|
@ -67,11 +67,17 @@ final class InlineCodeParser
|
|||
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
|
||||
*/
|
||||
private $valueResolver;
|
||||
public function __construct(NodePrinterInterface $nodePrinter, \Rector\Core\PhpParser\Parser\SimplePhpParser $simplePhpParser, ValueResolver $valueResolver)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Provider\CurrentFileProvider
|
||||
*/
|
||||
private $currentFileProvider;
|
||||
public function __construct(NodePrinterInterface $nodePrinter, \Rector\Core\PhpParser\Parser\SimplePhpParser $simplePhpParser, ValueResolver $valueResolver, CurrentFileProvider $currentFileProvider)
|
||||
{
|
||||
$this->nodePrinter = $nodePrinter;
|
||||
$this->simplePhpParser = $simplePhpParser;
|
||||
$this->valueResolver = $valueResolver;
|
||||
$this->currentFileProvider = $currentFileProvider;
|
||||
}
|
||||
/**
|
||||
* @return Stmt[]
|
||||
|
@ -132,9 +138,11 @@ final class InlineCodeParser
|
|||
if ($concat->left instanceof Concat && $concat->right instanceof String_ && \strncmp($concat->right->value, '$', \strlen('$')) === 0) {
|
||||
$concat->right->value = '.' . $concat->right->value;
|
||||
}
|
||||
if ($concat->right instanceof String_ && \strncmp($concat->right->value, '($', \strlen('($')) === 0) {
|
||||
$node = $concat->getAttribute(AttributeKey::NEXT_NODE);
|
||||
if ($node instanceof Variable) {
|
||||
$file = $this->currentFileProvider->getFile();
|
||||
if ($concat->right instanceof String_ && \strncmp($concat->right->value, '($', \strlen('($')) === 0 && $file instanceof File) {
|
||||
$oldTokens = $file->getOldTokens();
|
||||
$endTokenPos = $concat->right->getEndTokenPos();
|
||||
if (isset($oldTokens[$endTokenPos][1]) && \strncmp((string) $oldTokens[$endTokenPos][1], "'(\$", \strlen("'(\$")) === 0) {
|
||||
$concat->right->value .= '.';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit781e088dbb43b3eb3aadceb49f9d3212::getLoader();
|
||||
return ComposerAutoloaderInitfbae4cd76e24cf86b6ad18d6a4aec363::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit781e088dbb43b3eb3aadceb49f9d3212
|
||||
class ComposerAutoloaderInitfbae4cd76e24cf86b6ad18d6a4aec363
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit781e088dbb43b3eb3aadceb49f9d3212
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit781e088dbb43b3eb3aadceb49f9d3212', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfbae4cd76e24cf86b6ad18d6a4aec363', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit781e088dbb43b3eb3aadceb49f9d3212', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfbae4cd76e24cf86b6ad18d6a4aec363', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitfbae4cd76e24cf86b6ad18d6a4aec363::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitfbae4cd76e24cf86b6ad18d6a4aec363::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212
|
||||
class ComposerStaticInitfbae4cd76e24cf86b6ad18d6a4aec363
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3103,9 +3103,9 @@ class ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit781e088dbb43b3eb3aadceb49f9d3212::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitfbae4cd76e24cf86b6ad18d6a4aec363::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitfbae4cd76e24cf86b6ad18d6a4aec363::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitfbae4cd76e24cf86b6ad18d6a4aec363::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue