Rector 0.11.8

This commit is contained in:
Tomas Votruba 2021-06-03 08:31:26 +00:00
parent 3547d90d45
commit 9ea339bb13
10 changed files with 27 additions and 27 deletions

View File

@ -128,7 +128,7 @@ CODE_SAMPLE
return \false; return \false;
} }
// just one if // just one if
if ($node->elseifs !== []) { if (\count($node->elseifs) !== 0) {
return \false; return \false;
} }
// there is some else // there is some else

View File

@ -68,7 +68,7 @@ CODE_SAMPLE
if (!$parent instanceof \PhpParser\Node) { if (!$parent instanceof \PhpParser\Node) {
return null; return null;
} }
$processIdentical = $this->processIdenticalOrNotIdentical($parent, $node, $expr); $processIdentical = $this->processIdentical($parent, $node, $expr);
if ($processIdentical !== null) { if ($processIdentical !== null) {
return $processIdentical; return $processIdentical;
} }
@ -103,14 +103,14 @@ CODE_SAMPLE
} }
return $scope->getType($expr) instanceof \PHPStan\Type\ArrayType; return $scope->getType($expr) instanceof \PHPStan\Type\ArrayType;
} }
private function processIdenticalOrNotIdentical(\PhpParser\Node $node, \PhpParser\Node\Expr\FuncCall $funcCall, \PhpParser\Node\Expr $expr) : ?\PhpParser\Node\Expr private function processIdentical(\PhpParser\Node $node, \PhpParser\Node\Expr\FuncCall $funcCall, \PhpParser\Node\Expr $expr) : ?\PhpParser\Node\Expr
{ {
if (($node instanceof \PhpParser\Node\Expr\BinaryOp\Identical || $node instanceof \PhpParser\Node\Expr\BinaryOp\NotIdentical) && $node->right instanceof \PhpParser\Node\Scalar\LNumber && $node->right->value === 0) { if ($node instanceof \PhpParser\Node\Expr\BinaryOp\Identical && $node->right instanceof \PhpParser\Node\Scalar\LNumber && $node->right->value === 0) {
$this->removeNode($funcCall); $this->removeNode($funcCall);
$node->right = new \PhpParser\Node\Expr\Array_([]); $node->right = new \PhpParser\Node\Expr\Array_([]);
return $expr; return $expr;
} }
if (($node instanceof \PhpParser\Node\Expr\BinaryOp\Identical || $node instanceof \PhpParser\Node\Expr\BinaryOp\NotIdentical) && $node->left instanceof \PhpParser\Node\Scalar\LNumber && $node->left->value === 0) { if ($node instanceof \PhpParser\Node\Expr\BinaryOp\Identical && $node->left instanceof \PhpParser\Node\Scalar\LNumber && $node->left->value === 0) {
$this->removeNode($funcCall); $this->removeNode($funcCall);
$node->left = new \PhpParser\Node\Expr\Array_([]); $node->left = new \PhpParser\Node\Expr\Array_([]);
return $expr; return $expr;

View File

@ -58,7 +58,7 @@ CODE_SAMPLE
return null; return null;
} }
// just one if // just one if
if ($node->elseifs !== []) { if (\count($node->elseifs) !== 0) {
return null; return null;
} }
$conditionStaticType = $this->getStaticType($node->cond); $conditionStaticType = $this->getStaticType($node->cond);

View File

@ -115,7 +115,7 @@ CODE_SAMPLE
if ($classMethod->isAbstract()) { if ($classMethod->isAbstract()) {
return \true; return \true;
} }
return (array) $classMethod->stmts !== []; return \count((array) $classMethod->stmts) !== 0;
} }
private function processArrowFunction(\PhpParser\Node\Expr\ArrowFunction $arrowFunction, \PhpParser\Node\Expr\MethodCall $methodCall) : \PhpParser\Node\Expr private function processArrowFunction(\PhpParser\Node\Expr\ArrowFunction $arrowFunction, \PhpParser\Node\Expr\MethodCall $methodCall) : \PhpParser\Node\Expr
{ {

View File

@ -115,7 +115,7 @@ CODE_SAMPLE
private function cleanupEmptyAttrGroups($node) : void private function cleanupEmptyAttrGroups($node) : void
{ {
foreach ($node->attrGroups as $key => $attrGroup) { foreach ($node->attrGroups as $key => $attrGroup) {
if ($attrGroup->attrs !== []) { if (\count($attrGroup->attrs) !== 0) {
continue; continue;
} }
unset($node->attrGroups[$key]); unset($node->attrGroups[$key]);

View File

@ -16,11 +16,11 @@ final class VersionResolver
/** /**
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '1913747f014f5b4663dec6b32148a8d5046a74a5'; public const PACKAGE_VERSION = '4fb6b2a88750b3467f9056ddcd4d32489f5267dd';
/** /**
* @var string * @var string
*/ */
public const RELEASE_DATE = '2021-06-03 10:19:47'; public const RELEASE_DATE = '2021-06-03 10:19:11';
public static function resolvePackageVersion() : string public static function resolvePackageVersion() : string
{ {
$process = new \RectorPrefix20210603\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); $process = new \RectorPrefix20210603\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'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit503b722da5709d387b7df681e685ac36::getLoader(); return ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit503b722da5709d387b7df681e685ac36 class ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5
{ {
private static $loader; private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit503b722da5709d387b7df681e685ac36
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit503b722da5709d387b7df681e685ac36', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit503b722da5709d387b7df681e685ac36', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit503b722da5709d387b7df681e685ac36::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit36a450b5190ce21ca1d0eda2158237c5::getInitializer($loader));
} else { } else {
$classMap = require __DIR__ . '/autoload_classmap.php'; $classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) { if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit503b722da5709d387b7df681e685ac36
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit503b722da5709d387b7df681e685ac36::$files; $includeFiles = Composer\Autoload\ComposerStaticInit36a450b5190ce21ca1d0eda2158237c5::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire503b722da5709d387b7df681e685ac36($fileIdentifier, $file); composerRequire36a450b5190ce21ca1d0eda2158237c5($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire503b722da5709d387b7df681e685ac36($fileIdentifier, $file) function composerRequire36a450b5190ce21ca1d0eda2158237c5($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit503b722da5709d387b7df681e685ac36 class ComposerStaticInit36a450b5190ce21ca1d0eda2158237c5
{ {
public static $files = array ( public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3869,9 +3869,9 @@ class ComposerStaticInit503b722da5709d387b7df681e685ac36
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit503b722da5709d387b7df681e685ac36::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit36a450b5190ce21ca1d0eda2158237c5::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit503b722da5709d387b7df681e685ac36::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit36a450b5190ce21ca1d0eda2158237c5::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit503b722da5709d387b7df681e685ac36::$classMap; $loader->classMap = ComposerStaticInit36a450b5190ce21ca1d0eda2158237c5::$classMap;
}, null, ClassLoader::class); }, 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)) { if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
spl_autoload_call('RectorPrefix20210603\CheckoutEntityFactory'); spl_autoload_call('RectorPrefix20210603\CheckoutEntityFactory');
} }
if (!class_exists('ComposerAutoloaderInit503b722da5709d387b7df681e685ac36', false) && !interface_exists('ComposerAutoloaderInit503b722da5709d387b7df681e685ac36', false) && !trait_exists('ComposerAutoloaderInit503b722da5709d387b7df681e685ac36', false)) { if (!class_exists('ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5', false) && !interface_exists('ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5', false) && !trait_exists('ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5', false)) {
spl_autoload_call('RectorPrefix20210603\ComposerAutoloaderInit503b722da5709d387b7df681e685ac36'); spl_autoload_call('RectorPrefix20210603\ComposerAutoloaderInit36a450b5190ce21ca1d0eda2158237c5');
} }
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) { if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
spl_autoload_call('RectorPrefix20210603\Doctrine\Inflector\Inflector'); spl_autoload_call('RectorPrefix20210603\Doctrine\Inflector\Inflector');
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210603\print_node(...func_get_args()); return \RectorPrefix20210603\print_node(...func_get_args());
} }
} }
if (!function_exists('composerRequire503b722da5709d387b7df681e685ac36')) { if (!function_exists('composerRequire36a450b5190ce21ca1d0eda2158237c5')) {
function composerRequire503b722da5709d387b7df681e685ac36() { function composerRequire36a450b5190ce21ca1d0eda2158237c5() {
return \RectorPrefix20210603\composerRequire503b722da5709d387b7df681e685ac36(...func_get_args()); return \RectorPrefix20210603\composerRequire36a450b5190ce21ca1d0eda2158237c5(...func_get_args());
} }
} }
if (!function_exists('parseArgs')) { if (!function_exists('parseArgs')) {