mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
Updated Rector to commit 67fd1651d647fca53597dbd6afe795ffe0ea75ca
67fd1651d6
[Php72] Handle crash on variable as operator on CreateFunctionToAnonymousFunctionRector (#3370)
This commit is contained in:
parent
90d627a739
commit
5b5530d0ab
@ -7,6 +7,7 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Scalar;
|
||||
use PhpParser\Node\Scalar\DNumber;
|
||||
use PhpParser\Node\Scalar\Encapsed;
|
||||
use PhpParser\Node\Scalar\EncapsedStringPart;
|
||||
use PhpParser\Node\Scalar\LNumber;
|
||||
use PhpParser\Node\Scalar\MagicConst;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
@ -46,6 +47,9 @@ final class ScalarTypeResolver implements NodeTypeResolverInterface
|
||||
if ($node instanceof Encapsed) {
|
||||
return new MixedType();
|
||||
}
|
||||
if ($node instanceof EncapsedStringPart) {
|
||||
return new ConstantStringType($node->value);
|
||||
}
|
||||
throw new NotImplementedYetException();
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '75149b2fdba0ce29e899e6610db8a703f3d30090';
|
||||
public const PACKAGE_VERSION = '67fd1651d647fca53597dbd6afe795ffe0ea75ca';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-02-11 17:51:39';
|
||||
public const RELEASE_DATE = '2023-02-11 17:52:59';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -108,25 +108,33 @@ final class InlineCodeParser
|
||||
});
|
||||
}
|
||||
if ($expr instanceof Encapsed) {
|
||||
// remove "
|
||||
$printedExpr = \trim($this->nodePrinter->print($expr), '""');
|
||||
/**
|
||||
* Encapsed "$eval_links" is printed as {$eval_links} → use its value when possible
|
||||
*/
|
||||
if (\strncmp($printedExpr, '{', \strlen('{')) === 0 && \substr_compare($printedExpr, '}', -\strlen('}')) === 0 && \count($expr->parts) === 1) {
|
||||
$currentPart = \current($expr->parts);
|
||||
$printedExpr = (string) $this->valueResolver->getValue($currentPart);
|
||||
}
|
||||
// use \$ → $
|
||||
$printedExpr = Strings::replace($printedExpr, self::PRESLASHED_DOLLAR_REGEX, '$');
|
||||
// use \'{$...}\' → $...
|
||||
return Strings::replace($printedExpr, self::CURLY_BRACKET_WRAPPER_REGEX, '$1');
|
||||
return $this->resolveEncapsedValue($expr);
|
||||
}
|
||||
if ($expr instanceof Concat) {
|
||||
return $this->resolveConcatValue($expr);
|
||||
}
|
||||
return $this->nodePrinter->print($expr);
|
||||
}
|
||||
private function resolveEncapsedValue(Encapsed $encapsed) : string
|
||||
{
|
||||
$value = '';
|
||||
$isRequirePrint = \false;
|
||||
foreach ($encapsed->parts as $part) {
|
||||
$partValue = (string) $this->valueResolver->getValue($part);
|
||||
if (\substr_compare($partValue, "'", -\strlen("'")) === 0) {
|
||||
$isRequirePrint = \true;
|
||||
break;
|
||||
}
|
||||
$value .= $partValue;
|
||||
}
|
||||
$printedExpr = $isRequirePrint ? $this->nodePrinter->print($encapsed) : $value;
|
||||
// remove "
|
||||
$printedExpr = \trim($printedExpr, '""');
|
||||
// use \$ → $
|
||||
$printedExpr = Strings::replace($printedExpr, self::PRESLASHED_DOLLAR_REGEX, '$');
|
||||
// use \'{$...}\' → $...
|
||||
return Strings::replace($printedExpr, self::CURLY_BRACKET_WRAPPER_REGEX, '$1');
|
||||
}
|
||||
private function resolveConcatValue(Concat $concat) : string
|
||||
{
|
||||
if ($concat->left instanceof Concat && $concat->right instanceof String_ && \strncmp($concat->right->value, '$', \strlen('$')) === 0) {
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInita16bae6e1b814e13798400448bf522a3::getLoader();
|
||||
return ComposerAutoloaderInit7a1775dc076fa2f8f3bf092f9f4340cb::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInita16bae6e1b814e13798400448bf522a3
|
||||
class ComposerAutoloaderInit7a1775dc076fa2f8f3bf092f9f4340cb
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInita16bae6e1b814e13798400448bf522a3
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInita16bae6e1b814e13798400448bf522a3', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7a1775dc076fa2f8f3bf092f9f4340cb', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInita16bae6e1b814e13798400448bf522a3', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7a1775dc076fa2f8f3bf092f9f4340cb', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInita16bae6e1b814e13798400448bf522a3::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7a1775dc076fa2f8f3bf092f9f4340cb::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInita16bae6e1b814e13798400448bf522a3::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit7a1775dc076fa2f8f3bf092f9f4340cb::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInita16bae6e1b814e13798400448bf522a3
|
||||
class ComposerStaticInit7a1775dc076fa2f8f3bf092f9f4340cb
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3098,9 +3098,9 @@ class ComposerStaticInita16bae6e1b814e13798400448bf522a3
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInita16bae6e1b814e13798400448bf522a3::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInita16bae6e1b814e13798400448bf522a3::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInita16bae6e1b814e13798400448bf522a3::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7a1775dc076fa2f8f3bf092f9f4340cb::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7a1775dc076fa2f8f3bf092f9f4340cb::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7a1775dc076fa2f8f3bf092f9f4340cb::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user