mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 227e97477c44de40c165bba4b72e48dd954151d5
227e97477c
[Transform] Do not create a new node if the existing node is already the correct one on AttributeKeyToClassConstFetchRector (#5328)
This commit is contained in:
parent
90b260693b
commit
7bf2453858
|
@ -116,16 +116,25 @@ CODE_SAMPLE
|
|||
if (!$this->isName($argName, $attributeKeyToClassConstFetch->getAttributeKey())) {
|
||||
continue;
|
||||
}
|
||||
$value = $this->valueResolver->getValue($arg->value);
|
||||
$constName = $attributeKeyToClassConstFetch->getValuesToConstantsMap()[$value] ?? null;
|
||||
if ($constName === null) {
|
||||
continue;
|
||||
if ($this->processArg($arg, $attributeKeyToClassConstFetch)) {
|
||||
$hasChanged = \true;
|
||||
}
|
||||
$arg->value = $this->nodeFactory->createClassConstFetch($attributeKeyToClassConstFetch->getConstantClass(), $constName);
|
||||
$hasChanged = \true;
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
return $hasChanged;
|
||||
}
|
||||
private function processArg(Node\Arg $arg, AttributeKeyToClassConstFetch $attributeKeyToClassConstFetch) : bool
|
||||
{
|
||||
$value = $this->valueResolver->getValue($arg->value);
|
||||
$constName = $attributeKeyToClassConstFetch->getValuesToConstantsMap()[$value] ?? null;
|
||||
if ($constName === null) {
|
||||
return \false;
|
||||
}
|
||||
$newValue = $this->nodeFactory->createClassConstFetch($attributeKeyToClassConstFetch->getConstantClass(), $constName);
|
||||
if ($arg->value instanceof Node\Expr\ClassConstFetch && $this->getName($arg->value) === $this->getName($newValue)) {
|
||||
return \false;
|
||||
}
|
||||
$arg->value = $newValue;
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '589bda6cd1eb7bc6cdc68313facc02cae41ba628';
|
||||
public const PACKAGE_VERSION = '227e97477c44de40c165bba4b72e48dd954151d5';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-12-15 17:11:45';
|
||||
public const RELEASE_DATE = '2023-12-16 09:53:16';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -1457,17 +1457,17 @@
|
|||
},
|
||||
{
|
||||
"name": "react\/socket",
|
||||
"version": "v1.14.0",
|
||||
"version_normalized": "1.14.0.0",
|
||||
"version": "v1.15.0",
|
||||
"version_normalized": "1.15.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/reactphp\/socket.git",
|
||||
"reference": "21591111d3ea62e31f2254280ca0656bc2b1bda6"
|
||||
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/reactphp\/socket\/zipball\/21591111d3ea62e31f2254280ca0656bc2b1bda6",
|
||||
"reference": "21591111d3ea62e31f2254280ca0656bc2b1bda6",
|
||||
"url": "https:\/\/api.github.com\/repos\/reactphp\/socket\/zipball\/216d3aec0b87f04a40ca04f481e6af01bdd1d038",
|
||||
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1479,17 +1479,17 @@
|
|||
"react\/stream": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.5 || ^5.7 || ^4.8.35",
|
||||
"phpunit\/phpunit": "^9.6 || ^5.7 || ^4.8.36",
|
||||
"react\/async": "^4 || ^3 || ^2",
|
||||
"react\/promise-stream": "^1.4",
|
||||
"react\/promise-timer": "^1.10"
|
||||
},
|
||||
"time": "2023-08-25T13:48:09+00:00",
|
||||
"time": "2023-12-15T11:02:10+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix202312\\React\\Socket\\": "src"
|
||||
"RectorPrefix202312\\React\\Socket\\": "src\/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
|
@ -1528,7 +1528,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/reactphp\/socket\/issues",
|
||||
"source": "https:\/\/github.com\/reactphp\/socket\/tree\/v1.14.0"
|
||||
"source": "https:\/\/github.com\/reactphp\/socket\/tree\/v1.15.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,13 @@
|
|||
# Changelog
|
||||
|
||||
## 1.15.0 (2023-12-15)
|
||||
|
||||
* Feature: Full PHP 8.3 compatibility.
|
||||
(#310 by @clue)
|
||||
|
||||
* Fix: Fix cancelling during the 50ms resolution delay when DNS is still pending.
|
||||
(#311 by @clue)
|
||||
|
||||
## 1.14.0 (2023-08-25)
|
||||
|
||||
* Feature: Improve Promise v3 support and use template types.
|
||||
|
|
|
@ -1494,7 +1494,7 @@ This project follows [SemVer](https://semver.org/).
|
|||
This will install the latest supported version:
|
||||
|
||||
```bash
|
||||
composer require react/socket:^1.14
|
||||
composer require react/socket:^1.15
|
||||
```
|
||||
|
||||
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
|
||||
|
|
|
@ -40,19 +40,19 @@
|
|||
"react\/stream": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.5 || ^5.7 || ^4.8.35",
|
||||
"phpunit\/phpunit": "^9.6 || ^5.7 || ^4.8.36",
|
||||
"react\/async": "^4 || ^3 || ^2",
|
||||
"react\/promise-stream": "^1.4",
|
||||
"react\/promise-timer": "^1.10"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix202312\\React\\Socket\\": "src"
|
||||
"RectorPrefix202312\\React\\Socket\\": "src\/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RectorPrefix202312\\React\\Tests\\Socket\\": "tests"
|
||||
"RectorPrefix202312\\React\\Tests\\Socket\\": "tests\/"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,9 +56,8 @@ final class HappyEyeBallsConnectionBuilder
|
|||
}
|
||||
public function connect()
|
||||
{
|
||||
$timer = null;
|
||||
$that = $this;
|
||||
return new Promise\Promise(function ($resolve, $reject) use($that, &$timer) {
|
||||
return new Promise\Promise(function ($resolve, $reject) use($that) {
|
||||
$lookupResolve = function ($type) use($that, $resolve, $reject) {
|
||||
return function (array $ips) use($that, $type, $resolve, $reject) {
|
||||
unset($that->resolverPromises[$type]);
|
||||
|
@ -71,29 +70,29 @@ final class HappyEyeBallsConnectionBuilder
|
|||
};
|
||||
};
|
||||
$that->resolverPromises[Message::TYPE_AAAA] = $that->resolve(Message::TYPE_AAAA, $reject)->then($lookupResolve(Message::TYPE_AAAA));
|
||||
$that->resolverPromises[Message::TYPE_A] = $that->resolve(Message::TYPE_A, $reject)->then(function (array $ips) use($that, &$timer) {
|
||||
$that->resolverPromises[Message::TYPE_A] = $that->resolve(Message::TYPE_A, $reject)->then(function (array $ips) use($that) {
|
||||
// happy path: IPv6 has resolved already (or could not resolve), continue with IPv4 addresses
|
||||
if ($that->resolved[Message::TYPE_AAAA] === \true || !$ips) {
|
||||
return $ips;
|
||||
}
|
||||
// Otherwise delay processing IPv4 lookup until short timer passes or IPv6 resolves in the meantime
|
||||
$deferred = new Promise\Deferred();
|
||||
$deferred = new Promise\Deferred(function () use(&$ips) {
|
||||
// discard all IPv4 addresses if cancelled
|
||||
$ips = array();
|
||||
});
|
||||
$timer = $that->loop->addTimer($that::RESOLUTION_DELAY, function () use($deferred, $ips) {
|
||||
$deferred->resolve($ips);
|
||||
});
|
||||
$that->resolverPromises[Message::TYPE_AAAA]->then(function () use($that, $timer, $deferred, $ips) {
|
||||
$that->resolverPromises[Message::TYPE_AAAA]->then(function () use($that, $timer, $deferred, &$ips) {
|
||||
$that->loop->cancelTimer($timer);
|
||||
$deferred->resolve($ips);
|
||||
});
|
||||
return $deferred->promise();
|
||||
})->then($lookupResolve(Message::TYPE_A));
|
||||
}, function ($_, $reject) use($that, &$timer) {
|
||||
}, function ($_, $reject) use($that) {
|
||||
$reject(new \RuntimeException('Connection to ' . $that->uri . ' cancelled' . (!$that->connectionPromises ? ' during DNS lookup' : '') . ' (ECONNABORTED)', \defined('SOCKET_ECONNABORTED') ? \SOCKET_ECONNABORTED : 103));
|
||||
$_ = $reject = null;
|
||||
$that->cleanUp();
|
||||
if ($timer instanceof TimerInterface) {
|
||||
$that->loop->cancelTimer($timer);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -197,12 +196,14 @@ final class HappyEyeBallsConnectionBuilder
|
|||
{
|
||||
// clear list of outstanding IPs to avoid creating new connections
|
||||
$this->connectQueue = array();
|
||||
// cancel pending connection attempts
|
||||
foreach ($this->connectionPromises as $connectionPromise) {
|
||||
if ($connectionPromise instanceof PromiseInterface && \method_exists($connectionPromise, 'cancel')) {
|
||||
$connectionPromise->cancel();
|
||||
}
|
||||
}
|
||||
foreach ($this->resolverPromises as $resolverPromise) {
|
||||
// cancel pending DNS resolution (cancel IPv4 first in case it is awaiting IPv6 resolution delay)
|
||||
foreach (\array_reverse($this->resolverPromises) as $resolverPromise) {
|
||||
if ($resolverPromise instanceof PromiseInterface && \method_exists($resolverPromise, 'cancel')) {
|
||||
$resolverPromise->cancel();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue