mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 11:50:51 +00:00
Updated Rector to commit 6aa48e1034
6aa48e1034
[DowngradePhp71] Add DowngradePhp71JsonConstRector (#1784)
This commit is contained in:
parent
adcb702c28
commit
b6f1f45d00
|
@ -7,6 +7,7 @@ use Rector\Core\Configuration\Option;
|
|||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp71\Rector\Array_\SymmetricArrayDestructuringToListRector;
|
||||
use Rector\DowngradePhp71\Rector\ClassConst\DowngradeClassConstantVisibilityRector;
|
||||
use Rector\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector;
|
||||
use Rector\DowngradePhp71\Rector\FuncCall\DowngradeIsIterableRector;
|
||||
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeIterablePseudoTypeDeclarationRector;
|
||||
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeNullableTypeDeclarationRector;
|
||||
|
@ -30,4 +31,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
|||
$services->set(\Rector\DowngradePhp71\Rector\FunctionLike\DowngradeIterablePseudoTypeDeclarationRector::class);
|
||||
$services->set(\Rector\DowngradePhp71\Rector\FuncCall\DowngradeIsIterableRector::class);
|
||||
$services->set(\Rector\DowngradePhp71\Rector\StaticCall\DowngradeClosureFromCallableRector::class);
|
||||
$services->set(\Rector\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector::class);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DowngradePhp71\Rector\ConstFetch;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\BinaryOp\BitwiseOr;
|
||||
use PhpParser\Node\Expr\ConstFetch;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DowngradePhp72\NodeManipulator\JsonConstCleaner;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @changelog https://www.php.net/manual/en/function.json-encode.php#refsect1-function.json-encode-changelog
|
||||
*
|
||||
* @see \Rector\Tests\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector\DowngradePhp71JsonConstRectorTest
|
||||
*/
|
||||
final class DowngradePhp71JsonConstRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const CONSTANTS = ['JSON_UNESCAPED_LINE_TERMINATORS'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DowngradePhp72\NodeManipulator\JsonConstCleaner
|
||||
*/
|
||||
private $jsonConstCleaner;
|
||||
public function __construct(\Rector\DowngradePhp72\NodeManipulator\JsonConstCleaner $jsonConstCleaner)
|
||||
{
|
||||
$this->jsonConstCleaner = $jsonConstCleaner;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove Json constant that available only in php 7.1', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
json_encode($content, JSON_UNESCAPED_LINE_TERMINATORS);
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
json_encode($content, 0);
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Expr\ConstFetch::class, \PhpParser\Node\Expr\BinaryOp\BitwiseOr::class];
|
||||
}
|
||||
/**
|
||||
* @param ConstFetch|BitwiseOr $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
return $this->jsonConstCleaner->clean($node, self::CONSTANTS);
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '78a42c7b8a9b3f56365241437c760d076af149b9';
|
||||
public const PACKAGE_VERSION = '6aa48e1034197091cf8c676072adb6cb5815b5fe';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-02-09 05:12:41';
|
||||
public const RELEASE_DATE = '2022-02-09 05:20:49';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220208\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58::getLoader();
|
||||
return ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624::getLoader();
|
||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -1986,6 +1986,7 @@ return array(
|
|||
'Rector\\DowngradePhp70\\Tokenizer\\WrappedInParenthesesAnalyzer' => $baseDir . '/rules/DowngradePhp70/Tokenizer/WrappedInParenthesesAnalyzer.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\Array_\\SymmetricArrayDestructuringToListRector' => $baseDir . '/rules/DowngradePhp71/Rector/Array_/SymmetricArrayDestructuringToListRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\ClassConst\\DowngradeClassConstantVisibilityRector' => $baseDir . '/rules/DowngradePhp71/Rector/ClassConst/DowngradeClassConstantVisibilityRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\ConstFetch\\DowngradePhp71JsonConstRector' => $baseDir . '/rules/DowngradePhp71/Rector/ConstFetch/DowngradePhp71JsonConstRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\FuncCall\\DowngradeIsIterableRector' => $baseDir . '/rules/DowngradePhp71/Rector/FuncCall/DowngradeIsIterableRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\FunctionLike\\DowngradeIterablePseudoTypeDeclarationRector' => $baseDir . '/rules/DowngradePhp71/Rector/FunctionLike/DowngradeIterablePseudoTypeDeclarationRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\FunctionLike\\DowngradeNullableTypeDeclarationRector' => $baseDir . '/rules/DowngradePhp71/Rector/FunctionLike/DowngradeNullableTypeDeclarationRector.php',
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58
|
||||
class ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit3ca87db3aa5231356decdf31415d3a58::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit20d3ed2e5604c2085a552190c9fb5624::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,12 +42,12 @@ class ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit3ca87db3aa5231356decdf31415d3a58::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit20d3ed2e5604c2085a552190c9fb5624::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire3ca87db3aa5231356decdf31415d3a58($fileIdentifier, $file);
|
||||
composerRequire20d3ed2e5604c2085a552190c9fb5624($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -59,7 +59,7 @@ class ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire3ca87db3aa5231356decdf31415d3a58($fileIdentifier, $file)
|
||||
function composerRequire20d3ed2e5604c2085a552190c9fb5624($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit3ca87db3aa5231356decdf31415d3a58
|
||||
class ComposerStaticInit20d3ed2e5604c2085a552190c9fb5624
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -2376,6 +2376,7 @@ class ComposerStaticInit3ca87db3aa5231356decdf31415d3a58
|
|||
'Rector\\DowngradePhp70\\Tokenizer\\WrappedInParenthesesAnalyzer' => __DIR__ . '/../..' . '/rules/DowngradePhp70/Tokenizer/WrappedInParenthesesAnalyzer.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\Array_\\SymmetricArrayDestructuringToListRector' => __DIR__ . '/../..' . '/rules/DowngradePhp71/Rector/Array_/SymmetricArrayDestructuringToListRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\ClassConst\\DowngradeClassConstantVisibilityRector' => __DIR__ . '/../..' . '/rules/DowngradePhp71/Rector/ClassConst/DowngradeClassConstantVisibilityRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\ConstFetch\\DowngradePhp71JsonConstRector' => __DIR__ . '/../..' . '/rules/DowngradePhp71/Rector/ConstFetch/DowngradePhp71JsonConstRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\FuncCall\\DowngradeIsIterableRector' => __DIR__ . '/../..' . '/rules/DowngradePhp71/Rector/FuncCall/DowngradeIsIterableRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\FunctionLike\\DowngradeIterablePseudoTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/DowngradePhp71/Rector/FunctionLike/DowngradeIterablePseudoTypeDeclarationRector.php',
|
||||
'Rector\\DowngradePhp71\\Rector\\FunctionLike\\DowngradeNullableTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/DowngradePhp71/Rector/FunctionLike/DowngradeNullableTypeDeclarationRector.php',
|
||||
|
@ -3864,9 +3865,9 @@ class ComposerStaticInit3ca87db3aa5231356decdf31415d3a58
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit3ca87db3aa5231356decdf31415d3a58::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit3ca87db3aa5231356decdf31415d3a58::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit3ca87db3aa5231356decdf31415d3a58::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit20d3ed2e5604c2085a552190c9fb5624::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit20d3ed2e5604c2085a552190c9fb5624::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit20d3ed2e5604c2085a552190c9fb5624::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
|||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20220208\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58', false) && !interface_exists('ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58', false) && !trait_exists('ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58', false)) {
|
||||
spl_autoload_call('RectorPrefix20220208\ComposerAutoloaderInit3ca87db3aa5231356decdf31415d3a58');
|
||||
if (!class_exists('ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624', false) && !interface_exists('ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624', false) && !trait_exists('ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624', false)) {
|
||||
spl_autoload_call('RectorPrefix20220208\ComposerAutoloaderInit20d3ed2e5604c2085a552190c9fb5624');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20220208\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20220208\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire3ca87db3aa5231356decdf31415d3a58')) {
|
||||
function composerRequire3ca87db3aa5231356decdf31415d3a58() {
|
||||
return \RectorPrefix20220208\composerRequire3ca87db3aa5231356decdf31415d3a58(...func_get_args());
|
||||
if (!function_exists('composerRequire20d3ed2e5604c2085a552190c9fb5624')) {
|
||||
function composerRequire20d3ed2e5604c2085a552190c9fb5624() {
|
||||
return \RectorPrefix20220208\composerRequire20d3ed2e5604c2085a552190c9fb5624(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user