Updated Rector to commit 0a07bf39b8c3852a0bd289280ee6e60080561447

0a07bf39b8 [automated] Re-Generate Nodes/Rectors Documentation (#5729)
This commit is contained in:
Tomas Votruba 2024-03-17 00:28:32 +00:00
parent dd371cdca2
commit 29535d04eb
34 changed files with 43 additions and 43 deletions

View File

@ -1,4 +1,4 @@
# 365 Rules Overview # 366 Rules Overview
<br> <br>

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '6477094d5af502e65c75c30af7ce59ef3b8cc2d7'; public const PACKAGE_VERSION = '0a07bf39b8c3852a0bd289280ee6e60080561447';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-03-16 17:30:11'; public const RELEASE_DATE = '2024-03-17 00:26:08';
/** /**
* @var int * @var int
*/ */

View File

@ -701,28 +701,28 @@
}, },
{ {
"name": "nikic\/php-parser", "name": "nikic\/php-parser",
"version": "v4.18.0", "version": "v4.19.0",
"version_normalized": "4.18.0.0", "version_normalized": "4.19.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/nikic\/PHP-Parser.git", "url": "https:\/\/github.com\/nikic\/PHP-Parser.git",
"reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" "reference": "32cdab9a034239a8f57ae0e9a15bada4bd9747bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https:\/\/api.github.com\/repos\/nikic\/PHP-Parser\/zipball\/1bcbb2179f97633e98bbbc87044ee2611c7d7999", "url": "https:\/\/api.github.com\/repos\/nikic\/PHP-Parser\/zipball\/32cdab9a034239a8f57ae0e9a15bada4bd9747bf",
"reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", "reference": "32cdab9a034239a8f57ae0e9a15bada4bd9747bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": ">=7.0" "php": ">=7.1"
}, },
"require-dev": { "require-dev": {
"ircmaxell\/php-yacc": "^0.0.7", "ircmaxell\/php-yacc": "^0.0.7",
"phpunit\/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" "phpunit\/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
}, },
"time": "2023-12-10T21:03:43+00:00", "time": "2024-03-16T14:49:31+00:00",
"bin": [ "bin": [
"bin\/php-parse" "bin\/php-parse"
], ],
@ -771,7 +771,7 @@
], ],
"support": { "support": {
"issues": "https:\/\/github.com\/nikic\/PHP-Parser\/issues", "issues": "https:\/\/github.com\/nikic\/PHP-Parser\/issues",
"source": "https:\/\/github.com\/nikic\/PHP-Parser\/tree\/v4.18.0" "source": "https:\/\/github.com\/nikic\/PHP-Parser\/tree\/v4.19.0"
}, },
"install-path": "..\/nikic\/php-parser" "install-path": "..\/nikic\/php-parser"
}, },

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ PHP Parser
This is a PHP 5.2 to PHP 8.2 parser written in PHP. Its purpose is to simplify static code analysis and This is a PHP 5.2 to PHP 8.2 parser written in PHP. Its purpose is to simplify static code analysis and
manipulation. manipulation.
[**Documentation for version 4.x**][doc_4_x] (stable; for running on PHP >= 7.0; for parsing PHP 5.2 to PHP 8.2). [**Documentation for version 4.x**][doc_4_x] (stable; for running on PHP >= 7.1; for parsing PHP 5.2 to PHP 8.2).
[Documentation for version 3.x][doc_3_x] (unsupported; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.2). [Documentation for version 3.x][doc_3_x] (unsupported; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.2).

View File

