Skip to content

Commit

Permalink
Use array<string, mixed> type for $attributes
Browse files Browse the repository at this point in the history
Slightly more accurate, and stops PHPStan from complaining about
the missing array type information.
  • Loading branch information
nikic committed Sep 11, 2022
1 parent c595989 commit a099803
Show file tree
Hide file tree
Showing 113 changed files with 115 additions and 115 deletions.
2 changes: 1 addition & 1 deletion lib/PhpParser/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getAttributes(): array {
/**
* Sets the attributes of the node/token the error occurred at.
*
* @param array $attributes
* @param array<string, mixed> $attributes
*/
public function setAttributes(array $attributes): void {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function getAttributes(): array;
/**
* Replaces all the attributes of this node.
*
* @param array $attributes
* @param array<string, mixed> $attributes
*/
public function setAttributes(array $attributes): void;
}
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Arg.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Arg extends NodeAbstract {
* @param Expr $value Value to pass
* @param bool $byRef Whether to pass by ref
* @param bool $unpack Whether to unpack the argument
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
* @param Identifier|null $name Parameter name (for named parameters)
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/ArrayItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ArrayItem extends NodeAbstract {
* @param Expr $value Value
* @param null|Expr $key Key
* @param bool $byRef Whether to assign by reference
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $value, ?Expr $key = null, bool $byRef = false, array $attributes = [], bool $unpack = false) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Attribute extends NodeAbstract {
/**
* @param Node\Name $name Attribute name
* @param Arg[] $args Attribute arguments
* @param array $attributes Additional node attributes
* @param array<string, mixed> $attributes Additional node attributes
*/
public function __construct(Name $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/AttributeGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AttributeGroup extends NodeAbstract {

/**
* @param Attribute[] $attrs PHP attributes
* @param array $attributes Additional node attributes
* @param array<string, mixed> $attributes Additional node attributes
*/
public function __construct(array $attrs, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/ClosureUse.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ClosureUse extends NodeAbstract {
*
* @param Expr\Variable $var Variable to use
* @param bool $byRef Whether to use by reference
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Const_.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Const_ extends NodeAbstract {
*
* @param string|Identifier $name Name
* @param Expr $value Value
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($name, Expr $value, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/DeclareItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DeclareItem extends NodeAbstract {
*
* @param string|Node\Identifier $key Key
* @param Node\Expr $value Value
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($key, Node\Expr $value, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ArrayDimFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ArrayDimFetch extends Expr {
*
* @param Expr $var Variable
* @param null|Expr $dim Array index / dim
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, ?Expr $dim = null, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Array_.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Array_ extends Expr {
* Constructs an array node.
*
* @param ArrayItem[] $items Items of the array
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $items = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ArrowFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ArrowFunction extends Expr implements FunctionLike {
* 'returnType' => null : Return type
* 'expr' => Expr : Expression body
* 'attrGroups' => array() : PHP attribute groups
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Assign extends Expr {
*
* @param Expr $var Variable
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/AssignOp.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class AssignOp extends Expr {
*
* @param Expr $var Variable
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/AssignRef.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AssignRef extends Expr {
*
* @param Expr $var Variable
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/BinaryOp.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class BinaryOp extends Expr {
*
* @param Expr $left The left hand side expression
* @param Expr $right The right hand side expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $left, Expr $right, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/BitwiseNot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BitwiseNot extends Expr {
* Constructs a bitwise not node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/BooleanNot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BooleanNot extends Expr {
* Constructs a boolean not node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class Cast extends Expr {
* Constructs a cast node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ClassConstFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ClassConstFetch extends Expr {
*
* @param Name|Expr $class Class name
* @param string|Identifier|Error $name Constant name
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Clone_.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Clone_ extends Expr {
* Constructs a clone node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Closure.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Closure extends Expr implements FunctionLike {
* 'returnType' => null : Return type
* 'stmts' => array(): Statements
* 'attrGroups' => array(): PHP attributes groups
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ConstFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ConstFetch extends Expr {
* Constructs a const fetch node.
*
* @param Name $name Constant name
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Name $name, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Empty_.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Empty_ extends Expr {
* Constructs an empty() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Error extends Expr {
/**
* Constructs an error node.
*
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ErrorSuppress.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ErrorSuppress extends Expr {
* Constructs an error suppress node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Eval_.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Eval_ extends Expr {
* Constructs an eval() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Exit_.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Exit_ extends Expr {
* Constructs an exit() node.
*
* @param null|Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(?Expr $expr = null, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/FuncCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FuncCall extends CallLike {
*
* @param Node\Name|Expr $name Function name
* @param array<Node\Arg|Node\VariadicPlaceholder> $args Arguments
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Include_.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Include_ extends Expr {
*
* @param Expr $expr Expression
* @param int $type Type of include
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, int $type, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Instanceof_.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Instanceof_ extends Expr {
*
* @param Expr $expr Expression
* @param Name|Expr $class Class name
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, $class, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Isset_.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Isset_ extends Expr {
* Constructs an array node.
*
* @param Expr[] $vars Variables
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/List_.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class List_ extends Expr {
* Constructs a list() destructuring node.
*
* @param (ArrayItem|null)[] $items List of items to assign to
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $items, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/MethodCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MethodCall extends CallLike {
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Method name
* @param array<Arg|VariadicPlaceholder> $args Arguments
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/New_.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class New_ extends CallLike {
*
* @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
* @param array<Arg|VariadicPlaceholder> $args Arguments
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($class, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/NullsafeMethodCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NullsafeMethodCall extends CallLike {
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Method name
* @param array<Arg|VariadicPlaceholder> $args Arguments
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/NullsafePropertyFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class NullsafePropertyFetch extends Expr {
*
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Property name
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PostDec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PostDec extends Expr {
* Constructs a post decrement node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PostInc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PostInc extends Expr {
* Constructs a post increment node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PreDec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PreDec extends Expr {
* Constructs a pre decrement node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PreInc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PreInc extends Expr {
* Constructs a pre increment node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Print_.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Print_ extends Expr {
* Constructs an print() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PropertyFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PropertyFetch extends Expr {
*
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Property name
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ShellExec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ShellExec extends Expr {
* Constructs a shell exec (backtick) node.
*
* @param array $parts Encapsed string array
* @param array $attributes Additional attributes
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = []) {
$this->attributes = $attributes;
Expand Down
Loading

0 comments on commit a099803

Please sign in to comment.