Updated Rector to commit 4b41e97a6d

4b41e97a6d [DeadCode] Skip RemoveUnusedVariableAssignRector if variable used before or in assign expr (#206)
This commit is contained in:
Tomas Votruba 2021-06-11 17:53:41 +00:00
parent 3d837fa2bc
commit a8b955f937
18 changed files with 104 additions and 801 deletions

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '51d55bb6c4f6378cedcb2731e1cd30c9d8983ab8';
public const PACKAGE_VERSION = '4b41e97a6dd2beb3043d2ae205ea41a0a033613f';
/**
* @var string
*/
public const RELEASE_DATE = '2021-06-11 11:00:56';
public const RELEASE_DATE = '2021-06-11 19:39:10';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210611\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -3,59 +3,95 @@
declare (strict_types=1);
namespace Rector\Core\PhpParser\Comparing;
use PhpParser\Node;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Else_;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
final class ConditionSearcher
{
/**
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
*/
private $betterNodeFinder;
/**
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
*/
private $nodeComparator;
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator)
{
$this->betterNodeFinder = $betterNodeFinder;
$this->nodeComparator = $nodeComparator;
}
public function searchIfAndElseForVariableRedeclaration(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node\Stmt\If_ $if) : bool
{
$elseNode = $if->else;
if (!$elseNode instanceof \PhpParser\Node\Stmt\Else_) {
return \false;
}
/** @var Variable $varNode */
$varNode = $assign->var;
// search if for redeclaration of variable
foreach ($if->stmts as $statementIf) {
if (!$statementIf instanceof \PhpParser\Node\Stmt\Expression) {
continue;
if (!$this->searchForVariableRedeclaration($varNode, $if->stmts)) {
return \false;
}
foreach ($if->elseifs as $elseifNode) {
if (!$this->searchForVariableRedeclaration($varNode, $elseifNode->stmts)) {
return \false;
}
if (!$statementIf->expr instanceof \PhpParser\Node\Expr\Assign) {
continue;
}
if (!$this->searchForVariableRedeclaration($varNode, $elseNode->stmts)) {
return \false;
}
return \true;
}
/**
* @param Stmt[] $stmts
*/
private function searchForVariableRedeclaration(\PhpParser\Node\Expr\Variable $varNode, array $stmts) : bool
{
foreach ($stmts as $stmt) {
if ($this->checkIfVariableUsedInExpression($varNode, $stmt)) {
return \false;
}
$assignVar = $statementIf->expr->var;
if (!$assignVar instanceof \PhpParser\Node\Expr\Variable) {
continue;
if ($this->checkForVariableRedeclaration($varNode, $stmt)) {
return \true;
}
if ($varNode->name !== $assignVar->name) {
continue;
}
$elseNode = $if->else;
if (!$elseNode instanceof \PhpParser\Node\Stmt\Else_) {
continue;
}
// search else for redeclaration of variable
return $this->searchElseForVariableRedeclaration($assign, $elseNode);
}
return \false;
}
private function searchElseForVariableRedeclaration(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node\Stmt\Else_ $else) : bool
private function checkIfVariableUsedInExpression(\PhpParser\Node\Expr\Variable $varNode, \PhpParser\Node\Stmt $stmt) : bool
{
foreach ($else->stmts as $statementElse) {
if (!$statementElse instanceof \PhpParser\Node\Stmt\Expression) {
continue;
if ($stmt instanceof \PhpParser\Node\Stmt\Expression) {
if ($stmt->expr instanceof \PhpParser\Node\Expr\Assign) {
$node = $stmt->expr->expr;
} else {
$node = $stmt->expr;
}
if (!$statementElse->expr instanceof \PhpParser\Node\Expr\Assign) {
continue;
}
/** @var Variable $varElse */
$varElse = $statementElse->expr->var;
/** @var Variable $varNode */
$varNode = $assign->var;
if ($varNode->name !== $varElse->name) {
continue;
}
return \true;
} else {
$node = $stmt;
}
return \false;
return (bool) $this->betterNodeFinder->findFirst($node, function (\PhpParser\Node $subNode) use($varNode) : bool {
return $this->nodeComparator->areNodesEqual($varNode, $subNode);
});
}
private function checkForVariableRedeclaration(\PhpParser\Node\Expr\Variable $varNode, \PhpParser\Node\Stmt $stmt) : bool
{
if (!$stmt instanceof \PhpParser\Node\Stmt\Expression) {
return \false;
}
if (!$stmt->expr instanceof \PhpParser\Node\Expr\Assign) {
return \false;
}
$assignVar = $stmt->expr->var;
if (!$assignVar instanceof \PhpParser\Node\Expr\Variable) {
return \false;
}
if ($varNode->name !== $assignVar->name) {
return \false;
}
return \true;
}
}

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f
class ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de', '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\ComposerStaticInita9c5aefd41d8fa101d6024c98c33309f::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit8b0a6403bd88dd3eead0bf8fa5a5d5de::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInita9c5aefd41d8fa101d6024c98c33309f::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit8b0a6403bd88dd3eead0bf8fa5a5d5de::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirea9c5aefd41d8fa101d6024c98c33309f($fileIdentifier, $file);
composerRequire8b0a6403bd88dd3eead0bf8fa5a5d5de($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequirea9c5aefd41d8fa101d6024c98c33309f($fileIdentifier, $file)
function composerRequire8b0a6403bd88dd3eead0bf8fa5a5d5de($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

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

View File

@ -717,32 +717,31 @@
},
{
"name": "phpstan\/phpdoc-parser",
"version": "0.5.4",
"version_normalized": "0.5.4.0",
"version": "0.5.5",
"version_normalized": "0.5.5.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
"reference": "e352d065af1ae9b41c12d1dfd309e90f7b1f55c9"
"reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/e352d065af1ae9b41c12d1dfd309e90f7b1f55c9",
"reference": "e352d065af1ae9b41c12d1dfd309e90f7b1f55c9",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c",
"reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phing\/phing": "^2.16.3",
"php-parallel-lint\/php-parallel-lint": "^1.2",
"phpstan\/extension-installer": "^1.0",
"phpstan\/phpstan": "^0.12.60",
"phpstan\/phpstan": "^0.12.87",
"phpstan\/phpstan-strict-rules": "^0.12.5",
"phpunit\/phpunit": "^7.5.20",
"phpunit\/phpunit": "^9.5",
"symfony\/process": "^5.2"
},
"time": "2021-04-03T14:46:19+00:00",
"time": "2021-06-11T13:24:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -764,7 +763,7 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/0.5.4"
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/0.5.5"
},
"install-path": "..\/phpstan\/phpdoc-parser"
},

File diff suppressed because one or more lines are too long

View File

@ -1,74 +0,0 @@
# Contributor Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project maintainer at <ondrej@mirtes.cz>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="$DIR"
if [[ ! -d "$ROOT_DIR/tools/abnfgen" ]]; then
rm -rf "$ROOT_DIR/temp/abnfgen"
mkdir -p "$ROOT_DIR/temp/abnfgen"
tar xf "$ROOT_DIR/tests/abnfgen-0.20.tar.gz" \
--directory "$ROOT_DIR/temp/abnfgen" \
--strip-components 1
cd "$ROOT_DIR/temp/abnfgen"
./configure
make
mkdir -p "$ROOT_DIR/tools/abnfgen"
mv abnfgen "$ROOT_DIR/tools/abnfgen"
rm -rf "$ROOT_DIR/temp/abnfgen" "$ROOT_DIR/temp/abnfgen.tar.gz"
fi

View File

@ -1,10 +0,0 @@
{
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"consistence-community\/coding-standard": "^3.11",
"dealerdirect\/phpcodesniffer-composer-installer": "^0.7.1",
"slevomat\/coding-standard": "^6.4.1"
}
}

View File

@ -1,327 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b33744523e2d619e22ae3fd7c30f4283",
"packages": [],
"packages-dev": [
{
"name": "consistence-community/coding-standard",
"version": "3.11.0",
"source": {
"type": "git",
"url": "https://github.com/consistence-community/coding-standard.git",
"reference": "20f5c3673013be606a62ba0b6624f5c0e43bb64e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/consistence-community/coding-standard/zipball/20f5c3673013be606a62ba0b6624f5c0e43bb64e",
"reference": "20f5c3673013be606a62ba0b6624f5c0e43bb64e",
"shasum": ""
},
"require": {
"php": ">=7.4",
"slevomat/coding-standard": "~6.4",
"squizlabs/php_codesniffer": "~3.5.8"
},
"replace": {
"consistence/coding-standard": "3.10.*"
},
"require-dev": {
"phing/phing": "2.16.4",
"php-parallel-lint/php-parallel-lint": "1.2.0",
"phpunit/phpunit": "9.5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Consistence\\": [
"Consistence"
]
},
"classmap": [
"Consistence"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Vašek Purchart",
"email": "me@vasekpurchart.cz",
"homepage": "http://vasekpurchart.cz"
}
],
"description": "Consistence - Coding Standard - PHP Code Sniffer rules",
"keywords": [
"Coding Standard",
"PHPCodeSniffer",
"codesniffer",
"coding",
"cs",
"phpcs",
"ruleset",
"sniffer",
"standard"
],
"support": {
"source": "https://github.com/consistence-community/coding-standard/tree/3.11.0"
},
"time": "2021-02-28T08:38:12+00:00"
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.7.1",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "fe390591e0241955f22eb9ba327d137e501c771c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c",
"reference": "fe390591e0241955f22eb9ba327d137e501c771c",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"phpcompatibility/php-compatibility": "^9.0",
"sensiolabs/security-checker": "^4.1.0"
},
"type": "composer-plugin",
"extra": {
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2020-12-07T18:04:37+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "0.4.9",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/98a088b17966bdf6ee25c8a4b634df313d8aa531",
"reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"consistence/coding-standard": "^3.5",
"ergebnis/composer-normalize": "^2.0.2",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"phing/phing": "^2.16.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.26",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^6.3",
"slevomat/coding-standard": "^4.7.2",
"symfony/process": "^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.4-dev"
}
},
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/master"
},
"time": "2020-08-03T20:32:43+00:00"
},
{
"name": "slevomat/coding-standard",
"version": "6.4.1",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
"reference": "696dcca217d0c9da2c40d02731526c1e25b65346"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/696dcca217d0c9da2c40d02731526c1e25b65346",
"reference": "696dcca217d0c9da2c40d02731526c1e25b65346",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"php": "^7.1 || ^8.0",
"phpstan/phpdoc-parser": "0.4.5 - 0.4.9",
"squizlabs/php_codesniffer": "^3.5.6"
},
"require-dev": {
"phing/phing": "2.16.3",
"php-parallel-lint/php-parallel-lint": "1.2.0",
"phpstan/phpstan": "0.12.48",
"phpstan/phpstan-deprecation-rules": "0.12.5",
"phpstan/phpstan-phpunit": "0.12.16",
"phpstan/phpstan-strict-rules": "0.12.5",
"phpunit/phpunit": "7.5.20|8.5.5|9.4.0"
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-master": "6.x-dev"
}
},
"autoload": {
"psr-4": {
"SlevomatCodingStandard\\": "SlevomatCodingStandard"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
"support": {
"issues": "https://github.com/slevomat/coding-standard/issues",
"source": "https://github.com/slevomat/coding-standard/tree/6.4.1"
},
"funding": [
{
"url": "https://github.com/kukulich",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
"type": "tidelift"
}
],
"time": "2020-10-05T12:39:37+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.8",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2020-10-23T02:01:07+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.4 || ^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

View File

@ -6,12 +6,11 @@
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phing\/phing": "^2.16.3",
"php-parallel-lint\/php-parallel-lint": "^1.2",
"phpstan\/extension-installer": "^1.0",
"phpstan\/phpstan": "^0.12.60",
"phpstan\/phpstan": "^0.12.87",
"phpstan\/phpstan-strict-rules": "^0.12.5",
"phpunit\/phpunit": "^7.5.20",
"phpunit\/phpunit": "^9.5",
"symfony\/process": "^5.2"
},
"config": {

View File

@ -1,41 +0,0 @@
PhpDocMethod
= AnnotationName IsStatic? MethodReturnType? MethodName MethodParameters? Description?
AnnotationName
= '@method'
IsStatic
= 'static'
MethodReturnType
= Type
MethodName
= [a-zA-Z_\127-\255][a-zA-Z0-9_\127-\255]*
MethodParameters
= '(' MethodParametersInner? ')'
MethodParametersInner
= MethodParameter (',' MethodParameter)*
MethodParameter
= MethodParameterType? IsReference? IsVariaric? MethodParameterName MethodParameterDefaultValue?
MethodParameterType
= Type
IsReference
= '&'
IsVariaric
= '...'
MethodParameterName
= '$' [a-zA-Z_\127-\255][a-zA-Z0-9_\127-\255]*
MethodParameterDefaultValue
= '=' PhpConstantExpr
Description
= .+ # TODO: exclude EOL or another PhpDocTag start

View File

@ -1,14 +0,0 @@
PhpDocParam
= AnnotationName Type IsVariadic? ParameterName Description?
AnnotationName
= '@param'
IsVariaric
= '...'
ParameterName
= '$' [a-zA-Z_\127-\255][a-zA-Z0-9_\127-\255]*
Description
= .+ # TODO: exclude EOL or another PhpDocTag start

View File

@ -1,243 +0,0 @@
; ---------------------------------------------------------------------------- ;
; Type ;
; ---------------------------------------------------------------------------- ;
Type
= Atomic [Union / Intersection]
/ Nullable
Union
= 1*(TokenUnion Atomic)
Intersection
= 1*(TokenIntersection Atomic)
Nullable
= TokenNullable TokenIdentifier [Generic]
Atomic
= TokenIdentifier [Generic / Callable / Array]
/ TokenThisVariable
/ TokenParenthesesOpen Type TokenParenthesesClose [Array]
Generic
= TokenAngleBracketOpen Type *(TokenComma Type) TokenAngleBracketClose
Callable
= TokenParenthesesOpen [CallableParameters] TokenParenthesesClose TokenColon CallableReturnType
CallableParameters
= CallableParameter *(TokenComma CallableParameter)
CallableParameter
= Type [CallableParameterIsReference] [CallableParameterIsVariadic] [CallableParameterName] [CallableParameterIsOptional]
CallableParameterIsReference
= TokenIntersection
CallableParameterIsVariadic
= TokenVariadic
CallableParameterName
= TokenVariable
CallableParameterIsOptional
= TokenEqualSign
CallableReturnType
= TokenIdentifier [Generic]
/ Nullable
/ TokenParenthesesOpen Type TokenParenthesesClose
Array
= 1*(TokenSquareBracketOpen TokenSquareBracketClose)
ArrayShape
= TokenCurlyBracketOpen ArrayShapeItem *(TokenComma ArrayShapeItem) TokenCurlyBracketClose
ArrayShapeItem
= (ConstantString / ConstantInt / TokenIdentifier) TokenNullable TokenColon Type
/ Type
; ---------------------------------------------------------------------------- ;
; ConstantExpr ;
; ---------------------------------------------------------------------------- ;
ConstantExpr
= ConstantFloat *ByteHorizontalWs
/ ConstantInt *ByteHorizontalWs
/ ConstantTrue *ByteHorizontalWs
/ ConstantFalse *ByteHorizontalWs
/ ConstantNull *ByteHorizontalWs
/ ConstantString *ByteHorizontalWs
/ ConstantArray *ByteHorizontalWs
/ ConstantFetch *ByteHorizontalWs
ConstantFloat
= ["-"] 1*ByteDecDigit "." *ByteDecDigit [ConstantFloatExp]
/ ["-"] 1*ByteDecDigit ConstantFloatExp
/ ["-"] "." 1*ByteDecDigit [ConstantFloatExp]
ConstantFloatExp
= "e" ["-"] 1*ByteDecDigit
ConstantInt
= ["-"] "0b" 1*ByteBinDigit
/ ["-"] "0o" 1*ByteOctDigit
/ ["-"] "0x" 1*ByteHexDigit
/ ["-"] 1*ByteDecDigit
ConstantTrue
= "true"
ConstantFalse
= "false"
ConstantNull
= "null"
ConstantString
= ByteSingleQuote *(ByteBackslash ByteNotEol / ByteNotEolAndNotBackslashAndNotSingleQuote) ByteSingleQuote
/ ByteDoubleQuote *(ByteBackslash ByteNotEol / ByteNotEolAndNotBackslashAndNotDoubleQuote) ByteDoubleQuote
ConstantArray
= TokenSquareBracketOpen [ConstantArrayItems] TokenSquareBracketClose
/ "array" TokenParenthesesOpen [ConstantArrayItems] TokenParenthesesClose
ConstantArrayItems
= ConstantArrayItem *(TokenComma ConstantArrayItem) [TokenComma]
ConstantArrayItem
= ConstantExpr [TokenDoubleArrow ConstantExpr]
ConstantFetch
= TokenIdentifier [TokenDoubleColon ByteIdentifierFirst *ByteIdentifierSecond *ByteHorizontalWs]
; ---------------------------------------------------------------------------- ;
; Tokens ;
; ---------------------------------------------------------------------------- ;
TokenUnion
= "|" *ByteHorizontalWs
TokenIntersection
= "&" *ByteHorizontalWs
TokenNullable
= "?" *ByteHorizontalWs
TokenParenthesesOpen
= "(" *ByteHorizontalWs
TokenParenthesesClose
= ")" *ByteHorizontalWs
TokenAngleBracketOpen
= "<" *ByteHorizontalWs
TokenAngleBracketClose
= ">" *ByteHorizontalWs
TokenSquareBracketOpen
= "[" *ByteHorizontalWs
TokenSquareBracketClose
= "]" *ByteHorizontalWs
TokenCurlyBracketOpen
= "{" *ByteHorizontalWs
TokenCurlyBracketClose
= "}" *ByteHorizontalWs
TokenComma
= "," *ByteHorizontalWs
TokenColon
= ":" *ByteHorizontalWs
TokenVariadic
= "..." *ByteHorizontalWs
TokenEqualSign
= "=" *ByteHorizontalWs
TokenVariable
= "$" ByteIdentifierFirst *ByteIdentifierSecond *ByteHorizontalWs
TokenDoubleArrow
= "=>" *ByteHorizontalWs
TokenDoubleColon
= "::" *ByteHorizontalWs
TokenThisVariable
= %x24.74.68.69.73 *ByteHorizontalWs
TokenIdentifier
= [ByteBackslash] ByteIdentifierFirst *ByteIdentifierSecond *(ByteBackslash ByteIdentifierFirst *ByteIdentifierSecond) *ByteHorizontalWs
; ---------------------------------------------------------------------------- ;
; Bytes ;
; ---------------------------------------------------------------------------- ;
ByteHorizontalWs
= %x09 ; horizontal tab
/ %x20 ; space
ByteBinDigit
= %x30-31 ; 0-1
ByteOctDigit
= %x30-37 ; 0-7
ByteDecDigit
= %x30-39 ; 0-9
ByteHexDigit
= %x30-39 ; 0-9
/ %x41-46 ; A-F
/ %x61-66 ; a-f
ByteIdentifierFirst
= %x41-5A ; A-Z
/ %x5F ; _
/ %x61-7A ; a-z
/ %x80-FF
ByteIdentifierSecond
= %x30-39 ; 0-9
/ %x41-5A ; A-Z
/ %x5F ; _
/ %x61-7A ; a-z
/ %x80-FF
ByteSingleQuote
= %x27 ; '
ByteDoubleQuote
= %x22 ; "
ByteBackslash
= %x5C ; \
ByteNotEol
= %x00-09 ; skip LF
/ %x0B-0C ; skip CR
/ %x0E-FF
ByteNotEolAndNotBackslashAndNotSingleQuote
= %x00-09 ; skip LF
/ %x0B-0C ; skip CR
/ %x0E-26 ; skip single quote
/ %x28-5B ; skip backslash
/ %x5D-FF
ByteNotEolAndNotBackslashAndNotDoubleQuote
= %x00-09 ; skip LF
/ %x0B-0C ; skip CR
/ %x0E-21 ; skip double quote
/ %x23-5B ; skip backslash
/ %x5D-FF

View File

@ -1,3 +0,0 @@
parameters:
ignoreErrors:
- '#^Dynamic call to static method PHPUnit\\Framework\\Assert#'

View File

@ -258,6 +258,9 @@ class TypeParser
private function parseArrayShape(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, \PHPStan\PhpDocParser\Ast\Type\TypeNode $type) : \PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode
{
$tokens->consumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_OPEN_CURLY_BRACKET);
if ($tokens->tryConsumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_CLOSE_CURLY_BRACKET)) {
return new \PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode([]);
}
$tokens->tryConsumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_PHPDOC_EOL);
$items = [$this->parseArrayShapeItem($tokens)];
$tokens->tryConsumeTokenType(\PHPStan\PhpDocParser\Lexer\Lexer::TOKEN_PHPDOC_EOL);

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('RectorPrefix20210611\CheckoutEntityFactory');
}
if (!class_exists('ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f', false) && !interface_exists('ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f', false) && !trait_exists('ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f', false)) {
spl_autoload_call('RectorPrefix20210611\ComposerAutoloaderInita9c5aefd41d8fa101d6024c98c33309f');
if (!class_exists('ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de', false) && !interface_exists('ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de', false) && !trait_exists('ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de', false)) {
spl_autoload_call('RectorPrefix20210611\ComposerAutoloaderInit8b0a6403bd88dd3eead0bf8fa5a5d5de');
}
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
spl_autoload_call('RectorPrefix20210611\Doctrine\Inflector\Inflector');
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210611\print_node(...func_get_args());
}
}
if (!function_exists('composerRequirea9c5aefd41d8fa101d6024c98c33309f')) {
function composerRequirea9c5aefd41d8fa101d6024c98c33309f() {
return \RectorPrefix20210611\composerRequirea9c5aefd41d8fa101d6024c98c33309f(...func_get_args());
if (!function_exists('composerRequire8b0a6403bd88dd3eead0bf8fa5a5d5de')) {
function composerRequire8b0a6403bd88dd3eead0bf8fa5a5d5de() {
return \RectorPrefix20210611\composerRequire8b0a6403bd88dd3eead0bf8fa5a5d5de(...func_get_args());
}
}
if (!function_exists('parseArgs')) {