Skip to content

Commit

Permalink
Updated Rector to commit da809660a9a2d98231f8f57b337fc3facf803b13
Browse files Browse the repository at this point in the history
rectorphp/rector-src@da80966 [CodeQuality] Handle on assign on FlipTypeControlToUseExclusiveTypeRector (#6653)
  • Loading branch information
TomasVotruba committed Jan 6, 2025
1 parent fa0cb00 commit 97c2f84
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

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;
Expand Down Expand Up @@ -85,6 +87,9 @@ public function refactor(Node $node) : ?Node
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;
Expand Down
2 changes: 2 additions & 0 deletions rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand Down Expand Up @@ -102,6 +103,7 @@ private function refactorStmtAndInstanceof(If_ $if, Instanceof_ $instanceof)
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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
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()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions vendor/rector/rector-symfony/src/Enum/SymfonyClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down

0 comments on commit 97c2f84

Please sign in to comment.