Updated Rector to commit 8c5507f3e83e70657f95ae9ccb6488732b0359f5

8c5507f3e8 [Strict] Skip empty() from param doc on DisallowedEmptyRuleFixerRector (#4550)
This commit is contained in:
Tomas Votruba 2023-07-20 11:22:15 +00:00
parent 20d3da40c6
commit 51b2bd7a2e
9 changed files with 35 additions and 20 deletions

View File

@ -12,6 +12,7 @@ use PhpParser\Node\Expr\Empty_;
use PhpParser\Node\Expr\Isset_;
use PHPStan\Analyser\Scope;
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Core\NodeAnalyzer\ExprAnalyzer;
use Rector\Strict\NodeFactory\ExactCompareFactory;
use Rector\Strict\Rector\AbstractFalsyScalarRuleFixerRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
@ -26,9 +27,15 @@ final class DisallowedEmptyRuleFixerRector extends AbstractFalsyScalarRuleFixerR
* @var \Rector\Strict\NodeFactory\ExactCompareFactory
*/
private $exactCompareFactory;
public function __construct(ExactCompareFactory $exactCompareFactory)
/**
* @readonly
* @var \Rector\Core\NodeAnalyzer\ExprAnalyzer
*/
private $exprAnalyzer;
public function __construct(ExactCompareFactory $exactCompareFactory, ExprAnalyzer $exprAnalyzer)
{
$this->exactCompareFactory = $exactCompareFactory;
$this->exprAnalyzer = $exprAnalyzer;
}
public function getRuleDefinition() : RuleDefinition
{
@ -82,11 +89,17 @@ CODE_SAMPLE
if ($empty->expr instanceof ArrayDimFetch) {
return $this->createDimFetchBooleanAnd($empty);
}
if ($this->exprAnalyzer->isNonTypedFromParam($empty->expr)) {
return null;
}
$emptyExprType = $scope->getType($empty->expr);
return $this->exactCompareFactory->createNotIdenticalFalsyCompare($emptyExprType, $empty->expr, $this->treatAsNonEmpty);
}
private function refactorEmpty(Empty_ $empty, Scope $scope, bool $treatAsNonEmpty) : ?\PhpParser\Node\Expr
{
if ($this->exprAnalyzer->isNonTypedFromParam($empty->expr)) {
return null;
}
$exprType = $scope->getType($empty->expr);
return $this->exactCompareFactory->createIdenticalFalsyCompare($exprType, $empty->expr, $treatAsNonEmpty);
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'e2ec807d3c4b2529533bfac5eb2a2b6717fd58c2';
public const PACKAGE_VERSION = '8c5507f3e83e70657f95ae9ccb6488732b0359f5';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-07-20 11:39:23';
public const RELEASE_DATE = '2023-07-20 12:18:17';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit8466a72b22dc4378b8a06c2d4a0e540d::getLoader();
return ComposerAutoloaderIniteaf382570dcae09e23de318b6fc3cc58::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit8466a72b22dc4378b8a06c2d4a0e540d
class ComposerAutoloaderIniteaf382570dcae09e23de318b6fc3cc58
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit8466a72b22dc4378b8a06c2d4a0e540d
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit8466a72b22dc4378b8a06c2d4a0e540d', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderIniteaf382570dcae09e23de318b6fc3cc58', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit8466a72b22dc4378b8a06c2d4a0e540d', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderIniteaf382570dcae09e23de318b6fc3cc58', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticIniteaf382570dcae09e23de318b6fc3cc58::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticIniteaf382570dcae09e23de318b6fc3cc58::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d
class ComposerStaticIniteaf382570dcae09e23de318b6fc3cc58
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3023,9 +3023,9 @@ class ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8466a72b22dc4378b8a06c2d4a0e540d::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticIniteaf382570dcae09e23de318b6fc3cc58::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticIniteaf382570dcae09e23de318b6fc3cc58::$prefixDirsPsr4;
$loader->classMap = ComposerStaticIniteaf382570dcae09e23de318b6fc3cc58::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2052,12 +2052,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "3918e6fa1790daede2ca6c028a004d74021ce65c"
"reference": "37461d0069b2a3172a17efd8827008006c237e19"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/3918e6fa1790daede2ca6c028a004d74021ce65c",
"reference": "3918e6fa1790daede2ca6c028a004d74021ce65c",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/37461d0069b2a3172a17efd8827008006c237e19",
"reference": "37461d0069b2a3172a17efd8827008006c237e19",
"shasum": ""
},
"require": {
@ -2081,11 +2081,12 @@
"symplify\/phpstan-rules": "^11.4",
"symplify\/rule-doc-generator": "^11.2",
"symplify\/vendor-patches": "^11.2.0",
"tomasvotruba\/class-leak": "0.0.22.72",
"tomasvotruba\/cognitive-complexity": "^0.1",
"tomasvotruba\/type-coverage": "^0.1",
"tomasvotruba\/unused-public": "^0.1"
},
"time": "2023-07-18T15:13:05+00:00",
"time": "2023-07-20T11:17:28+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2d14418'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f901f27'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3918e6f'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main a0af12a'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2d14418'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f901f27'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 37461d0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main a0af12a'));
private function __construct()
{
}

View File

@ -23,7 +23,8 @@
"rector\/rector-generator": "^0.6.15",
"tomasvotruba\/type-coverage": "^0.1",
"tomasvotruba\/unused-public": "^0.1",
"tomasvotruba\/cognitive-complexity": "^0.1"
"tomasvotruba\/cognitive-complexity": "^0.1",
"tomasvotruba\/class-leak": "0.0.22.72"
},
"autoload": {
"psr-4": {