Updated Rector to commit 0acf4bd13469aff2ad461317d026234840aa8091

0acf4bd134 Simplify UseIdenticalOverEqualWithSameTypeRector (#5029)
This commit is contained in:
Tomas Votruba 2023-09-16 11:56:33 +00:00
parent 01c783a2bf
commit 279e6b242e
5 changed files with 14 additions and 33 deletions

View File

@ -20,15 +20,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
*/
final class UseIdenticalOverEqualWithSameTypeRector extends AbstractRector
{
/**
* @readonly
* @var \Rector\Core\NodeAnalyzer\ExprAnalyzer
*/
private $exprAnalyzer;
public function __construct(ExprAnalyzer $exprAnalyzer)
{
$this->exprAnalyzer = $exprAnalyzer;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Use ===/!== over ==/!=, it values have the same type', [new CodeSample(<<<'CODE_SAMPLE'
@ -65,7 +56,7 @@ CODE_SAMPLE
*/
public function refactor(Node $node) : ?Node
{
$leftStaticType = $this->getType($node->left);
$leftStaticType = $this->nodeTypeResolver->getNativeType($node->left);
// objects can be different by content
if ($leftStaticType instanceof ObjectType) {
return null;
@ -73,7 +64,7 @@ CODE_SAMPLE
if ($leftStaticType instanceof MixedType) {
return null;
}
$rightStaticType = $this->getType($node->right);
$rightStaticType = $this->nodeTypeResolver->getNativeType($node->right);
if ($rightStaticType instanceof MixedType) {
return null;
}
@ -81,19 +72,9 @@ CODE_SAMPLE
if (!$leftStaticType->equals($rightStaticType)) {
return null;
}
if ($this->areNonTypedFromParam($node->left, $node->right)) {
return null;
}
if ($node instanceof Equal) {
return new Identical($node->left, $node->right);
}
return new NotIdentical($node->left, $node->right);
}
private function areNonTypedFromParam(Expr $left, Expr $right) : bool
{
if ($this->exprAnalyzer->isNonTypedFromParam($left)) {
return \true;
}
return $this->exprAnalyzer->isNonTypedFromParam($right);
}
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'c8ff683305a228aa2bfbe2c11eccc7a712c5db94';
public const PACKAGE_VERSION = '0acf4bd13469aff2ad461317d026234840aa8091';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-09-16 13:42:27';
public const RELEASE_DATE = '2023-09-16 13:53:39';
/**
* @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 ComposerAutoloaderInitf2f9f32ac35c78d31d1040c9deef4344::getLoader();
return ComposerAutoloaderInit094d7b995b2bd66adbf9d22d39e15d69::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitf2f9f32ac35c78d31d1040c9deef4344
class ComposerAutoloaderInit094d7b995b2bd66adbf9d22d39e15d69
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInitf2f9f32ac35c78d31d1040c9deef4344
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitf2f9f32ac35c78d31d1040c9deef4344', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit094d7b995b2bd66adbf9d22d39e15d69', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitf2f9f32ac35c78d31d1040c9deef4344', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit094d7b995b2bd66adbf9d22d39e15d69', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit094d7b995b2bd66adbf9d22d39e15d69::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit094d7b995b2bd66adbf9d22d39e15d69::$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 ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344
class ComposerStaticInit094d7b995b2bd66adbf9d22d39e15d69
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2593,9 +2593,9 @@ class ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf2f9f32ac35c78d31d1040c9deef4344::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit094d7b995b2bd66adbf9d22d39e15d69::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit094d7b995b2bd66adbf9d22d39e15d69::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit094d7b995b2bd66adbf9d22d39e15d69::$classMap;
}, null, ClassLoader::class);
}