Updated Rector to commit 6dd57a913efe6fd5eb03542300b93cb1c22fc4dc

6dd57a913e Merge autoImport() tests (#4050)
This commit is contained in:
Tomas Votruba 2023-06-02 13:09:14 +00:00
parent 1f621e91a4
commit 26ee850893
13 changed files with 86 additions and 50 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '88eed987cc361166359c158ffd22d264d165aa8b';
public const PACKAGE_VERSION = '6dd57a913efe6fd5eb03542300b93cb1c22fc4dc';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-06-02 12:28:24';
public const RELEASE_DATE = '2023-06-02 14:05:22';
/**
* @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 ComposerAutoloaderInit713a1ea64ac54d399d5089341c28caa7::getLoader();
return ComposerAutoloaderInit2ef9365d590669434aa1863b91b89e38::getLoader();

View File

@ -8,9 +8,9 @@ $baseDir = dirname($vendorDir);
return array(
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'972fda704d680a3a53c68e34e193cb22' => $vendorDir . '/react/promise-timer/src/functions_include.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'972fda704d680a3a53c68e34e193cb22' => $vendorDir . '/react/promise-timer/src/functions_include.php',
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
'2324d0e5cadd603331d27de142371f0b' => $vendorDir . '/symfony/contracts/Deprecation/function.php',
'd507e002f7fce7f0c6dbf1f22edcb902' => $vendorDir . '/tracy/tracy/src/Tracy/functions.php',

View File

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

View File

@ -4,14 +4,14 @@
namespace Composer\Autoload;
class ComposerStaticInit713a1ea64ac54d399d5089341c28caa7
class ComposerStaticInit2ef9365d590669434aa1863b91b89e38
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'972fda704d680a3a53c68e34e193cb22' => __DIR__ . '/..' . '/react/promise-timer/src/functions_include.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'972fda704d680a3a53c68e34e193cb22' => __DIR__ . '/..' . '/react/promise-timer/src/functions_include.php',
'9b38cf48e83f5d8f60375221cd213eee' => __DIR__ . '/..' . '/phpstan/phpstan/bootstrap.php',
'2324d0e5cadd603331d27de142371f0b' => __DIR__ . '/..' . '/symfony/contracts/Deprecation/function.php',
'd507e002f7fce7f0c6dbf1f22edcb902' => __DIR__ . '/..' . '/tracy/tracy/src/Tracy/functions.php',
@ -3068,9 +3068,9 @@ class ComposerStaticInit713a1ea64ac54d399d5089341c28caa7
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit2ef9365d590669434aa1863b91b89e38::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2ef9365d590669434aa1863b91b89e38::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2ef9365d590669434aa1863b91b89e38::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1307,36 +1307,36 @@
},
{
"name": "react\/dns",
"version": "v1.10.0",
"version_normalized": "1.10.0.0",
"version": "v1.11.0",
"version_normalized": "1.11.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/reactphp\/dns.git",
"reference": "a5427e7dfa47713e438016905605819d101f238c"
"reference": "3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/reactphp\/dns\/zipball\/a5427e7dfa47713e438016905605819d101f238c",
"reference": "a5427e7dfa47713e438016905605819d101f238c",
"url": "https:\/\/api.github.com\/repos\/reactphp\/dns\/zipball\/3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f",
"reference": "3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react\/cache": "^1.0 || ^0.6 || ^0.5",
"react\/event-loop": "^1.2",
"react\/promise": "^3.0 || ^2.7 || ^1.2.1",
"react\/promise-timer": "^1.9"
"react\/promise": "^3.0 || ^2.7 || ^1.2.1"
},
"require-dev": {
"phpunit\/phpunit": "^9.3 || ^4.8.35",
"react\/async": "^4 || ^3 || ^2"
"phpunit\/phpunit": "^9.5 || ^4.8.35",
"react\/async": "^4 || ^3 || ^2",
"react\/promise-timer": "^1.9"
},
"time": "2022-09-08T12:22:46+00:00",
"time": "2023-06-02T12:45:26+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"RectorPrefix202306\\React\\Dns\\": "src"
"RectorPrefix202306\\React\\Dns\\": "src\/"
}
},
"notification-url": "https:\/\/packagist.org\/downloads\/",
@ -1374,16 +1374,12 @@
],
"support": {
"issues": "https:\/\/github.com\/reactphp\/dns\/issues",
"source": "https:\/\/github.com\/reactphp\/dns\/tree\/v1.10.0"
"source": "https:\/\/github.com\/reactphp\/dns\/tree\/v1.11.0"
},
"funding": [
{
"url": "https:\/\/github.com\/WyriHaximus",
"type": "github"
},
{
"url": "https:\/\/github.com\/clue",
"type": "github"
"url": "https:\/\/opencollective.com\/reactphp",
"type": "open_collective"
}
],
"install-path": "..\/react\/dns"

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,13 @@
# Changelog
## 1.11.0 (2023-06-02)
* Feature: Include timeout logic to avoid dependency on reactphp/promise-timer.
(#213 by @clue)
* Improve test suite and project setup and report failed assertions.
(#210 by @clue, #212 by @WyriHaximus and #209 and #211 by @SimonFrings)
## 1.10.0 (2022-09-08)
* Feature: Full support for PHP 8.2 release.

View File

@ -115,7 +115,7 @@ See also the wiki for possible [cache implementations](https://github.com/reactp
### resolve()
The `resolve(string $domain): PromiseInterface<string,Exception>` method can be used to
The `resolve(string $domain): PromiseInterface<string>` method can be used to
resolve the given $domain name to a single IPv4 address (type `A` query).
```php
@ -151,7 +151,7 @@ $promise->cancel();
### resolveAll()
The `resolveAll(string $host, int $type): PromiseInterface<array,Exception>` method can be used to
The `resolveAll(string $host, int $type): PromiseInterface<array>` method can be used to
resolve all record values for the given $domain name and query $type.
```php
@ -410,7 +410,7 @@ This project follows [SemVer](https://semver.org/).
This will install the latest supported version:
```bash
composer require react/dns:^1.10
composer require react/dns:^1.11
```
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

View File

@ -34,21 +34,21 @@
"php": ">=5.3.0",
"react\/cache": "^1.0 || ^0.6 || ^0.5",
"react\/event-loop": "^1.2",
"react\/promise": "^3.0 || ^2.7 || ^1.2.1",
"react\/promise-timer": "^1.9"
"react\/promise": "^3.0 || ^2.7 || ^1.2.1"
},
"require-dev": {
"phpunit\/phpunit": "^9.3 || ^4.8.35",
"react\/async": "^4 || ^3 || ^2"
"phpunit\/phpunit": "^9.5 || ^4.8.35",
"react\/async": "^4 || ^3 || ^2",
"react\/promise-timer": "^1.9"
},
"autoload": {
"psr-4": {
"RectorPrefix202306\\React\\Dns\\": "src"
"RectorPrefix202306\\React\\Dns\\": "src\/"
}
},
"autoload-dev": {
"psr-4": {
"RectorPrefix202306\\React\\Tests\\Dns\\": "tests"
"RectorPrefix202306\\React\\Tests\\Dns\\": "tests\/"
}
}
}

View File

@ -36,7 +36,7 @@ interface ExecutorInterface
* ```
*
* @param Query $query
* @return \React\Promise\PromiseInterface<\React\Dns\Model\Message,\Exception>
* @return \React\Promise\PromiseInterface<\React\Dns\Model\Message>
* resolves with response message on success or rejects with an Exception on error
*/
public function query(Query $query);

View File

@ -4,7 +4,7 @@ namespace RectorPrefix202306\React\Dns\Query;
use RectorPrefix202306\React\EventLoop\Loop;
use RectorPrefix202306\React\EventLoop\LoopInterface;
use RectorPrefix202306\React\Promise\Timer;
use RectorPrefix202306\React\Promise\Promise;
final class TimeoutExecutor implements ExecutorInterface
{
private $executor;
@ -18,11 +18,43 @@ final class TimeoutExecutor implements ExecutorInterface
}
public function query(Query $query)
{
return Timer\timeout($this->executor->query($query), $this->timeout, $this->loop)->then(null, function ($e) use($query) {
if ($e instanceof Timer\TimeoutException) {
$e = new TimeoutException(\sprintf("DNS query for %s timed out", $query->describe()), 0, $e);
$promise = $this->executor->query($query);
$loop = $this->loop;
$time = $this->timeout;
return new Promise(function ($resolve, $reject) use($loop, $time, $promise, $query) {
$timer = null;
$promise = $promise->then(function ($v) use(&$timer, $loop, $resolve) {
if ($timer) {
$loop->cancelTimer($timer);
}
$timer = \false;
$resolve($v);
}, function ($v) use(&$timer, $loop, $reject) {
if ($timer) {
$loop->cancelTimer($timer);
}
$timer = \false;
$reject($v);
});
// promise already resolved => no need to start timer
if ($timer === \false) {
return;
}
throw $e;
// start timeout timer which will cancel the pending promise
$timer = $loop->addTimer($time, function () use($time, &$promise, $reject, $query) {
$reject(new TimeoutException('DNS query for ' . $query->describe() . ' timed out'));
// Cancel pending query to clean up any underlying resources and references.
// Avoid garbage references in call stack by passing pending promise by reference.
\assert(\method_exists($promise, 'cancel'));
$promise->cancel();
$promise = null;
});
}, function () use(&$promise) {
// Cancelling this promise will cancel the pending query, thus triggering the rejection logic above.
// Avoid garbage references in call stack by passing pending promise by reference.
\assert(\method_exists($promise, 'cancel'));
$promise->cancel();
$promise = null;
});
}
}

View File

@ -39,7 +39,7 @@ interface ResolverInterface
* ```
*
* @param string $domain
* @return \React\Promise\PromiseInterface<string,\Exception>
* @return \React\Promise\PromiseInterface<string>
* resolves with a single IP address on success or rejects with an Exception on error.
*/
public function resolve($domain);
@ -86,7 +86,7 @@ interface ResolverInterface
* ```
*
* @param string $domain
* @return \React\Promise\PromiseInterface<array,\Exception>
* @return \React\Promise\PromiseInterface<array>
* Resolves with all record values on success or rejects with an Exception on error.
*/
public function resolveAll($domain, $type);