Rector 0.11.30

This commit is contained in:
Tomas Votruba 2021-06-30 14:48:01 +00:00
parent dee681afb9
commit 491439eed7
6 changed files with 26 additions and 38 deletions

View File

@ -92,13 +92,13 @@ CODE_SAMPLE
if (!$this->nodeComparator->areNodesEqual($needle, $comparedNeedleExpr)) {
return null;
}
$isPositive = $binaryOp instanceof \PhpParser\Node\Expr\BinaryOp\Identical;
return $this->buildReturnNode($haystack, $needle, $isPositive);
$endsWithNode = $this->nodeFactory->createFuncCall('str_ends_with', [$haystack, $needle]);
if ($binaryOp instanceof \PhpParser\Node\Expr\BinaryOp\NotIdentical) {
return new \PhpParser\Node\Expr\BooleanNot($endsWithNode);
}
return $endsWithNode;
}
/**
* @return \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\BooleanNot|null
*/
private function refactorSubstrCompare(\PhpParser\Node\Expr\BinaryOp $binaryOp)
private function refactorSubstrCompare(\PhpParser\Node\Expr\BinaryOp $binaryOp) : ?\PhpParser\Node\Expr\FuncCall
{
$funcCallAndExpr = $this->binaryOpAnalyzer->matchFuncCallAndOtherExpr($binaryOp, 'substr_compare');
if (!$funcCallAndExpr instanceof \Rector\Nette\ValueObject\FuncCallAndExpr) {
@ -115,8 +115,7 @@ CODE_SAMPLE
if (!$this->nodeComparator->areNodesEqual($needle, $comparedNeedleExpr)) {
return null;
}
$isPositive = $binaryOp instanceof \PhpParser\Node\Expr\BinaryOp\Identical;
return $this->buildReturnNode($haystack, $needle, $isPositive);
return $this->nodeFactory->createFuncCall('str_ends_with', [$haystack, $needle]);
}
private function matchUnaryMinusStrlenFuncCallArgValue(\PhpParser\Node $node) : ?\PhpParser\Node\Expr
{
@ -133,15 +132,4 @@ CODE_SAMPLE
$funcCall = $node->expr;
return $funcCall->args[0]->value;
}
/**
* @return \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\BooleanNot
*/
private function buildReturnNode(?\PhpParser\Node\Expr $haystack, ?\PhpParser\Node\Expr $needle, bool $isPositive)
{
$endsWithNode = $this->nodeFactory->createFuncCall('str_ends_with', [$haystack, $needle]);
if (!$isPositive) {
return new \PhpParser\Node\Expr\BooleanNot($endsWithNode);
}
return $endsWithNode;
}
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '9b3b306291589e499495bffd408d175f9e26f608';
public const PACKAGE_VERSION = '53697af64d37628704946ae3ebd134231b2e5a08';
/**
* @var string
*/
public const RELEASE_DATE = '2021-06-30 16:18:34';
public const RELEASE_DATE = '2021-06-30 16:03:40';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210630\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953::getLoader();
return ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953
class ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575', '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\ComposerStaticInit71a973d68bfcd450522bdfc8e6884953::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInite667713bb6a06196e400b3bbe0953575::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit71a973d68bfcd450522bdfc8e6884953::$files;
$includeFiles = Composer\Autoload\ComposerStaticInite667713bb6a06196e400b3bbe0953575::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire71a973d68bfcd450522bdfc8e6884953($fileIdentifier, $file);
composerRequiree667713bb6a06196e400b3bbe0953575($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire71a973d68bfcd450522bdfc8e6884953($fileIdentifier, $file)
function composerRequiree667713bb6a06196e400b3bbe0953575($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit71a973d68bfcd450522bdfc8e6884953
class ComposerStaticInite667713bb6a06196e400b3bbe0953575
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3840,9 +3840,9 @@ class ComposerStaticInit71a973d68bfcd450522bdfc8e6884953
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit71a973d68bfcd450522bdfc8e6884953::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit71a973d68bfcd450522bdfc8e6884953::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit71a973d68bfcd450522bdfc8e6884953::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInite667713bb6a06196e400b3bbe0953575::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite667713bb6a06196e400b3bbe0953575::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite667713bb6a06196e400b3bbe0953575::$classMap;
}, null, ClassLoader::class);
}

View File

@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
spl_autoload_call('RectorPrefix20210630\CheckoutEntityFactory');
}
if (!class_exists('ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953', false) && !interface_exists('ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953', false) && !trait_exists('ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953', false)) {
spl_autoload_call('RectorPrefix20210630\ComposerAutoloaderInit71a973d68bfcd450522bdfc8e6884953');
if (!class_exists('ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575', false) && !interface_exists('ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575', false) && !trait_exists('ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575', false)) {
spl_autoload_call('RectorPrefix20210630\ComposerAutoloaderInite667713bb6a06196e400b3bbe0953575');
}
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
spl_autoload_call('RectorPrefix20210630\Doctrine\Inflector\Inflector');
@ -3320,9 +3320,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210630\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire71a973d68bfcd450522bdfc8e6884953')) {
function composerRequire71a973d68bfcd450522bdfc8e6884953() {
return \RectorPrefix20210630\composerRequire71a973d68bfcd450522bdfc8e6884953(...func_get_args());
if (!function_exists('composerRequiree667713bb6a06196e400b3bbe0953575')) {
function composerRequiree667713bb6a06196e400b3bbe0953575() {
return \RectorPrefix20210630\composerRequiree667713bb6a06196e400b3bbe0953575(...func_get_args());
}
}
if (!function_exists('parseArgs')) {