mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-16 21:08:19 +01:00
Updated Rector to commit da809660a9a2d98231f8f57b337fc3facf803b13
da809660a9
[CodeQuality] Handle on assign on FlipTypeControlToUseExclusiveTypeRector (#6653)
This commit is contained in:
parent
fa0cb009dc
commit
97c2f84d90
@ -5,12 +5,14 @@ namespace Rector\CodeQuality\Rector\Identical;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\Instanceof_;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
@ -85,6 +87,9 @@ CODE_SAMPLE
|
||||
private function processConvertToExclusiveType(ObjectType $objectType, Expr $expr, $binaryOp)
|
||||
{
|
||||
$fullyQualifiedType = $objectType instanceof ShortenedObjectType || $objectType instanceof AliasedObjectType ? $objectType->getFullyQualifiedName() : $objectType->getClassName();
|
||||
if ($expr instanceof Assign) {
|
||||
$expr->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \true);
|
||||
}
|
||||
$instanceof = new Instanceof_($expr, new FullyQualified($fullyQualifiedType));
|
||||
if ($binaryOp instanceof NotIdentical) {
|
||||
return $instanceof;
|
||||
|
@ -21,6 +21,7 @@ use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeManipulator\IfManipulator;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\Reflection\ReflectionResolver;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
@ -102,6 +103,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
if ($instanceof->expr instanceof Assign) {
|
||||
$instanceof->expr->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \false);
|
||||
$assignExpression = new Expression($instanceof->expr);
|
||||
return \array_merge([$assignExpression], $if->stmts);
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '2.0.6';
|
||||
public const PACKAGE_VERSION = 'da809660a9a2d98231f8f57b337fc3facf803b13';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2025-01-06 17:18:00';
|
||||
public const RELEASE_DATE = '2025-01-06 20:51:59';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -1866,12 +1866,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "a3253b4a96532357e8faf9e837e9be82237e2e80"
|
||||
"reference": "4661c012e9eca57e9bd4c50d9c83bcb9e6917b8a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/a3253b4a96532357e8faf9e837e9be82237e2e80",
|
||||
"reference": "a3253b4a96532357e8faf9e837e9be82237e2e80",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/4661c012e9eca57e9bd4c50d9c83bcb9e6917b8a",
|
||||
"reference": "4661c012e9eca57e9bd4c50d9c83bcb9e6917b8a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1896,7 +1896,7 @@
|
||||
"tomasvotruba\/class-leak": "^1.0",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2025-01-06T10:17:22+00:00",
|
||||
"time": "2025-01-06T12:21:26+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -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/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main f740789'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main f9cc5a0'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6b0e4f0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main a3253b4'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main f740789'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main f9cc5a0'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6b0e4f0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 4661c01'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ final class GetBySymfonyStringToConstructorInjectionRector extends AbstractRecto
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const SYMFONY_NAME_TO_TYPE_MAP = ['validator' => SymfonyClass::VALIDATOR_INTERFACE, 'event_dispatcher' => SymfonyClass::EVENT_DISPATCHER_INTERFACE, 'logger' => SymfonyClass::LOGGER_INTERFACE, 'jms_serializer' => SymfonyClass::SERIALIZER_INTERFACE, 'translator' => SymfonyClass::TRANSLATOR_INTERFACE, 'session' => SymfonyClass::SESSION, 'security.token_storage' => SymfonyClass::TOKEN_STORAGE_INTERFACE];
|
||||
private const SYMFONY_NAME_TO_TYPE_MAP = ['validator' => SymfonyClass::VALIDATOR_INTERFACE, 'event_dispatcher' => SymfonyClass::EVENT_DISPATCHER_INTERFACE, 'logger' => SymfonyClass::LOGGER_INTERFACE, 'jms_serializer' => SymfonyClass::JMS_SERIALIZER_INTERFACE, 'translator' => SymfonyClass::TRANSLATOR_INTERFACE, 'session' => SymfonyClass::SESSION_INTERFACRE, 'security.token_storage' => SymfonyClass::TOKEN_STORAGE_INTERFACE, 'router' => 'Symfony\\Component\\Routing\\RouterInterface', 'request_stack' => 'Symfony\\Component\\HttpFoundation\\RequestStack', 'http_kernel' => 'Symfony\\Component\\HttpKernel\\HttpKernelInterface', 'serializer' => 'Symfony\\Component\\Serializer\\SerializerInterface', 'security.authorization_checker' => 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface', 'templating' => 'Symfony\\Component\\Templating\\EngineInterface', 'twig' => 'Twig\\Environment', 'doctrine' => 'Doctrine\\Persistence\\ManagerRegistry', 'form.factory' => 'Symfony\\Component\\Form\\FormFactoryInterface', 'security.csrf.token_manager' => 'Symfony\\Component\\Security\\Core\\Authorization\\CsrfTokenManagerInterface', 'parameter_bag' => 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ContainerBagInterface', 'message_bus' => 'Symfony\\Component\\Messenger\\MessageBusInterface', 'messenger.default_bus' => 'Symfony\\Component\\Messenger\\MessageBusInterface'];
|
||||
public function __construct(ClassDependencyManipulator $classDependencyManipulator, ThisGetTypeMatcher $thisGetTypeMatcher, PropertyNaming $propertyNaming)
|
||||
{
|
||||
$this->classDependencyManipulator = $classDependencyManipulator;
|
||||
|
@ -36,7 +36,7 @@ final class SymfonyClass
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SERIALIZER_INTERFACE = 'JMS\\Serializer\\SerializerInterface';
|
||||
public const JMS_SERIALIZER_INTERFACE = 'JMS\\Serializer\\SerializerInterface';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -56,7 +56,7 @@ final class SymfonyClass
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SESSION = 'Symfony\\Component\\HttpFoundation\\Session\\Session';
|
||||
public const SESSION_INTERFACRE = 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user