mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-07-24 15:51:32 +02:00
Add more property types
Some of these are not maximally accurate due to lack of union types.
This commit is contained in:
@@ -22,8 +22,8 @@ class ClassConst implements PhpParser\Builder {
|
||||
|
||||
/** @var list<Node\AttributeGroup> */
|
||||
protected array $attributeGroups = [];
|
||||
/** @var Identifier|Node\Name|Node\ComplexType */
|
||||
protected $type;
|
||||
/** @var Identifier|Node\Name|Node\ComplexType|null */
|
||||
protected ?Node $type = null;
|
||||
|
||||
/**
|
||||
* Creates a class constant builder
|
||||
|
@@ -14,7 +14,7 @@ class EnumCase implements PhpParser\Builder {
|
||||
/** @var Identifier|string */
|
||||
protected $name;
|
||||
/** @var ?Node\Expr */
|
||||
protected $value = null;
|
||||
protected ?Node\Expr $value = null;
|
||||
/** @var array<string, mixed> */
|
||||
protected array $attributes = [];
|
||||
|
||||
|
@@ -12,7 +12,7 @@ abstract class FunctionLike extends Declaration {
|
||||
protected array $params = [];
|
||||
|
||||
/** @var Node\Identifier|Node\Name|Node\ComplexType|null */
|
||||
protected $returnType = null;
|
||||
protected ?Node $returnType = null;
|
||||
|
||||
/**
|
||||
* Make the function return by reference.
|
||||
|
@@ -13,7 +13,7 @@ class Param implements PhpParser\Builder {
|
||||
/** @var Node\Expr|null */
|
||||
protected ?Node\Expr $default = null;
|
||||
/** @var Node\Identifier|Node\Name|Node\ComplexType|null */
|
||||
protected $type = null;
|
||||
protected ?Node $type = null;
|
||||
/** @var bool */
|
||||
protected bool $byRef = false;
|
||||
/** @var int */
|
||||
|
@@ -21,7 +21,7 @@ class Property implements PhpParser\Builder {
|
||||
/** @var array<string, mixed> */
|
||||
protected array $attributes = [];
|
||||
/** @var null|Identifier|Name|ComplexType */
|
||||
protected $type;
|
||||
protected ?Node $type = null;
|
||||
/** @var list<Node\AttributeGroup> */
|
||||
protected array $attributeGroups = [];
|
||||
|
||||
|
@@ -21,7 +21,7 @@ class PrintableNewAnonClassNode extends Expr {
|
||||
/** @var int Modifiers */
|
||||
public int $flags;
|
||||
/** @var (Node\Arg|Node\VariadicPlaceholder)[] Arguments */
|
||||
public $args;
|
||||
public array $args;
|
||||
/** @var null|Node\Name Name of extended class */
|
||||
public ?Node\Name $extends;
|
||||
/** @var Node\Name[] Names of implemented interfaces */
|
||||
|
@@ -17,7 +17,7 @@ class ArrowFunction extends Expr implements FunctionLike {
|
||||
public array $params = [];
|
||||
|
||||
/** @var null|Node\Identifier|Node\Name|Node\ComplexType */
|
||||
public $returnType;
|
||||
public ?Node $returnType;
|
||||
|
||||
/** @var Expr */
|
||||
public Expr $expr;
|
||||
|
@@ -2,15 +2,16 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
|
||||
class ClassConstFetch extends Expr {
|
||||
/** @var Name|Expr Class name */
|
||||
public $class;
|
||||
public Node $class;
|
||||
/** @var Identifier|Expr|Error Constant name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
|
||||
/**
|
||||
* Constructs a class const fetch node.
|
||||
@@ -19,7 +20,7 @@ class ClassConstFetch extends Expr {
|
||||
* @param string|Identifier|Expr|Error $name Constant name
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, $name, array $attributes = []) {
|
||||
public function __construct(Node $class, $name, array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
$this->class = $class;
|
||||
$this->name = \is_string($name) ? new Identifier($name) : $name;
|
||||
|
@@ -17,7 +17,7 @@ class Closure extends Expr implements FunctionLike {
|
||||
/** @var ClosureUse[] use()s */
|
||||
public array $uses;
|
||||
/** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
|
||||
public $returnType;
|
||||
public ?Node $returnType;
|
||||
/** @var Node\Stmt[] Statements */
|
||||
public array $stmts;
|
||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||
|
@@ -7,18 +7,18 @@ use PhpParser\Node\Expr;
|
||||
|
||||
class FuncCall extends CallLike {
|
||||
/** @var Node\Name|Expr Function name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
/** @var array<Node\Arg|Node\VariadicPlaceholder> Arguments */
|
||||
public $args;
|
||||
public array $args;
|
||||
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param Node\Name|Expr $name Function name
|
||||
* @param array<Node\Arg|Node\VariadicPlaceholder> $args Arguments
|
||||
* @param Node\Name|Expr $name Function name
|
||||
* @param array<Node\Arg|Node\VariadicPlaceholder> $args Arguments
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($name, array $args = [], array $attributes = []) {
|
||||
public function __construct(Node $name, array $args = [], array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
$this->name = $name;
|
||||
$this->args = $args;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Name;
|
||||
|
||||
@@ -9,16 +10,16 @@ class Instanceof_ extends Expr {
|
||||
/** @var Expr Expression */
|
||||
public Expr $expr;
|
||||
/** @var Name|Expr Class name */
|
||||
public $class;
|
||||
public Node $class;
|
||||
|
||||
/**
|
||||
* Constructs an instanceof check node.
|
||||
*
|
||||
* @param Expr $expr Expression
|
||||
* @param Name|Expr $class Class name
|
||||
* @param Expr $expr Expression
|
||||
* @param Name|Expr $class Class name
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(Expr $expr, $class, array $attributes = []) {
|
||||
public function __construct(Expr $expr, Node $class, array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
$this->expr = $expr;
|
||||
$this->class = $class;
|
||||
|
@@ -11,7 +11,7 @@ class List_ extends Expr {
|
||||
public const KIND_ARRAY = 2; // [] syntax
|
||||
|
||||
/** @var (ArrayItem|null)[] List of items to assign to */
|
||||
public $items;
|
||||
public array $items;
|
||||
|
||||
/**
|
||||
* Constructs a list() destructuring node.
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
@@ -11,16 +12,16 @@ class MethodCall extends CallLike {
|
||||
/** @var Expr Variable holding object */
|
||||
public Expr $var;
|
||||
/** @var Identifier|Expr Method name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
/** @var array<Arg|VariadicPlaceholder> Arguments */
|
||||
public $args;
|
||||
public array $args;
|
||||
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
|
||||
|
@@ -9,18 +9,18 @@ use PhpParser\Node\VariadicPlaceholder;
|
||||
|
||||
class New_ extends CallLike {
|
||||
/** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
|
||||
public $class;
|
||||
public Node $class;
|
||||
/** @var array<Arg|VariadicPlaceholder> Arguments */
|
||||
public $args;
|
||||
public array $args;
|
||||
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, array $args = [], array $attributes = []) {
|
||||
public function __construct(Node $class, array $args = [], array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
$this->class = $class;
|
||||
$this->args = $args;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
@@ -11,16 +12,16 @@ class NullsafeMethodCall extends CallLike {
|
||||
/** @var Expr Variable holding object */
|
||||
public Expr $var;
|
||||
/** @var Identifier|Expr Method name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
/** @var array<Arg|VariadicPlaceholder> Arguments */
|
||||
public $args;
|
||||
public array $args;
|
||||
|
||||
/**
|
||||
* Constructs a nullsafe method call node.
|
||||
*
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
|
||||
@@ -9,13 +10,13 @@ class NullsafePropertyFetch extends Expr {
|
||||
/** @var Expr Variable holding object */
|
||||
public Expr $var;
|
||||
/** @var Identifier|Expr Property name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
|
||||
/**
|
||||
* Constructs a nullsafe property fetch node.
|
||||
*
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Property name
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Property name
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(Expr $var, $name, array $attributes = []) {
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
|
||||
@@ -9,13 +10,13 @@ class PropertyFetch extends Expr {
|
||||
/** @var Expr Variable holding object */
|
||||
public Expr $var;
|
||||
/** @var Identifier|Expr Property name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Property name
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Property name
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(Expr $var, $name, array $attributes = []) {
|
||||
|
@@ -7,7 +7,7 @@ use PhpParser\Node\InterpolatedStringPart;
|
||||
|
||||
class ShellExec extends Expr {
|
||||
/** @var (Expr|InterpolatedStringPart)[] Interpolated string array */
|
||||
public $parts;
|
||||
public array $parts;
|
||||
|
||||
/**
|
||||
* Constructs a shell exec (backtick) node.
|
||||
|
@@ -10,21 +10,21 @@ use PhpParser\Node\VariadicPlaceholder;
|
||||
|
||||
class StaticCall extends CallLike {
|
||||
/** @var Node\Name|Expr Class name */
|
||||
public $class;
|
||||
public Node $class;
|
||||
/** @var Identifier|Expr Method name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
/** @var array<Arg|VariadicPlaceholder> Arguments */
|
||||
public $args;
|
||||
public array $args;
|
||||
|
||||
/**
|
||||
* Constructs a static method call node.
|
||||
*
|
||||
* @param Node\Name|Expr $class Class name
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param Node\Name|Expr $class Class name
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, $name, array $args = [], array $attributes = []) {
|
||||
public function __construct(Node $class, $name, array $args = [], array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
$this->class = $class;
|
||||
$this->name = \is_string($name) ? new Identifier($name) : $name;
|
||||
|
@@ -2,24 +2,25 @@
|
||||
|
||||
namespace PhpParser\Node\Expr;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\VarLikeIdentifier;
|
||||
|
||||
class StaticPropertyFetch extends Expr {
|
||||
/** @var Name|Expr Class name */
|
||||
public $class;
|
||||
public Node $class;
|
||||
/** @var VarLikeIdentifier|Expr Property name */
|
||||
public $name;
|
||||
public Node $name;
|
||||
|
||||
/**
|
||||
* Constructs a static property fetch node.
|
||||
*
|
||||
* @param Name|Expr $class Class name
|
||||
* @param string|VarLikeIdentifier|Expr $name Property name
|
||||
* @param Name|Expr $class Class name
|
||||
* @param string|VarLikeIdentifier|Expr $name Property name
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, $name, array $attributes = []) {
|
||||
public function __construct(Node $class, $name, array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
$this->class = $class;
|
||||
$this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name;
|
||||
|
@@ -4,7 +4,7 @@ namespace PhpParser\Node;
|
||||
|
||||
class IntersectionType extends ComplexType {
|
||||
/** @var (Identifier|Name)[] Types */
|
||||
public $types;
|
||||
public array $types;
|
||||
|
||||
/**
|
||||
* Constructs an intersection type.
|
||||
|
@@ -6,7 +6,7 @@ use PhpParser\Node;
|
||||
|
||||
class NullableType extends ComplexType {
|
||||
/** @var Identifier|Name Type */
|
||||
public $type;
|
||||
public Node $type;
|
||||
|
||||
/**
|
||||
* Constructs a nullable type (wrapping another type).
|
||||
|
@@ -8,13 +8,13 @@ use PhpParser\NodeAbstract;
|
||||
|
||||
class Param extends NodeAbstract {
|
||||
/** @var null|Identifier|Name|ComplexType Type declaration */
|
||||
public $type;
|
||||
public ?Node $type;
|
||||
/** @var bool Whether parameter is passed by reference */
|
||||
public bool $byRef;
|
||||
/** @var bool Whether this is a variadic argument */
|
||||
public bool $variadic;
|
||||
/** @var Expr\Variable|Expr\Error Parameter variable */
|
||||
public $var;
|
||||
public Expr $var;
|
||||
/** @var null|Expr Default value */
|
||||
public ?Expr $default;
|
||||
/** @var int */
|
||||
@@ -25,17 +25,17 @@ class Param extends NodeAbstract {
|
||||
/**
|
||||
* Constructs a parameter node.
|
||||
*
|
||||
* @param Expr\Variable|Expr\Error $var Parameter variable
|
||||
* @param null|Expr $default Default value
|
||||
* @param Expr\Variable|Expr\Error $var Parameter variable
|
||||
* @param null|Expr $default Default value
|
||||
* @param null|Identifier|Name|ComplexType $type Type declaration
|
||||
* @param bool $byRef Whether is passed by reference
|
||||
* @param bool $variadic Whether this is a variadic argument
|
||||
* @param bool $byRef Whether is passed by reference
|
||||
* @param bool $variadic Whether this is a variadic argument
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
* @param int $flags Optional visibility flags
|
||||
* @param int $flags Optional visibility flags
|
||||
* @param list<AttributeGroup> $attrGroups PHP attribute groups
|
||||
*/
|
||||
public function __construct(
|
||||
$var, ?Expr $default = null, ?Node $type = null,
|
||||
Expr $var, ?Expr $default = null, ?Node $type = null,
|
||||
bool $byRef = false, bool $variadic = false,
|
||||
array $attributes = [],
|
||||
int $flags = 0,
|
||||
|
@@ -8,7 +8,7 @@ use PhpParser\Node\Scalar;
|
||||
|
||||
class InterpolatedString extends Scalar {
|
||||
/** @var (Expr|InterpolatedStringPart)[] list of string parts */
|
||||
public $parts;
|
||||
public array $parts;
|
||||
|
||||
/**
|
||||
* Constructs an interpolated string node.
|
||||
|
@@ -13,7 +13,7 @@ class ClassConst extends Node\Stmt {
|
||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||
public array $attrGroups;
|
||||
/** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */
|
||||
public $type;
|
||||
public ?Node $type;
|
||||
|
||||
/**
|
||||
* Constructs a class const list node.
|
||||
|
@@ -16,7 +16,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike {
|
||||
/** @var Node\Param[] Parameters */
|
||||
public array $params;
|
||||
/** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
|
||||
public $returnType;
|
||||
public ?Node $returnType;
|
||||
/** @var Node\Stmt[]|null Statements */
|
||||
public ?array $stmts;
|
||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||
|
@@ -6,7 +6,7 @@ use PhpParser\Node;
|
||||
|
||||
class Enum_ extends ClassLike {
|
||||
/** @var null|Node\Identifier Scalar Type */
|
||||
public $scalarType;
|
||||
public ?Node $scalarType;
|
||||
/** @var Node\Name[] Names of implemented interfaces */
|
||||
public array $implements;
|
||||
|
||||
|
@@ -13,7 +13,7 @@ class Function_ extends Node\Stmt implements FunctionLike {
|
||||
/** @var Node\Param[] Parameters */
|
||||
public array $params;
|
||||
/** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
|
||||
public $returnType;
|
||||
public ?Node $returnType;
|
||||
/** @var Node\Stmt[] Statements */
|
||||
public array $stmts;
|
||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||
|
@@ -15,18 +15,18 @@ class Property extends Node\Stmt {
|
||||
/** @var PropertyItem[] Properties */
|
||||
public array $props;
|
||||
/** @var null|Identifier|Name|ComplexType Type declaration */
|
||||
public $type;
|
||||
public ?Node $type;
|
||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||
public array $attrGroups;
|
||||
|
||||
/**
|
||||
* Constructs a class property list node.
|
||||
*
|
||||
* @param int $flags Modifiers
|
||||
* @param PropertyItem[] $props Properties
|
||||
* @param int $flags Modifiers
|
||||
* @param PropertyItem[] $props Properties
|
||||
* @param array<string, mixed> $attributes Additional attributes
|
||||
* @param null|Identifier|Name|ComplexType $type Type declaration
|
||||
* @param Node\AttributeGroup[] $attrGroups PHP attribute groups
|
||||
* @param Node\AttributeGroup[] $attrGroups PHP attribute groups
|
||||
*/
|
||||
public function __construct(int $flags, array $props, array $attributes = [], ?Node $type = null, array $attrGroups = []) {
|
||||
$this->attributes = $attributes;
|
||||
|
@@ -4,7 +4,7 @@ namespace PhpParser\Node;
|
||||
|
||||
class UnionType extends ComplexType {
|
||||
/** @var (Identifier|Name|IntersectionType)[] Types */
|
||||
public $types;
|
||||
public array $types;
|
||||
|
||||
/**
|
||||
* Constructs a union type.
|
||||
|
@@ -126,7 +126,7 @@ abstract class ParserAbstract implements Parser {
|
||||
protected int $errorState;
|
||||
|
||||
/** @var \SplObjectStorage<Array_, null>|null Array nodes created during parsing, for postprocessing of empty elements. */
|
||||
protected $createdArrays;
|
||||
protected ?\SplObjectStorage $createdArrays;
|
||||
|
||||
/** @var Token[] Tokens for the current parse */
|
||||
protected array $tokens;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace PhpParser;
|
||||
|
||||
use PhpParser\Internal\DiffElem;
|
||||
use PhpParser\Internal\Differ;
|
||||
use PhpParser\Internal\PrintableNewAnonClassNode;
|
||||
use PhpParser\Internal\TokenStream;
|
||||
use PhpParser\Node\AttributeGroup;
|
||||
@@ -120,8 +121,8 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
|
||||
|
||||
/** @var TokenStream|null Original tokens for use in format-preserving pretty print */
|
||||
protected ?TokenStream $origTokens;
|
||||
/** @var Internal\Differ<Node>|null Differ for node lists */
|
||||
protected $nodeListDiffer;
|
||||
/** @var Internal\Differ<Node> Differ for node lists */
|
||||
protected Differ $nodeListDiffer;
|
||||
/** @var array<string, bool> Map determining whether a certain character is a label character */
|
||||
protected array $labelCharMap;
|
||||
/**
|
||||
@@ -1273,7 +1274,7 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
|
||||
* The node list differ is used to determine differences between two array subnodes.
|
||||
*/
|
||||
protected function initializeNodeListDiffer(): void {
|
||||
if ($this->nodeListDiffer) {
|
||||
if (isset($this->nodeListDiffer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -108,7 +108,7 @@ class FunctionTest extends \PHPUnit\Framework\TestCase {
|
||||
->getNode();
|
||||
|
||||
$this->assertEquals(new Stmt\Function_('test', [
|
||||
'returnType' => 'void'
|
||||
'returnType' => new Identifier('void'),
|
||||
], []), $node);
|
||||
}
|
||||
|
||||
|
@@ -149,7 +149,7 @@ class MethodTest extends \PHPUnit\Framework\TestCase {
|
||||
->setReturnType('bool')
|
||||
->getNode();
|
||||
$this->assertEquals(new Stmt\ClassMethod('test', [
|
||||
'returnType' => 'bool'
|
||||
'returnType' => new Identifier('bool'),
|
||||
], []), $node);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user