mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 3d4a86c31511bda1ded00a70ed36c72849d19824
3d4a86c315
[ReadWrite] Remove parent lookup on ArrayDimFetchParentNodeReadAnalyzer (#4239)
This commit is contained in:
parent
ca2ed9bbb4
commit
73e6cf210e
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit27cadd2da67bad042cafae5b8cc6140c::getLoader();
|
||||
return ComposerAutoloaderInit66478d05f1b007e13f2ce38afed69d48::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit27cadd2da67bad042cafae5b8cc6140c
|
||||
class ComposerAutoloaderInit66478d05f1b007e13f2ce38afed69d48
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit27cadd2da67bad042cafae5b8cc6140c
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit27cadd2da67bad042cafae5b8cc6140c', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit66478d05f1b007e13f2ce38afed69d48', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit27cadd2da67bad042cafae5b8cc6140c', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit66478d05f1b007e13f2ce38afed69d48', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit66478d05f1b007e13f2ce38afed69d48::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit66478d05f1b007e13f2ce38afed69d48::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c
|
||||
class ComposerStaticInit66478d05f1b007e13f2ce38afed69d48
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3092,9 +3092,9 @@ class ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit27cadd2da67bad042cafae5b8cc6140c::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit66478d05f1b007e13f2ce38afed69d48::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit66478d05f1b007e13f2ce38afed69d48::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit66478d05f1b007e13f2ce38afed69d48::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
@ -1778,17 +1778,17 @@
|
|||
},
|
||||
{
|
||||
"name": "react\/stream",
|
||||
"version": "v1.2.0",
|
||||
"version_normalized": "1.2.0.0",
|
||||
"version": "v1.3.0",
|
||||
"version_normalized": "1.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/reactphp\/stream.git",
|
||||
"reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9"
|
||||
"reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/reactphp\/stream\/zipball\/7a423506ee1903e89f1e08ec5f0ed430ff784ae9",
|
||||
"reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9",
|
||||
"url": "https:\/\/api.github.com\/repos\/reactphp\/stream\/zipball\/6fbc9672905c7d5a885f2da2fc696f65840f4a66",
|
||||
"reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1798,14 +1798,14 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"clue\/stream-filter": "~1.2",
|
||||
"phpunit\/phpunit": "^9.3 || ^5.7 || ^4.8.35"
|
||||
"phpunit\/phpunit": "^9.5 || ^5.7 || ^4.8.35"
|
||||
},
|
||||
"time": "2021-07-11T12:37:55+00:00",
|
||||
"time": "2023-06-16T10:52:11+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix202306\\React\\Stream\\": "src"
|
||||
"RectorPrefix202306\\React\\Stream\\": "src\/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
|
@ -1847,16 +1847,12 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/reactphp\/stream\/issues",
|
||||
"source": "https:\/\/github.com\/reactphp\/stream\/tree\/v1.2.0"
|
||||
"source": "https:\/\/github.com\/reactphp\/stream\/tree\/v1.3.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\/stream"
|
||||
|
@ -2053,12 +2049,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "a27c88d6463e2c82fe38c9f6ae4b0af083904a2c"
|
||||
"reference": "5501d9d757a915a5c4ef39600de73b28c0cacaa6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/a27c88d6463e2c82fe38c9f6ae4b0af083904a2c",
|
||||
"reference": "a27c88d6463e2c82fe38c9f6ae4b0af083904a2c",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/5501d9d757a915a5c4ef39600de73b28c0cacaa6",
|
||||
"reference": "5501d9d757a915a5c4ef39600de73b28c0cacaa6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2087,7 +2083,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.1",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-06-14T16:00:01+00:00",
|
||||
"time": "2023-06-16T13:27:15+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,19 @@
|
|||
# Changelog
|
||||
|
||||
## 1.3.0 (2023-06-16)
|
||||
|
||||
* Feature: Full PHP 8.1 and PHP 8.2 compatibility.
|
||||
(#160 by @SimonFrings, #165 by @clue and #169 by @WyriHaximus)
|
||||
|
||||
* Feature: Avoid unneeded syscall when creating non-blocking `DuplexResourceStream`.
|
||||
(#164 by @clue)
|
||||
|
||||
* Minor documentation improvements.
|
||||
(#161 by @mrsimonbennett, #162 by @SimonFrings and #166 by @nhedger)
|
||||
|
||||
* Improve test suite and project setup and report failed assertions.
|
||||
(#168 and #170 by @clue and #163 by @SimonFrings)
|
||||
|
||||
## 1.2.0 (2021-07-11)
|
||||
|
||||
A major new feature release, see [**release announcement**](https://clue.engineering/2021/announcing-reactphp-default-loop).
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Stream
|
||||
|
||||
[![CI status](https://github.com/reactphp/stream/workflows/CI/badge.svg)](https://github.com/reactphp/stream/actions)
|
||||
[![CI status](https://github.com/reactphp/stream/actions/workflows/ci.yml/badge.svg)](https://github.com/reactphp/stream/actions)
|
||||
[![installs on Packagist](https://img.shields.io/packagist/dt/react/stream?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/react/stream)
|
||||
|
||||
Event-driven readable and writable streams for non-blocking I/O in [ReactPHP](https://reactphp.org/).
|
||||
|
||||
|
@ -609,7 +610,7 @@ data until the buffer drains.
|
|||
The stream SHOULD send a `drain` event once the buffer is ready to accept
|
||||
more data.
|
||||
|
||||
Similarly, if the the stream is not writable (already in a closed state)
|
||||
Similarly, if the stream is not writable (already in a closed state)
|
||||
it MUST NOT process the given `$data` and SHOULD return `false`,
|
||||
indicating that the caller should stop sending data.
|
||||
|
||||
|
@ -1202,7 +1203,7 @@ This project follows [SemVer](https://semver.org/).
|
|||
This will install the latest supported version:
|
||||
|
||||
```bash
|
||||
$ composer require react/stream:^1.2
|
||||
composer require react/stream:^1.3
|
||||
```
|
||||
|
||||
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
|
||||
|
@ -1218,13 +1219,13 @@ To run the test suite, you first need to clone this repo and then install all
|
|||
dependencies [through Composer](https://getcomposer.org):
|
||||
|
||||
```bash
|
||||
$ composer install
|
||||
composer install
|
||||
```
|
||||
|
||||
To run the test suite, go to the project root and run:
|
||||
|
||||
```bash
|
||||
$ php vendor/bin/phpunit
|
||||
vendor/bin/phpunit
|
||||
```
|
||||
|
||||
The test suite also contains a number of functional integration tests that rely
|
||||
|
@ -1232,7 +1233,7 @@ on a stable internet connection.
|
|||
If you do not want to run these, they can simply be skipped like this:
|
||||
|
||||
```bash
|
||||
$ php vendor/bin/phpunit --exclude-group internet
|
||||
vendor/bin/phpunit --exclude-group internet
|
||||
```
|
||||
|
||||
## License
|
||||
|
|
|
@ -40,17 +40,17 @@
|
|||
"evenement\/evenement": "^3.0 || ^2.0 || ^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.3 || ^5.7 || ^4.8.35",
|
||||
"phpunit\/phpunit": "^9.5 || ^5.7 || ^4.8.35",
|
||||
"clue\/stream-filter": "~1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix202306\\React\\Stream\\": "src"
|
||||
"RectorPrefix202306\\React\\Stream\\": "src\/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RectorPrefix202306\\React\\Tests\\Stream\\": "tests"
|
||||
"RectorPrefix202306\\React\\Tests\\Stream\\": "tests\/"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ final class DuplexResourceStream extends EventEmitter implements DuplexStreamInt
|
|||
}
|
||||
// this class relies on non-blocking I/O in order to not interrupt the event loop
|
||||
// e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918
|
||||
if (\stream_set_blocking($stream, \false) !== \true) {
|
||||
if ($buffer !== null && !$buffer instanceof WritableResourceStream && \stream_set_blocking($stream, \false) !== \true) {
|
||||
throw new \RuntimeException('Unable to set stream resource to non-blocking mode');
|
||||
}
|
||||
// Use unbuffered read operations on the underlying stream resource.
|
||||
|
|
|
@ -194,7 +194,7 @@ interface WritableStreamInterface extends EventEmitterInterface
|
|||
* The stream SHOULD send a `drain` event once the buffer is ready to accept
|
||||
* more data.
|
||||
*
|
||||
* Similarly, if the the stream is not writable (already in a closed state)
|
||||
* Similarly, if the stream is not writable (already in a closed state)
|
||||
* it MUST NOT process the given `$data` and SHOULD return `false`,
|
||||
* indicating that the caller should stop sending data.
|
||||
*
|
||||
|
|
|
@ -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/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f0c1a5f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 65c93a4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main a27c88d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f1020f6'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f0c1a5f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 65c93a4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5501d9d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f1020f6'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -124,12 +124,17 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
$this->dataProviderClassMethodRecipes = [];
|
||||
$this->traverseNodesWithCallable($node->stmts, function (Node $node) {
|
||||
$classMethod = null;
|
||||
$this->traverseNodesWithCallable($node->getMethods(), function (Node $node) use(&$classMethod) {
|
||||
if ($node instanceof ClassMethod) {
|
||||
$classMethod = $node;
|
||||
return null;
|
||||
}
|
||||
if (!$node instanceof MethodCall) {
|
||||
return null;
|
||||
}
|
||||
foreach ($this->arrayArgumentsToDataProviders as $arrayArgumentToDataProvider) {
|
||||
$this->refactorMethodCallWithConfiguration($node, $arrayArgumentToDataProvider);
|
||||
$this->refactorMethodCallWithConfiguration($node, $arrayArgumentToDataProvider, $classMethod);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
@ -150,8 +155,11 @@ CODE_SAMPLE
|
|||
Assert::allIsAOf($arrayArgumentsToDataProviders, ArrayArgumentToDataProvider::class);
|
||||
$this->arrayArgumentsToDataProviders = $arrayArgumentsToDataProviders;
|
||||
}
|
||||
private function refactorMethodCallWithConfiguration(MethodCall $methodCall, ArrayArgumentToDataProvider $arrayArgumentToDataProvider) : void
|
||||
private function refactorMethodCallWithConfiguration(MethodCall $methodCall, ArrayArgumentToDataProvider $arrayArgumentToDataProvider, ?ClassMethod $classMethod) : void
|
||||
{
|
||||
if (!$classMethod instanceof ClassMethod) {
|
||||
return;
|
||||
}
|
||||
if (!$this->isMethodCallMatch($methodCall, $arrayArgumentToDataProvider)) {
|
||||
return;
|
||||
}
|
||||
|
@ -169,20 +177,13 @@ CODE_SAMPLE
|
|||
}
|
||||
// rename method to new one handling non-array input
|
||||
$methodCall->name = new Identifier($arrayArgumentToDataProvider->getNewMethod());
|
||||
$dataProviderMethodName = $this->createDataProviderMethodName($methodCall);
|
||||
if ($dataProviderMethodName === null) {
|
||||
return;
|
||||
}
|
||||
$dataProviderMethodName = $this->createDataProviderMethodName($classMethod);
|
||||
$this->dataProviderClassMethodRecipes[] = new DataProviderClassMethodRecipe($dataProviderMethodName, $methodCall->getArgs());
|
||||
$methodCall->args = [];
|
||||
$paramAndArgs = $this->paramAndArgFromArrayResolver->resolve($firstArgumentValue, $arrayArgumentToDataProvider->getVariableName());
|
||||
foreach ($paramAndArgs as $paramAndArg) {
|
||||
$methodCall->args[] = new Arg($paramAndArg->getVariable());
|
||||
}
|
||||
$classMethod = $this->betterNodeFinder->findParentType($methodCall, ClassMethod::class);
|
||||
if (!$classMethod instanceof ClassMethod) {
|
||||
return;
|
||||
}
|
||||
$this->refactorTestClassMethodParams($classMethod, $paramAndArgs);
|
||||
// add data provider annotation
|
||||
$phpDocTagNode = $this->createDataProviderTagNode($dataProviderMethodName);
|
||||
|
@ -208,12 +209,8 @@ CODE_SAMPLE
|
|||
}
|
||||
return $this->isName($methodCall->name, $arrayArgumentToDataProvider->getOldMethod());
|
||||
}
|
||||
private function createDataProviderMethodName(MethodCall $methodCall) : ?string
|
||||
private function createDataProviderMethodName(ClassMethod $classMethod) : string
|
||||
{
|
||||
$classMethod = $this->betterNodeFinder->findParentType($methodCall, ClassMethod::class);
|
||||
if (!$classMethod instanceof ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
$classMethodName = $this->getName($classMethod);
|
||||
return 'provideDataFor' . \ucfirst($classMethodName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue