Updated Rector to commit 8609d3b83b7ff1242df1ca54219068e0308dfafa

8609d3b83b Performance: use direct find() instead of lookup all nodes then filter on BetterNodeFinder (#3507)
This commit is contained in:
Tomas Votruba 2023-03-23 08:47:56 +00:00
parent 88b0ceb1d4
commit 8e44614ce3
11 changed files with 68 additions and 33 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b8a0d66cc4eacbc8926e4f9639072007d016a9a3';
public const PACKAGE_VERSION = '8609d3b83b7ff1242df1ca54219068e0308dfafa';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-03-23 03:10:53';
public const RELEASE_DATE = '2023-03-23 15:43:37';
/**
* @var int
*/

View File

@ -354,10 +354,11 @@ final class BetterNodeFinder
if ($exprName === null) {
return [];
}
$variables = $this->findInstancesOf($scopeNode, [Variable::class]);
return \array_filter($variables, function (Variable $variable) use($exprName) : bool {
return $this->nodeNameResolver->isName($variable, $exprName);
/** @var Variable[] $variables */
$variables = $this->find($scopeNode, function (Node $node) use($exprName) : bool {
return $node instanceof Variable && $this->nodeNameResolver->isName($node, $exprName);
});
return $variables;
}
if ($expr instanceof Property) {
$singleProperty = $expr->props[0];
@ -370,10 +371,11 @@ final class BetterNodeFinder
if ($exprName === null) {
return [];
}
$propertyFetches = $this->findInstancesOf($scopeNode, [PropertyFetch::class, StaticPropertyFetch::class]);
return \array_filter($propertyFetches, function ($propertyFetch) use($exprName) : bool {
return $this->nodeNameResolver->isName($propertyFetch->name, $exprName);
/** @var PropertyFetch[]|StaticPropertyFetch[] $propertyFetches */
$propertyFetches = $this->find($scopeNode, function (Node $node) use($exprName) : bool {
return ($node instanceof PropertyFetch || $node instanceof StaticPropertyFetch) && $this->nodeNameResolver->isName($node->name, $exprName);
});
return $propertyFetches;
}
/**
* @template T of Node

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitd554422d0c48691702e6a0f663797ede::getLoader();
return ComposerAutoloaderInit4a2890a2fb74c36cbb291f625ed32610::getLoader();

View File

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

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitd554422d0c48691702e6a0f663797ede
class ComposerStaticInit4a2890a2fb74c36cbb291f625ed32610
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3127,9 +3127,9 @@ class ComposerStaticInitd554422d0c48691702e6a0f663797ede
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitd554422d0c48691702e6a0f663797ede::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd554422d0c48691702e6a0f663797ede::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd554422d0c48691702e6a0f663797ede::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit4a2890a2fb74c36cbb291f625ed32610::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4a2890a2fb74c36cbb291f625ed32610::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4a2890a2fb74c36cbb291f625ed32610::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2192,17 +2192,17 @@
},
{
"name": "sebastian\/diff",
"version": "5.0.0",
"version_normalized": "5.0.0.0",
"version": "5.0.1",
"version_normalized": "5.0.1.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/sebastianbergmann\/diff.git",
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f"
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/sebastianbergmann\/diff\/zipball\/70dd1b20bc198da394ad542e988381b44e64e39f",
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f",
"url": "https:\/\/api.github.com\/repos\/sebastianbergmann\/diff\/zipball\/aae9a0a43bff37bd5d8d0311426c87bf36153f02",
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02",
"shasum": ""
},
"require": {
@ -2212,7 +2212,7 @@
"phpunit\/phpunit": "^10.0",
"symfony\/process": "^4.2 || ^5"
},
"time": "2023-02-03T07:00:31+00:00",
"time": "2023-03-23T05:12:41+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -2249,7 +2249,8 @@
],
"support": {
"issues": "https:\/\/github.com\/sebastianbergmann\/diff\/issues",
"source": "https:\/\/github.com\/sebastianbergmann\/diff\/tree\/5.0.0"
"security": "https:\/\/github.com\/sebastianbergmann\/diff\/security\/policy",
"source": "https:\/\/github.com\/sebastianbergmann\/diff\/tree\/5.0.1"
},
"funding": [
{

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,13 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [5.0.0] - 2022-02-03
## [5.0.1] - 2023-03-23
### Fixed
* [#115](https://github.com/sebastianbergmann/diff/pull/115): `Parser::parseFileDiff()` does not handle diffs correctly that only add lines or only remove lines
## [5.0.0] - 2023-02-03
### Changed
@ -86,6 +92,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* This component is no longer supported on PHP 5.6
[5.0.1]: https://github.com/sebastianbergmann/diff/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/sebastianbergmann/diff/compare/4.0.4...5.0.0
[4.0.4]: https://github.com/sebastianbergmann/diff/compare/4.0.3...4.0.4
[4.0.3]: https://github.com/sebastianbergmann/diff/compare/4.0.2...4.0.3

View File

@ -1,9 +1,30 @@
# Security Policy
This library is intended to be used in development environments only. For instance, it is used by the testing framework PHPUnit. There is no reason why this library should be installed on a webserver.
If you believe you have found a security vulnerability in the library that is developed in this repository, please report it to us through coordinated disclosure.
**If you upload this library to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.**
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
## Security Contact Information
Instead, please send an email to `sebastian@phpunit.de`.
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
* The type of issue
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
## Web Context
The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit.
The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in a HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes.
If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
Vulnerabilities specific to the use outside of a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.

View File

@ -19,6 +19,10 @@
"email": "mail@kore-nordmann.de"
}
],
"support": {
"issues": "https:\/\/github.com\/sebastianbergmann\/diff\/issues",
"security": "https:\/\/github.com\/sebastianbergmann\/diff\/security\/policy"
},
"prefer-stable": true,
"config": {
"platform": {

View File

@ -62,8 +62,8 @@ final class Parser
$chunk = null;
$diffLines = [];
foreach ($lines as $line) {
if (preg_match('/^@@\\s+-(?P<start>\\d+)(?:,\\s*(?P<startrange>\\d+))?\\s+\\+(?P<end>\\d+)(?:,\\s*(?P<endrange>\\d+))?\\s+@@/', $line, $match)) {
$chunk = new Chunk((int) $match['start'], isset($match['startrange']) ? max(1, (int) $match['startrange']) : 1, (int) $match['end'], isset($match['endrange']) ? max(1, (int) $match['endrange']) : 1);
if (preg_match('/^@@\\s+-(?P<start>\\d+)(?:,\\s*(?P<startrange>\\d+))?\\s+\\+(?P<end>\\d+)(?:,\\s*(?P<endrange>\\d+))?\\s+@@/', $line, $match, \PREG_UNMATCHED_AS_NULL)) {
$chunk = new Chunk((int) $match['start'], isset($match['startrange']) ? max(0, (int) $match['startrange']) : 1, (int) $match['end'], isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1);
$chunks[] = $chunk;
$diffLines = [];
continue;