Updated Rector to commit 2bc0f4c0966f2c6fbd7440a920235baf6c38f175

2bc0f4c096 [DeadCode] Skip nullable from param for RemoveUnusedNonEmptyArrayBeforeForeachRector (#347)
This commit is contained in:
Tomas Votruba 2021-07-01 12:49:39 +00:00
parent 1666838b21
commit 5585a0cc88
28 changed files with 238 additions and 180 deletions

View File

@ -3,15 +3,20 @@
declare (strict_types=1);
namespace Rector\DeadCode;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\BinaryOp\NotEqual;
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Empty_;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\NullableType;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\If_;
use PHPStan\Type\MixedType;
use PHPStan\Type\ArrayType;
use Rector\Core\PhpParser\Comparing\NodeComparator;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\NodeTypeResolver\NodeTypeResolver;
final class UselessIfCondBeforeForeachDetector
{
@ -23,10 +28,15 @@ final class UselessIfCondBeforeForeachDetector
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
*/
private $nodeComparator;
public function __construct(\Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator)
/**
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
*/
private $betterNodeFinder;
public function __construct(\Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
{
$this->nodeTypeResolver = $nodeTypeResolver;
$this->nodeComparator = $nodeComparator;
$this->betterNodeFinder = $betterNodeFinder;
}
/**
* Matches:
@ -48,7 +58,19 @@ final class UselessIfCondBeforeForeachDetector
}
// is array though?
$arrayType = $this->nodeTypeResolver->resolve($empty->expr);
return !$arrayType instanceof \PHPStan\Type\MixedType;
if (!$arrayType instanceof \PHPStan\Type\ArrayType) {
return \false;
}
$previousParam = $this->fromPreviousParam($foreachExpr);
if (!$previousParam instanceof \PhpParser\Node\Param) {
return \true;
}
return $this->isNullableParam($previousParam);
}
public function isNullableParam(\PhpParser\Node\Param $param) : bool
{
$type = $this->nodeTypeResolver->resolve($param->var);
return $type instanceof \PhpParser\Node\NullableType;
}
/**
* Matches:
@ -66,6 +88,18 @@ final class UselessIfCondBeforeForeachDetector
$notIdentical = $if->cond;
return $this->isMatchingNotBinaryOp($notIdentical, $foreachExpr);
}
private function fromPreviousParam(\PhpParser\Node\Expr $expr) : ?\PhpParser\Node
{
return $this->betterNodeFinder->findFirstPreviousOfNode($expr, function (\PhpParser\Node $node) use($expr) : bool {
if (!$node instanceof \PhpParser\Node\Param) {
return \false;
}
if (!$node->var instanceof \PhpParser\Node\Expr\Variable) {
return \false;
}
return $this->nodeComparator->areNodesEqual($node->var, $expr);
});
}
/**
* @param \PhpParser\Node\Expr\BinaryOp\NotIdentical|\PhpParser\Node\Expr\BinaryOp\NotEqual $binaryOp
*/

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '9575dd2231f38d6dd04606e53c51919527c9333c';
public const PACKAGE_VERSION = '2bc0f4c0966f2c6fbd7440a920235baf6c38f175';
/**
* @var string
*/
public const RELEASE_DATE = '2021-07-01 10:39:58';
public const RELEASE_DATE = '2021-07-01 14:35:49';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210701\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d::getLoader();
return ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d
class ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit45e5e7cde8c028d6e57a2284a8731247::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit45e5e7cde8c028d6e57a2284a8731247::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire7bdd5050b2cd2cdd3bef7516acf6b77d($fileIdentifier, $file);
composerRequire45e5e7cde8c028d6e57a2284a8731247($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire7bdd5050b2cd2cdd3bef7516acf6b77d($fileIdentifier, $file)
function composerRequire45e5e7cde8c028d6e57a2284a8731247($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d
class ComposerStaticInit45e5e7cde8c028d6e57a2284a8731247
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3841,9 +3841,9 @@ class ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7bdd5050b2cd2cdd3bef7516acf6b77d::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit45e5e7cde8c028d6e57a2284a8731247::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit45e5e7cde8c028d6e57a2284a8731247::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit45e5e7cde8c028d6e57a2284a8731247::$classMap;
}, null, ClassLoader::class);
}

View File

@ -3741,17 +3741,17 @@
},
{
"name": "symplify\/astral",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/astral.git",
"reference": "7697f154077d9e36055d08fb7592b5a59169362e"
"reference": "57bcb217e64e7e975bf5c71059cf19880e3fd186"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/astral\/zipball\/7697f154077d9e36055d08fb7592b5a59169362e",
"reference": "7697f154077d9e36055d08fb7592b5a59169362e",
"url": "https:\/\/api.github.com\/repos\/symplify\/astral\/zipball\/57bcb217e64e7e975bf5c71059cf19880e3fd186",
"reference": "57bcb217e64e7e975bf5c71059cf19880e3fd186",
"shasum": ""
},
"require": {
@ -3760,14 +3760,14 @@
"php": ">=8.0",
"symfony\/dependency-injection": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/autowire-array-parameter": "^9.4.1",
"symplify\/package-builder": "^9.4.1"
"symplify\/autowire-array-parameter": "^9.4.3",
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5",
"symplify\/easy-testing": "^9.4.1"
"symplify\/easy-testing": "^9.4.3"
},
"time": "2021-06-29T17:57:00+00:00",
"time": "2021-07-01T09:31:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -3786,7 +3786,7 @@
],
"description": "Toolking for smart daily work with AST",
"support": {
"source": "https:\/\/github.com\/symplify\/astral\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/astral\/tree\/9.4.3"
},
"funding": [
{
@ -3802,29 +3802,29 @@
},
{
"name": "symplify\/autowire-array-parameter",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/autowire-array-parameter.git",
"reference": "f518ed926eb8b39ac9ff60242b894b42c08b3f9e"
"reference": "c45b63754f1a7d9a788d4fb43ae6b42bfc5ce207"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/autowire-array-parameter\/zipball\/f518ed926eb8b39ac9ff60242b894b42c08b3f9e",
"reference": "f518ed926eb8b39ac9ff60242b894b42c08b3f9e",
"url": "https:\/\/api.github.com\/repos\/symplify\/autowire-array-parameter\/zipball\/c45b63754f1a7d9a788d4fb43ae6b42bfc5ce207",
"reference": "c45b63754f1a7d9a788d4fb43ae6b42bfc5ce207",
"shasum": ""
},
"require": {
"nette\/utils": "^3.2",
"php": ">=8.0",
"symfony\/dependency-injection": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:00+00:00",
"time": "2021-07-01T09:31:25+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -3843,7 +3843,7 @@
],
"description": "Autowire array parameters for your Symfony applications",
"support": {
"source": "https:\/\/github.com\/symplify\/autowire-array-parameter\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/autowire-array-parameter\/tree\/9.4.3"
},
"funding": [
{
@ -3859,17 +3859,17 @@
},
{
"name": "symplify\/composer-json-manipulator",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/composer-json-manipulator.git",
"reference": "b47c7b7482050f697afb5cec86d6580ec15ea8a6"
"reference": "c27820b06314be57b6b3b6a85ce008fd28973e8f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/composer-json-manipulator\/zipball\/b47c7b7482050f697afb5cec86d6580ec15ea8a6",
"reference": "b47c7b7482050f697afb5cec86d6580ec15ea8a6",
"url": "https:\/\/api.github.com\/repos\/symplify\/composer-json-manipulator\/zipball\/c27820b06314be57b6b3b6a85ce008fd28973e8f",
"reference": "c27820b06314be57b6b3b6a85ce008fd28973e8f",
"shasum": ""
},
"require": {
@ -3879,13 +3879,13 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/filesystem": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1"
"symplify\/package-builder": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:02+00:00",
"time": "2021-07-01T09:31:17+00:00",
"type": "symfony-bundle",
"extra": {
"branch-alias": {
@ -3904,7 +3904,7 @@
],
"description": "Package to load, merge and save composer.json file(s)",
"support": {
"source": "https:\/\/github.com\/symplify\/composer-json-manipulator\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/composer-json-manipulator\/tree\/9.4.3"
},
"funding": [
{
@ -3920,17 +3920,17 @@
},
{
"name": "symplify\/console-color-diff",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/console-color-diff.git",
"reference": "1644f68d3e389c5336b08d844850945aadb36e23"
"reference": "544a26f303b1dd4c62546a5673880f656e9dbfbf"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/console-color-diff\/zipball\/1644f68d3e389c5336b08d844850945aadb36e23",
"reference": "1644f68d3e389c5336b08d844850945aadb36e23",
"url": "https:\/\/api.github.com\/repos\/symplify\/console-color-diff\/zipball\/544a26f303b1dd4c62546a5673880f656e9dbfbf",
"reference": "544a26f303b1dd4c62546a5673880f656e9dbfbf",
"shasum": ""
},
"require": {
@ -3940,12 +3940,12 @@
"symfony\/console": "^5.3",
"symfony\/dependency-injection": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:04+00:00",
"time": "2021-07-01T09:31:23+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -3964,7 +3964,7 @@
],
"description": "Package to print diffs in console with colors",
"support": {
"source": "https:\/\/github.com\/symplify\/console-color-diff\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/console-color-diff\/tree\/9.4.3"
},
"funding": [
{
@ -3980,31 +3980,31 @@
},
{
"name": "symplify\/console-package-builder",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/console-package-builder.git",
"reference": "833219e1d20474811b6622bb4457682d9e6ea184"
"reference": "b6c5b29a60a916c9d28454f4f15a5b9b333e564f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/console-package-builder\/zipball\/833219e1d20474811b6622bb4457682d9e6ea184",
"reference": "833219e1d20474811b6622bb4457682d9e6ea184",
"url": "https:\/\/api.github.com\/repos\/symplify\/console-package-builder\/zipball\/b6c5b29a60a916c9d28454f4f15a5b9b333e564f",
"reference": "b6c5b29a60a916c9d28454f4f15a5b9b333e564f",
"shasum": ""
},
"require": {
"php": ">=8.0",
"symfony\/console": "^5.3",
"symfony\/dependency-injection": "^5.3",
"symplify\/symplify-kernel": "^9.4.1"
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"time": "2021-06-29T17:57:03+00:00",
"time": "2021-07-01T09:31:22+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -4023,23 +4023,23 @@
],
"description": "Package to speed up building command line applications",
"support": {
"source": "https:\/\/github.com\/symplify\/console-package-builder\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/console-package-builder\/tree\/9.4.3"
},
"install-path": "..\/symplify\/console-package-builder"
},
{
"name": "symplify\/easy-testing",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/easy-testing.git",
"reference": "cf7a950a63c0fb4a544c580dda4e36980903df0e"
"reference": "3a60d84bc619b8b9d7460b678acb1f0c9d3b1d64"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/easy-testing\/zipball\/cf7a950a63c0fb4a544c580dda4e36980903df0e",
"reference": "cf7a950a63c0fb4a544c580dda4e36980903df0e",
"url": "https:\/\/api.github.com\/repos\/symplify\/easy-testing\/zipball\/3a60d84bc619b8b9d7460b678acb1f0c9d3b1d64",
"reference": "3a60d84bc619b8b9d7460b678acb1f0c9d3b1d64",
"shasum": ""
},
"require": {
@ -4049,15 +4049,15 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/finder": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/console-package-builder": "^9.4.1",
"symplify\/package-builder": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1",
"symplify\/symplify-kernel": "^9.4.1"
"symplify\/console-package-builder": "^9.4.3",
"symplify\/package-builder": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3",
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:10+00:00",
"time": "2021-07-01T09:31:30+00:00",
"bin": [
"bin\/easy-testing"
],
@ -4079,7 +4079,7 @@
],
"description": "Testing made easy",
"support": {
"source": "https:\/\/github.com\/symplify\/easy-testing\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/easy-testing\/tree\/9.4.3"
},
"funding": [
{
@ -4095,17 +4095,17 @@
},
{
"name": "symplify\/package-builder",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/package-builder.git",
"reference": "3472595aaad8de37f22cbc6c5a3aa7622ad2f5fa"
"reference": "55f0d250ef9e25a0cf3c3c66d7e781342cca7b29"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/3472595aaad8de37f22cbc6c5a3aa7622ad2f5fa",
"reference": "3472595aaad8de37f22cbc6c5a3aa7622ad2f5fa",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/55f0d250ef9e25a0cf3c3c66d7e781342cca7b29",
"reference": "55f0d250ef9e25a0cf3c3c66d7e781342cca7b29",
"shasum": ""
},
"require": {
@ -4117,13 +4117,13 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/finder": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/easy-testing": "^9.4.1",
"symplify\/symplify-kernel": "^9.4.1"
"symplify\/easy-testing": "^9.4.3",
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:25+00:00",
"time": "2021-07-01T09:31:35+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -4142,7 +4142,7 @@
],
"description": "Dependency Injection, Console and Kernel toolkit for Symplify packages.",
"support": {
"source": "https:\/\/github.com\/symplify\/package-builder\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/package-builder\/tree\/9.4.3"
},
"funding": [
{
@ -4158,8 +4158,8 @@
},
{
"name": "symplify\/rule-doc-generator-contracts",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/rule-doc-generator-contracts.git",
@ -4211,17 +4211,17 @@
},
{
"name": "symplify\/simple-php-doc-parser",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/simple-php-doc-parser.git",
"reference": "28a0ea91f818015c06dd8f23320df1ccf918482e"
"reference": "4b662288a3816a03c7cd28e29809c63b828f9af9"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/simple-php-doc-parser\/zipball\/28a0ea91f818015c06dd8f23320df1ccf918482e",
"reference": "28a0ea91f818015c06dd8f23320df1ccf918482e",
"url": "https:\/\/api.github.com\/repos\/symplify\/simple-php-doc-parser\/zipball\/4b662288a3816a03c7cd28e29809c63b828f9af9",
"reference": "4b662288a3816a03c7cd28e29809c63b828f9af9",
"shasum": ""
},
"require": {
@ -4230,13 +4230,13 @@
"symfony\/config": "^5.3",
"symfony\/dependency-injection": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5",
"symplify\/easy-testing": "^9.4.1"
"symplify\/easy-testing": "^9.4.3"
},
"time": "2021-06-29T17:57:43+00:00",
"time": "2021-07-01T09:32:05+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -4255,7 +4255,7 @@
],
"description": "Service integration of phpstan\/phpdoc-parser, with few extra goodies for practical simple use",
"support": {
"source": "https:\/\/github.com\/symplify\/simple-php-doc-parser\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/simple-php-doc-parser\/tree\/9.4.3"
},
"funding": [
{
@ -4271,17 +4271,17 @@
},
{
"name": "symplify\/skipper",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/skipper.git",
"reference": "cd235792b5f1bff6a53c7b2c562b8c672f7af57f"
"reference": "12decb498a4908204123de1fee40914950e0c614"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/skipper\/zipball\/cd235792b5f1bff6a53c7b2c562b8c672f7af57f",
"reference": "cd235792b5f1bff6a53c7b2c562b8c672f7af57f",
"url": "https:\/\/api.github.com\/repos\/symplify\/skipper\/zipball\/12decb498a4908204123de1fee40914950e0c614",
"reference": "12decb498a4908204123de1fee40914950e0c614",
"shasum": ""
},
"require": {
@ -4291,14 +4291,14 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/filesystem": "^5.3",
"symfony\/finder": "^5.3",
"symplify\/package-builder": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1",
"symplify\/symplify-kernel": "^9.4.1"
"symplify\/package-builder": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3",
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:43+00:00",
"time": "2021-07-01T09:32:00+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -4317,7 +4317,7 @@
],
"description": "Skip files by rule class, directory, file or fnmatch",
"support": {
"source": "https:\/\/github.com\/symplify\/skipper\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/skipper\/tree\/9.4.3"
},
"funding": [
{
@ -4333,17 +4333,17 @@
},
{
"name": "symplify\/smart-file-system",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/smart-file-system.git",
"reference": "9257a0fb850781adf3a1367f6b33eb66386d1aa5"
"reference": "1a99ae4083c152a3fbf88269964a0337b052f878"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/smart-file-system\/zipball\/9257a0fb850781adf3a1367f6b33eb66386d1aa5",
"reference": "9257a0fb850781adf3a1367f6b33eb66386d1aa5",
"url": "https:\/\/api.github.com\/repos\/symplify\/smart-file-system\/zipball\/1a99ae4083c152a3fbf88269964a0337b052f878",
"reference": "1a99ae4083c152a3fbf88269964a0337b052f878",
"shasum": ""
},
"require": {
@ -4356,7 +4356,7 @@
"nette\/finder": "^2.5",
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:42+00:00",
"time": "2021-06-30T16:02:31+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -4375,7 +4375,7 @@
],
"description": "Sanitized FileInfo with safe getRealPath() and other handy methods",
"support": {
"source": "https:\/\/github.com\/symplify\/smart-file-system\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/smart-file-system\/tree\/9.4.3"
},
"funding": [
{
@ -4391,35 +4391,35 @@
},
{
"name": "symplify\/symfony-php-config",
"version": "v9.3.22",
"version_normalized": "9.3.22.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/symfony-php-config.git",
"reference": "30199fdaf350e730d9e8ed97af5792ab1ce65967"
"reference": "8368415ea37e749d3d2f4ab1e3d0e1fb53e611c6"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/symfony-php-config\/zipball\/30199fdaf350e730d9e8ed97af5792ab1ce65967",
"reference": "30199fdaf350e730d9e8ed97af5792ab1ce65967",
"url": "https:\/\/api.github.com\/repos\/symplify\/symfony-php-config\/zipball\/8368415ea37e749d3d2f4ab1e3d0e1fb53e611c6",
"reference": "8368415ea37e749d3d2f4ab1e3d0e1fb53e611c6",
"shasum": ""
},
"require": {
"php": ">=7.3",
"symfony\/dependency-injection": "^5.2",
"symplify\/package-builder": "^9.3.22",
"symplify\/symplify-kernel": "^9.3.22"
"php": ">=8.0",
"symfony\/dependency-injection": "^5.3",
"symplify\/package-builder": "^9.4.3",
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"phpstan\/phpstan": "^0.12.88",
"phpstan\/phpstan": "^0.12.90",
"phpunit\/phpunit": "^9.5",
"symfony\/http-kernel": "^4.4|^5.2"
"symfony\/http-kernel": "^5.3"
},
"time": "2021-06-10T09:30:01+00:00",
"time": "2021-07-01T09:32:01+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.4-dev"
"dev-main": "9.5-dev"
}
},
"installation-source": "dist",
@ -4434,23 +4434,23 @@
],
"description": "Tools that easy work with Symfony PHP Configs",
"support": {
"source": "https:\/\/github.com\/symplify\/symfony-php-config\/tree\/v9.3.22"
"source": "https:\/\/github.com\/symplify\/symfony-php-config\/tree\/9.4.3"
},
"install-path": "..\/symplify\/symfony-php-config"
},
{
"name": "symplify\/symplify-kernel",
"version": "v9.4.1",
"version_normalized": "9.4.1.0",
"version": "9.4.3",
"version_normalized": "9.4.3.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/symplify-kernel.git",
"reference": "57d99ff8e2138556ddbe79b9cd53dc793333f682"
"reference": "0102518442cee6a4629400d34bf6965c3a3001e5"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/symplify-kernel\/zipball\/57d99ff8e2138556ddbe79b9cd53dc793333f682",
"reference": "57d99ff8e2138556ddbe79b9cd53dc793333f682",
"url": "https:\/\/api.github.com\/repos\/symplify\/symplify-kernel\/zipball\/0102518442cee6a4629400d34bf6965c3a3001e5",
"reference": "0102518442cee6a4629400d34bf6965c3a3001e5",
"shasum": ""
},
"require": {
@ -4458,15 +4458,15 @@
"symfony\/console": "^5.3",
"symfony\/dependency-injection": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/autowire-array-parameter": "^9.4.1",
"symplify\/composer-json-manipulator": "^9.4.1",
"symplify\/package-builder": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1"
"symplify\/autowire-array-parameter": "^9.4.3",
"symplify\/composer-json-manipulator": "^9.4.3",
"symplify\/package-builder": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-06-29T17:57:51+00:00",
"time": "2021-07-01T09:32:08+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -4485,7 +4485,7 @@
],
"description": "Internal Kernel for Symplify packages",
"support": {
"source": "https:\/\/github.com\/symplify\/symplify-kernel\/tree\/v9.4.1"
"source": "https:\/\/github.com\/symplify\/symplify-kernel\/tree\/9.4.3"
},
"install-path": "..\/symplify\/symplify-kernel"
},

File diff suppressed because one or more lines are too long

View File

@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
spl_autoload_call('RectorPrefix20210701\CheckoutEntityFactory');
}
if (!class_exists('ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d', false) && !interface_exists('ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d', false) && !trait_exists('ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d', false)) {
spl_autoload_call('RectorPrefix20210701\ComposerAutoloaderInit7bdd5050b2cd2cdd3bef7516acf6b77d');
if (!class_exists('ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247', false) && !interface_exists('ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247', false) && !trait_exists('ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247', false)) {
spl_autoload_call('RectorPrefix20210701\ComposerAutoloaderInit45e5e7cde8c028d6e57a2284a8731247');
}
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
spl_autoload_call('RectorPrefix20210701\Doctrine\Inflector\Inflector');
@ -3320,9 +3320,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210701\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire7bdd5050b2cd2cdd3bef7516acf6b77d')) {
function composerRequire7bdd5050b2cd2cdd3bef7516acf6b77d() {
return \RectorPrefix20210701\composerRequire7bdd5050b2cd2cdd3bef7516acf6b77d(...func_get_args());
if (!function_exists('composerRequire45e5e7cde8c028d6e57a2284a8731247')) {
function composerRequire45e5e7cde8c028d6e57a2284a8731247() {
return \RectorPrefix20210701\composerRequire45e5e7cde8c028d6e57a2284a8731247(...func_get_args());
}
}
if (!function_exists('parseArgs')) {

View File

@ -6,13 +6,13 @@
"php": ">=8.0",
"nette\/utils": "^3.2",
"symfony\/dependency-injection": "^5.3",
"symplify\/autowire-array-parameter": "^9.4.1",
"symplify\/autowire-array-parameter": "^9.4.3",
"symfony\/http-kernel": "^5.3",
"nikic\/php-parser": "4.10.5",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"symplify\/easy-testing": "^9.4.1",
"symplify\/easy-testing": "^9.4.3",
"phpunit\/phpunit": "^9.5"
},
"autoload": {

View File

@ -6,7 +6,7 @@
"php": ">=8.0",
"nette\/utils": "^3.2",
"symfony\/dependency-injection": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"

View File

@ -10,8 +10,8 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/filesystem": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1"
"symplify\/package-builder": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"

View File

@ -9,7 +9,7 @@
"sebastian\/diff": "^4.0",
"symfony\/dependency-injection": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"

View File

@ -6,11 +6,11 @@
"php": ">=8.0",
"symfony\/dependency-injection": "^5.3",
"symfony\/console": "^5.3",
"symplify\/symplify-kernel": "^9.4.1"
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1",
"symplify\/package-builder": "^9.4.3",
"phpunit\/phpunit": "^9.5"
},
"autoload": {

View File

@ -13,10 +13,10 @@
"symfony\/http-kernel": "^5.3",
"symfony\/console": "^5.3",
"symfony\/dependency-injection": "^5.3",
"symplify\/package-builder": "^9.4.1",
"symplify\/console-package-builder": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1",
"symplify\/symplify-kernel": "^9.4.1"
"symplify\/package-builder": "^9.4.3",
"symplify\/console-package-builder": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3",
"symplify\/symplify-kernel": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"

View File

@ -10,8 +10,8 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/finder": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/symplify-kernel": "^9.4.1",
"symplify\/easy-testing": "^9.4.1",
"symplify\/symplify-kernel": "^9.4.3",
"symplify\/easy-testing": "^9.4.3",
"nette\/neon": "^3.2"
},
"require-dev": {

View File

@ -8,11 +8,11 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/config": "^5.3",
"symfony\/http-kernel": "^5.3",
"symplify\/package-builder": "^9.4.1"
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5",
"symplify\/easy-testing": "^9.4.1"
"symplify\/easy-testing": "^9.4.3"
},
"autoload": {
"psr-4": {

View File

@ -10,7 +10,10 @@ use PHPStan\PhpDocParser\Ast\Node;
interface PhpDocNodeVisitorInterface
{
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void;
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node;
/**
* @return int|Node|null
*/
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node);
public function leaveNode(\PHPStan\PhpDocParser\Ast\Node $node) : void;
public function afterTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void;
}

View File

@ -14,6 +14,12 @@ use RectorPrefix20210701\Symplify\SimplePhpDocParser\PhpDocNodeVisitor\CallableP
*/
final class PhpDocNodeTraverser
{
/**
* Return from enterNode() to remove node from the tree
*
* @var int
*/
public const NODE_REMOVE = 1;
/**
* @var PhpDocNodeVisitorInterface[]
*/
@ -72,7 +78,7 @@ final class PhpDocNodeTraverser
*/
private function traverseArray(array $nodes) : array
{
foreach ($nodes as &$node) {
foreach ($nodes as $key => &$node) {
// can be string or something else
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Node) {
continue;
@ -81,6 +87,9 @@ final class PhpDocNodeTraverser
$return = $phpDocNodeVisitor->enterNode($node);
if ($return instanceof \PHPStan\PhpDocParser\Ast\Node) {
$node = $return;
} elseif ($return === self::NODE_REMOVE) {
unset($nodes[$key]);
continue 2;
}
}
$node = $this->traverseNode($node);

View File

@ -13,7 +13,10 @@ abstract class AbstractPhpDocNodeVisitor implements \RectorPrefix20210701\Sympli
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
{
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @return int|Node|null
*/
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node)
{
return null;
}

View File

@ -19,7 +19,10 @@ final class CallablePhpDocNodeVisitor extends \RectorPrefix20210701\Symplify\Sim
$this->docContent = $docContent;
$this->callable = $callable;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @return int|Node|null
*/
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node)
{
$callable = $this->callable;
return $callable($node, $this->docContent);

View File

@ -11,7 +11,10 @@ use RectorPrefix20210701\Symplify\SimplePhpDocParser\ValueObject\PhpDocAttribute
*/
final class CloningPhpDocNodeVisitor extends \RectorPrefix20210701\Symplify\SimplePhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor
{
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $origNode) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @return int|Node|null
*/
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $origNode)
{
$node = clone $origNode;
$node->setAttribute(\RectorPrefix20210701\Symplify\SimplePhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE, $origNode);

View File

@ -20,7 +20,10 @@ final class ParentConnectingPhpDocNodeVisitor extends \RectorPrefix20210701\Symp
{
$this->stack = [$node];
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @return int|Node|null
*/
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node)
{
if ($this->stack !== []) {
$parentNode = $this->stack[\count($this->stack) - 1];

View File

@ -9,9 +9,9 @@
"symfony\/dependency-injection": "^5.3",
"symfony\/finder": "^5.3",
"symfony\/filesystem": "^5.3",
"symplify\/package-builder": "^9.4.1",
"symplify\/symplify-kernel": "^9.4.1",
"symplify\/smart-file-system": "^9.4.1"
"symplify\/package-builder": "^9.4.3",
"symplify\/symplify-kernel": "^9.4.3",
"symplify\/smart-file-system": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"

View File

@ -17,7 +17,7 @@ final class FinderSanitizer
* @param NetteFinder|SymfonyFinder|SplFileInfo[]|SymfonySplFileInfo[]|string[] $files
* @return SmartFileInfo[]
*/
public function sanitize(iterable $files) : array
public function sanitize($files) : array
{
$smartFileInfos = [];
foreach ($files as $file) {

View File

@ -3,15 +3,15 @@
"description": "Tools that easy work with Symfony PHP Configs",
"license": "MIT",
"require": {
"php": ">=7.3",
"symfony\/dependency-injection": "^5.2",
"symplify\/symplify-kernel": "^9.3.22",
"symplify\/package-builder": "^9.3.22"
"php": ">=8.0",
"symfony\/dependency-injection": "^5.3",
"symplify\/symplify-kernel": "^9.4.3",
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"symfony\/http-kernel": "^4.4|^5.2",
"symfony\/http-kernel": "^5.3",
"phpunit\/phpunit": "^9.5",
"phpstan\/phpstan": "^0.12.88"
"phpstan\/phpstan": "^0.12.90"
},
"autoload": {
"psr-4": {
@ -25,7 +25,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "9.4-dev"
"dev-main": "9.5-dev"
}
},
"minimum-stability": "dev",

View File

@ -7,7 +7,7 @@ use RectorPrefix20210701\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
final class ArgumentAndParameterFactory
{
/**
* @var PrivatesAccessor
* @var \Symplify\PackageBuilder\Reflection\PrivatesAccessor
*/
private $privatesAccessor;
public function __construct()

View File

@ -29,7 +29,7 @@ final class ValueObjectInliner
}
/**
* @param object|object[] $object
* @return InlineServiceConfigurator|InlineServiceConfigurator[]
* @return \Symfony\Component\DependencyInjection\Loader\Configurator\InlineServiceConfigurator|mixed[]
* @noRector \Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector
*/
public static function inline($object)

View File

@ -7,10 +7,10 @@
"symfony\/console": "^5.3",
"symfony\/http-kernel": "^5.3",
"symfony\/dependency-injection": "^5.3",
"symplify\/smart-file-system": "^9.4.1",
"symplify\/composer-json-manipulator": "^9.4.1",
"symplify\/autowire-array-parameter": "^9.4.1",
"symplify\/package-builder": "^9.4.1"
"symplify\/smart-file-system": "^9.4.3",
"symplify\/composer-json-manipulator": "^9.4.3",
"symplify\/autowire-array-parameter": "^9.4.3",
"symplify\/package-builder": "^9.4.3"
},
"require-dev": {
"phpunit\/phpunit": "^9.5"