@ -13,7 +13,7 @@
} }
], ],
"require": { "require": {
"php": ">=7.0", "php": ">=7.1",
"ext-tokenizer": "*" "ext-tokenizer": "*"
}, },
"require-dev": { "require-dev": {

View File

@ -35,7 +35,7 @@ class ConstExprEvaluator
* *
* @param callable|null $fallbackEvaluator To call if subexpression cannot be evaluated * @param callable|null $fallbackEvaluator To call if subexpression cannot be evaluated
*/ */
public function __construct(callable $fallbackEvaluator = null) public function __construct(?callable $fallbackEvaluator = null)
{ {
$this->fallbackEvaluator = $fallbackEvaluator ?? function (Expr $expr) { $this->fallbackEvaluator = $fallbackEvaluator ?? function (Expr $expr) {
throw new \PhpParser\ConstExprEvaluationException("Expression of type {$expr->getType()} cannot be evaluated"); throw new \PhpParser\ConstExprEvaluationException("Expression of type {$expr->getType()} cannot be evaluated");

View File

@ -29,7 +29,7 @@ class PrintableNewAnonClassNode extends Expr
public $implements; public $implements;
/** @var Node\Stmt[] Statements */ /** @var Node\Stmt[] Statements */
public $stmts; public $stmts;
public function __construct(array $attrGroups, int $flags, array $args, Node\Name $extends = null, array $implements, array $stmts, array $attributes) public function __construct(array $attrGroups, int $flags, array $args, ?Node\Name $extends = null, array $implements, array $stmts, array $attributes)
{ {
parent::__construct($attributes); parent::__construct($attributes);
$this->attrGroups = $attrGroups; $this->attrGroups = $attrGroups;

View File

@ -61,7 +61,7 @@ class Lexer
* @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to * @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to
* ErrorHandler\Throwing * ErrorHandler\Throwing
*/ */
public function startLexing(string $code, \PhpParser\ErrorHandler $errorHandler = null) public function startLexing(string $code, ?\PhpParser\ErrorHandler $errorHandler = null)
{ {
if (null === $errorHandler) { if (null === $errorHandler) {
$errorHandler = new \PhpParser\ErrorHandler\Throwing(); $errorHandler = new \PhpParser\ErrorHandler\Throwing();

View File

@ -56,7 +56,7 @@ class Emulative extends Lexer
} }
} }
} }
public function startLexing(string $code, ErrorHandler $errorHandler = null) public function startLexing(string $code, ?ErrorHandler $errorHandler = null)
{ {
$emulators = \array_filter($this->emulators, function ($emulator) use($code) { $emulators = \array_filter($this->emulators, function ($emulator) use($code) {
return $emulator->isEmulationNeeded($code); return $emulator->isEmulationNeeded($code);

View File

@ -32,7 +32,7 @@ class NameContext
* *
* @param Name|null $namespace Null is the global namespace * @param Name|null $namespace Null is the global namespace
*/ */
public function startNamespace(Name $namespace = null) public function startNamespace(?Name $namespace = null)
{ {
$this->namespace = $namespace; $this->namespace = $namespace;
$this->origAliases = $this->aliases = [Stmt\Use_::TYPE_NORMAL => [], Stmt\Use_::TYPE_FUNCTION => [], Stmt\Use_::TYPE_CONSTANT => []]; $this->origAliases = $this->aliases = [Stmt\Use_::TYPE_NORMAL => [], Stmt\Use_::TYPE_FUNCTION => [], Stmt\Use_::TYPE_CONSTANT => []];

View File

@ -24,7 +24,7 @@ class Arg extends NodeAbstract
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
* @param Identifier|null $name Parameter name (for named parameters) * @param Identifier|null $name Parameter name (for named parameters)
*/ */
public function __construct(\PhpParser\Node\Expr $value, bool $byRef = \false, bool $unpack = \false, array $attributes = [], \PhpParser\Node\Identifier $name = null) public function __construct(\PhpParser\Node\Expr $value, bool $byRef = \false, bool $unpack = \false, array $attributes = [], ?\PhpParser\Node\Identifier $name = null)
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->name = $name; $this->name = $name;

View File

@ -17,7 +17,7 @@ class ArrayDimFetch extends Expr
* @param null|Expr $dim Array index / dim * @param null|Expr $dim Array index / dim
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Expr $var, Expr $dim = null, array $attributes = []) public function __construct(Expr $var, ?Expr $dim = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->var = $var; $this->var = $var;

View File

@ -22,7 +22,7 @@ class ArrayItem extends Expr
* @param bool $byRef Whether to assign by reference * @param bool $byRef Whether to assign by reference
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Expr $value, Expr $key = null, bool $byRef = \false, array $attributes = [], bool $unpack = \false) public function __construct(Expr $value, ?Expr $key = null, bool $byRef = \false, array $attributes = [], bool $unpack = \false)
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->key = $key; $this->key = $key;

View File

@ -17,7 +17,7 @@ class Exit_ extends Expr
* @param null|Expr $expr Expression * @param null|Expr $expr Expression
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Expr $expr = null, array $attributes = []) public function __construct(?Expr $expr = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->expr = $expr; $this->expr = $expr;

View File

@ -17,7 +17,7 @@ class Yield_ extends Expr
* @param null|Expr $key Key expression * @param null|Expr $key Key expression
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Expr $value = null, Expr $key = null, array $attributes = []) public function __construct(?Expr $value = null, ?Expr $key = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->key = $key; $this->key = $key;

View File

@ -155,7 +155,7 @@ class Name extends NodeAbstract
* *
* @return static|null Sliced name * @return static|null Sliced name
*/ */
public function slice(int $offset, int $length = null) public function slice(int $offset, ?int $length = null)
{ {
$numParts = \count($this->parts); $numParts = \count($this->parts);
$realOffset = $offset < 0 ? $offset + $numParts : $offset; $realOffset = $offset < 0 ? $offset + $numParts : $offset;

View File

@ -32,7 +32,7 @@ class Param extends NodeAbstract
* @param int $flags Optional visibility flags * @param int $flags Optional visibility flags
* @param AttributeGroup[] $attrGroups PHP attribute groups * @param AttributeGroup[] $attrGroups PHP attribute groups
*/ */
public function __construct($var, \PhpParser\Node\Expr $default = null, $type = null, bool $byRef = \false, bool $variadic = \false, array $attributes = [], int $flags = 0, array $attrGroups = []) public function __construct($var, ?\PhpParser\Node\Expr $default = null, $type = null, bool $byRef = \false, bool $variadic = \false, array $attributes = [], int $flags = 0, array $attrGroups = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->type = \is_string($type) ? new \PhpParser\Node\Identifier($type) : $type; $this->type = \is_string($type) ? new \PhpParser\Node\Identifier($type) : $type;

View File

@ -14,7 +14,7 @@ class Break_ extends Node\Stmt
* @param null|Node\Expr $num Number of loops to break * @param null|Node\Expr $num Number of loops to break
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Node\Expr $num = null, array $attributes = []) public function __construct(?Node\Expr $num = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->num = $num; $this->num = $num;

View File

@ -22,7 +22,7 @@ class Catch_ extends Node\Stmt implements StmtsAwareInterface
* @param Node\Stmt[] $stmts Statements * @param Node\Stmt[] $stmts Statements
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(array $types, Expr\Variable $var = null, array $stmts = [], array $attributes = []) public function __construct(array $types, ?Expr\Variable $var = null, array $stmts = [], array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->types = $types; $this->types = $types;

View File

@ -14,7 +14,7 @@ class Continue_ extends Node\Stmt
* @param null|Node\Expr $num Number of loops to continue * @param null|Node\Expr $num Number of loops to continue
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Node\Expr $num = null, array $attributes = []) public function __construct(?Node\Expr $num = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->num = $num; $this->num = $num;

View File

@ -17,7 +17,7 @@ class Declare_ extends Node\Stmt
* @param Node\Stmt[]|null $stmts Statements * @param Node\Stmt[]|null $stmts Statements
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(array $declares, array $stmts = null, array $attributes = []) public function __construct(array $declares, ?array $stmts = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->declares = $declares; $this->declares = $declares;

View File

@ -19,7 +19,7 @@ class EnumCase extends Node\Stmt
* @param AttributeGroup[] $attrGroups PHP attribute groups * @param AttributeGroup[] $attrGroups PHP attribute groups
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct($name, Node\Expr $expr = null, array $attrGroups = [], array $attributes = []) public function __construct($name, ?Node\Expr $expr = null, array $attrGroups = [], array $attributes = [])
{ {
parent::__construct($attributes); parent::__construct($attributes);
$this->name = \is_string($name) ? new Node\Identifier($name) : $name; $this->name = \is_string($name) ? new Node\Identifier($name) : $name;

View File

@ -21,7 +21,7 @@ class Namespace_ extends Node\Stmt implements StmtsAwareInterface
* @param null|Node\Stmt[] $stmts Statements * @param null|Node\Stmt[] $stmts Statements
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Node\Name $name = null, $stmts = [], array $attributes = []) public function __construct(?Node\Name $name = null, $stmts = [], array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->name = $name; $this->name = $name;

View File

@ -17,7 +17,7 @@ class PropertyProperty extends Node\Stmt
* @param null|Node\Expr $default Default value * @param null|Node\Expr $default Default value
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct($name, Node\Expr $default = null, array $attributes = []) public function __construct($name, ?Node\Expr $default = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name;

View File

@ -14,7 +14,7 @@ class Return_ extends Node\Stmt
* @param null|Node\Expr $expr Expression * @param null|Node\Expr $expr Expression
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Node\Expr $expr = null, array $attributes = []) public function __construct(?Node\Expr $expr = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->expr = $expr; $this->expr = $expr;

View File

@ -18,7 +18,7 @@ class StaticVar extends Node\Stmt
* @param null|Node\Expr $default Default value * @param null|Node\Expr $default Default value
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(Expr\Variable $var, Node\Expr $default = null, array $attributes = []) public function __construct(Expr\Variable $var, ?Node\Expr $default = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->var = $var; $this->var = $var;

View File

@ -21,7 +21,7 @@ class TryCatch extends Node\Stmt implements StmtsAwareInterface
* @param null|Finally_ $finally Optional finally node * @param null|Finally_ $finally Optional finally node
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(array $stmts, array $catches, \PhpParser\Node\Stmt\Finally_ $finally = null, array $attributes = []) public function __construct(array $stmts, array $catches, ?\PhpParser\Node\Stmt\Finally_ $finally = null, array $attributes = [])
{ {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->stmts = $stmts; $this->stmts = $stmts;

View File

@ -38,7 +38,7 @@ class NodeDumper
* *
* @return string Dumped value * @return string Dumped value
*/ */
public function dump($node, string $code = null) : string public function dump($node, ?string $code = null) : string
{ {
$this->code = $code; $this->code = $code;
return $this->dumpRecursive($node); return $this->dumpRecursive($node);

View File

@ -32,7 +32,7 @@ class NameResolver extends NodeVisitorAbstract
* @param ErrorHandler|null $errorHandler Error handler * @param ErrorHandler|null $errorHandler Error handler
* @param array $options Options * @param array $options Options
*/ */
public function __construct(ErrorHandler $errorHandler = null, array $options = []) public function __construct(?ErrorHandler $errorHandler = null, array $options = [])
{ {
$this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing()); $this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing());
$this->preserveOriginalNames = $options['preserveOriginalNames'] ?? \false; $this->preserveOriginalNames = $options['preserveOriginalNames'] ?? \false;
@ -150,7 +150,7 @@ class NameResolver extends NodeVisitorAbstract
} }
return null; return null;
} }
private function addAlias(Stmt\UseUse $use, int $type, Name $prefix = null) private function addAlias(Stmt\UseUse $use, int $type, ?Name $prefix = null)
{ {
// Add prefix for group uses // Add prefix for group uses
$name = $prefix ? Name::concat($prefix, $use->name) : $use->name; $name = $prefix ? Name::concat($prefix, $use->name) : $use->name;

View File

@ -15,5 +15,5 @@ interface Parser
* @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and
* the parser was unable to recover from an error). * the parser was unable to recover from an error).
*/ */
public function parse(string $code, \PhpParser\ErrorHandler $errorHandler = null); public function parse(string $code, ?\PhpParser\ErrorHandler $errorHandler = null);
} }

View File

@ -23,7 +23,7 @@ class Multiple implements Parser
{ {
$this->parsers = $parsers; $this->parsers = $parsers;
} }
public function parse(string $code, ErrorHandler $errorHandler = null) public function parse(string $code, ?ErrorHandler $errorHandler = null)
{ {
if (null === $errorHandler) { if (null === $errorHandler) {
$errorHandler = new ErrorHandler\Throwing(); $errorHandler = new ErrorHandler\Throwing();

View File

@ -139,7 +139,7 @@ abstract class ParserAbstract implements \PhpParser\Parser
* @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and
* the parser was unable to recover from an error). * the parser was unable to recover from an error).
*/ */
public function parse(string $code, \PhpParser\ErrorHandler $errorHandler = null) public function parse(string $code, ?\PhpParser\ErrorHandler $errorHandler = null)
{ {
$this->errorHandler = $errorHandler ?: new \PhpParser\ErrorHandler\Throwing(); $this->errorHandler = $errorHandler ?: new \PhpParser\ErrorHandler\Throwing();
$this->lexer->startLexing($code, $this->errorHandler); $this->lexer->startLexing($code, $this->errorHandler);

View File

@ -20,7 +20,7 @@ class ParserFactory
* *
* @return Parser The parser instance * @return Parser The parser instance
*/ */
public function create(int $kind, \PhpParser\Lexer $lexer = null, array $parserOptions = []) : \PhpParser\Parser public function create(int $kind, ?\PhpParser\Lexer $lexer = null, array $parserOptions = []) : \PhpParser\Parser
{ {
if (null === $lexer) { if (null === $lexer) {
$lexer = new \PhpParser\Lexer\Emulative(); $lexer = new \PhpParser\Lexer\Emulative();