Generate PHP 7 type annotations

This commit is contained in:
Nikita Popov 2017-04-28 21:40:59 +02:00
parent e5fbdd6bda
commit a32e3797d4
145 changed files with 326 additions and 326 deletions

View File

@ -15,7 +15,7 @@ class Autoloader
*
* @param bool $prepend Whether to prepend the autoloader instead of appending
*/
static public function register($prepend = false) {
static public function register(bool $prepend = false) {
if (self::$registered === true) {
return;
}
@ -29,7 +29,7 @@ class Autoloader
*
* @param string $class A class name.
*/
static public function autoload($class) {
static public function autoload(string $class) {
if (0 === strpos($class, 'PhpParser\\')) {
$fileName = __DIR__ . strtr(substr($class, 9), '\\', '/') . '.php';
if (file_exists($fileName)) {

View File

@ -9,5 +9,5 @@ interface Builder
*
* @return Node The built node
*/
public function getNode();
public function getNode() : Node;
}

View File

@ -25,7 +25,7 @@ class Class_ extends Declaration
*
* @param string $name Name of the class
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -111,7 +111,7 @@ class Class_ extends Declaration
*
* @return Stmt\Class_ The built class node
*/
public function getNode() {
public function getNode() : PhpParser\Node {
return new Stmt\Class_($this->name, array(
'flags' => $this->flags,
'extends' => $this->extends,

View File

@ -17,7 +17,7 @@ class Function_ extends FunctionLike
*
* @param string $name Name of the function
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -39,7 +39,7 @@ class Function_ extends FunctionLike
*
* @return Stmt\Function_ The built function node
*/
public function getNode() {
public function getNode() : Node {
return new Stmt\Function_($this->name, array(
'byRef' => $this->returnByRef,
'params' => $this->params,

View File

@ -19,7 +19,7 @@ class Interface_ extends Declaration
*
* @param string $name Name of the interface
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -72,7 +72,7 @@ class Interface_ extends Declaration
*
* @return Stmt\Interface_ The built interface node
*/
public function getNode() {
public function getNode() : PhpParser\Node {
return new Stmt\Interface_($this->name, array(
'extends' => $this->extends,
'stmts' => array_merge($this->constants, $this->methods),

View File

@ -20,7 +20,7 @@ class Method extends FunctionLike
*
* @param string $name Name of the method
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -117,7 +117,7 @@ class Method extends FunctionLike
*
* @return Stmt\ClassMethod The built method node
*/
public function getNode() {
public function getNode() : Node {
return new Stmt\ClassMethod($this->name, array(
'flags' => $this->flags,
'byRef' => $this->returnByRef,

View File

@ -54,7 +54,7 @@ class Namespace_ implements PhpParser\Builder
*
* @return Node The built node
*/
public function getNode() {
public function getNode() : Node {
return new Stmt\Namespace_($this->name, $this->stmts);
}
}

View File

@ -24,7 +24,7 @@ class Param implements PhpParser\Builder
*
* @param string $name Name of the parameter
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -84,7 +84,7 @@ class Param implements PhpParser\Builder
*
* @return Node\Param The built parameter node
*/
public function getNode() {
public function getNode() : Node {
return new Node\Param(
new Node\Expr\Variable($this->name),
$this->default, $this->type, $this->byRef, $this->variadic

View File

@ -19,7 +19,7 @@ class Property implements PhpParser\Builder
*
* @param string $name Name of the property
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -100,7 +100,7 @@ class Property implements PhpParser\Builder
*
* @return Stmt\Property The built property node
*/
public function getNode() {
public function getNode() : PhpParser\Node {
return new Stmt\Property(
$this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC,
array(

View File

@ -17,7 +17,7 @@ class Trait_ extends Declaration
*
* @param string $name Name of the interface
*/
public function __construct($name) {
public function __construct(string $name) {
$this->name = $name;
}
@ -47,7 +47,7 @@ class Trait_ extends Declaration
*
* @return Stmt\Trait_ The built interface node
*/
public function getNode() {
public function getNode() : PhpParser\Node {
return new Stmt\Trait_(
$this->name, array(
'stmts' => array_merge($this->properties, $this->methods)

View File

@ -21,7 +21,7 @@ class Use_ implements Builder {
* @param Node\Name|string $name Name of the entity (namespace, class, function, constant) to alias
* @param int $type One of the Stmt\Use_::TYPE_* constants
*/
public function __construct($name, $type) {
public function __construct($name, int $type) {
$this->name = BuilderHelpers::normalizeName($name);
$this->type = $type;
}
@ -33,7 +33,7 @@ class Use_ implements Builder {
*
* @return $this The builder instance (for fluid interface)
*/
protected function as_($alias) {
protected function as_(string $alias) {
$this->alias = $alias;
return $this;
}
@ -50,7 +50,7 @@ class Use_ implements Builder {
*
* @return Node The built node
*/
public function getNode() {
public function getNode() : Node {
return new Stmt\Use_(array(
new Stmt\UseUse($this->name, $this->alias)
), $this->type);

View File

@ -29,7 +29,7 @@ class BuilderFactory
*
* @return Builder\Namespace_ The created namespace builder
*/
protected function _namespace($name) {
protected function _namespace($name) : Builder\Namespace_ {
return new Builder\Namespace_($name);
}
@ -40,7 +40,7 @@ class BuilderFactory
*
* @return Builder\Class_ The created class builder
*/
protected function _class($name) {
protected function _class(string $name) : Builder\Class_ {
return new Builder\Class_($name);
}
@ -51,7 +51,7 @@ class BuilderFactory
*
* @return Builder\Interface_ The created interface builder
*/
protected function _interface($name) {
protected function _interface(string $name) : Builder\Interface_ {
return new Builder\Interface_($name);
}
@ -62,7 +62,7 @@ class BuilderFactory
*
* @return Builder\Trait_ The created trait builder
*/
protected function _trait($name) {
protected function _trait(string $name) : Builder\Trait_ {
return new Builder\Trait_($name);
}
@ -73,7 +73,7 @@ class BuilderFactory
*
* @return Builder\Method The created method builder
*/
public function method($name) {
public function method(string $name) : Builder\Method {
return new Builder\Method($name);
}
@ -84,7 +84,7 @@ class BuilderFactory
*
* @return Builder\Param The created parameter builder
*/
public function param($name) {
public function param(string $name) : Builder\Param {
return new Builder\Param($name);
}
@ -95,7 +95,7 @@ class BuilderFactory
*
* @return Builder\Property The created property builder
*/
public function property($name) {
public function property(string $name) : Builder\Property {
return new Builder\Property($name);
}
@ -106,7 +106,7 @@ class BuilderFactory
*
* @return Builder\Function_ The created function builder
*/
protected function _function($name) {
protected function _function(string $name) : Builder\Function_ {
return new Builder\Function_($name);
}
@ -117,7 +117,7 @@ class BuilderFactory
*
* @return Builder\Use_ The create use builder
*/
protected function _use($name) {
protected function _use($name) : Builder\Use_ {
return new Builder\Use_($name, Use_::TYPE_NORMAL);
}
@ -128,7 +128,7 @@ class BuilderFactory
*
* @return Expr
*/
public function val($value) {
public function val($value) : Expr {
return BuilderHelpers::normalizeValue($value);
}
@ -141,7 +141,7 @@ class BuilderFactory
*
* @return Arg[]
*/
public function args(array $args) {
public function args(array $args) : array {
$normalizedArgs = [];
foreach ($args as $arg) {
if ($arg instanceof Arg) {
@ -160,7 +160,7 @@ class BuilderFactory
*
* @return Concat
*/
public function concat(...$exprs) {
public function concat(...$exprs) : Concat {
$numExprs = count($exprs);
if ($numExprs < 2) {
throw new \LogicException('Expected at least two expressions');

View File

@ -23,7 +23,7 @@ final class BuilderHelpers {
*
* @return Node The normalized node
*/
public static function normalizeNode($node) {
public static function normalizeNode($node) : Node {
if ($node instanceof Builder) {
return $node->getNode();
} elseif ($node instanceof Node) {
@ -42,7 +42,7 @@ final class BuilderHelpers {
*
* @return Stmt The normalized statement node
*/
public static function normalizeStmt($node) {
public static function normalizeStmt($node) : Stmt {
$node = self::normalizeNode($node);
if ($node instanceof Stmt) {
return $node;
@ -62,7 +62,7 @@ final class BuilderHelpers {
*
* @return Name The normalized name
*/
public static function normalizeName($name) {
public static function normalizeName($name) : Name {
if ($name instanceof Name) {
return $name;
} elseif (is_string($name)) {
@ -134,7 +134,7 @@ final class BuilderHelpers {
*
* @return Expr The normalized value
*/
public static function normalizeValue($value) {
public static function normalizeValue($value) : Expr {
if ($value instanceof Node\Expr) {
return $value;
} elseif (is_null($value)) {
@ -182,7 +182,7 @@ final class BuilderHelpers {
*
* @return Comment\Doc The normalized doc comment
*/
public static function normalizeDocComment($docComment) {
public static function normalizeDocComment($docComment) : Comment\Doc {
if ($docComment instanceof Comment\Doc) {
return $docComment;
} else if (is_string($docComment)) {
@ -200,7 +200,7 @@ final class BuilderHelpers {
*
* @return int New modifiers
*/
public static function addModifier($modifiers, $modifier) {
public static function addModifier(int $modifiers, int $modifier) : int {
Stmt\Class_::verifyModifier($modifiers, $modifier);
return $modifiers | $modifier;
}

View File

@ -15,7 +15,7 @@ class Comment implements \JsonSerializable
* @param int $startLine Line number the comment started on
* @param int $startFilePos File offset the comment started on
*/
public function __construct($text, $startLine = -1, $startFilePos = -1) {
public function __construct(string $text, int $startLine = -1, int $startFilePos = -1) {
$this->text = $text;
$this->line = $startLine;
$this->filePos = $startFilePos;
@ -26,7 +26,7 @@ class Comment implements \JsonSerializable
*
* @return string The comment text (including comment delimiters like /*)
*/
public function getText() {
public function getText() : string {
return $this->text;
}
@ -35,7 +35,7 @@ class Comment implements \JsonSerializable
*
* @return int Line number
*/
public function getLine() {
public function getLine() : int {
return $this->line;
}
@ -44,7 +44,7 @@ class Comment implements \JsonSerializable
*
* @return int File offset
*/
public function getFilePos() {
public function getFilePos() : int {
return $this->filePos;
}
@ -53,7 +53,7 @@ class Comment implements \JsonSerializable
*
* @return string The comment text (including comment delimiters like /*)
*/
public function __toString() {
public function __toString() : string {
return $this->text;
}
@ -122,7 +122,7 @@ class Comment implements \JsonSerializable
* @param string $str String to check
* @return int Length in characters. Tabs count as single characters.
*/
private function getShortestWhitespacePrefixLen($str) {
private function getShortestWhitespacePrefixLen(string $str) : int {
$lines = explode("\n", $str);
$shortestPrefixLen = INF;
foreach ($lines as $line) {
@ -139,7 +139,7 @@ class Comment implements \JsonSerializable
* @return array
* @psalm-return array{nodeType:string, text:mixed, line:mixed, filePos:mixed}
*/
public function jsonSerialize() {
public function jsonSerialize() : array {
// Technically not a node, but we make it look like one anyway
$type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment';
return [

View File

@ -14,7 +14,7 @@ class Error extends \RuntimeException
* @param array|int $attributes Attributes of node/token where error occurred
* (or start line of error -- deprecated)
*/
public function __construct($message, $attributes = array()) {
public function __construct(string $message, $attributes = array()) {
$this->rawMessage = (string) $message;
if (is_array($attributes)) {
$this->attributes = $attributes;
@ -29,7 +29,7 @@ class Error extends \RuntimeException
*
* @return string Error message
*/
public function getRawMessage() {
public function getRawMessage() : string {
return $this->rawMessage;
}
@ -38,7 +38,7 @@ class Error extends \RuntimeException
*
* @return int Error start line
*/
public function getStartLine() {
public function getStartLine() : int {
return $this->attributes['startLine'] ?? -1;
}
@ -47,7 +47,7 @@ class Error extends \RuntimeException
*
* @return int Error end line
*/
public function getEndLine() {
public function getEndLine() : int {
return $this->attributes['endLine'] ?? -1;
}
@ -57,7 +57,7 @@ class Error extends \RuntimeException
*
* @return array
*/
public function getAttributes() {
public function getAttributes() : array {
return $this->attributes;
}
@ -76,7 +76,7 @@ class Error extends \RuntimeException
*
* @param string $message Error message
*/
public function setRawMessage($message) {
public function setRawMessage(string $message) {
$this->rawMessage = (string) $message;
$this->updateMessage();
}
@ -86,7 +86,7 @@ class Error extends \RuntimeException
*
* @param int $line Error start line
*/
public function setStartLine($line) {
public function setStartLine(int $line) {
$this->attributes['startLine'] = (int) $line;
$this->updateMessage();
}
@ -98,7 +98,7 @@ class Error extends \RuntimeException
*
* @return bool
*/
public function hasColumnInfo() {
public function hasColumnInfo() : bool {
return isset($this->attributes['startFilePos']) && isset($this->attributes['endFilePos']);
}
@ -108,7 +108,7 @@ class Error extends \RuntimeException
* @param string $code Source code of the file
* @return int
*/
public function getStartColumn($code) {
public function getStartColumn(string $code) : int {
if (!$this->hasColumnInfo()) {
throw new \RuntimeException('Error does not have column information');
}
@ -122,7 +122,7 @@ class Error extends \RuntimeException
* @param string $code Source code of the file
* @return int
*/
public function getEndColumn($code) {
public function getEndColumn(string $code) : int {
if (!$this->hasColumnInfo()) {
throw new \RuntimeException('Error does not have column information');
}
@ -137,7 +137,7 @@ class Error extends \RuntimeException
*
* @return string Formatted message
*/
public function getMessageWithColumnInfo($code) {
public function getMessageWithColumnInfo(string $code) : string {
return sprintf(
'%s from %d:%d to %d:%d', $this->getRawMessage(),
$this->getStartLine(), $this->getStartColumn($code),
@ -153,7 +153,7 @@ class Error extends \RuntimeException
*
* @return int 1-based column (relative to start of line)
*/
private function toColumn($code, $pos) {
private function toColumn(string $code, int $pos) : int {
if ($pos > strlen($code)) {
throw new \RuntimeException('Invalid position information');
}

View File

@ -24,7 +24,7 @@ class Collecting implements ErrorHandler
*
* @return Error[]
*/
public function getErrors() {
public function getErrors() : array {
return $this->errors;
}
@ -33,7 +33,7 @@ class Collecting implements ErrorHandler
*
* @return bool
*/
public function hasErrors() {
public function hasErrors() : bool {
return !empty($this->errors);
}

View File

@ -55,7 +55,7 @@ class Lexer
* @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to
* ErrorHandler\Throwing
*/
public function startLexing($code, ErrorHandler $errorHandler = null) {
public function startLexing(string $code, ErrorHandler $errorHandler = null) {
if (null === $errorHandler) {
$errorHandler = new ErrorHandler\Throwing();
}
@ -122,7 +122,7 @@ class Lexer
*
* @return bool
*/
private function isUnterminatedComment($token) {
private function isUnterminatedComment($token) : bool {
return ($token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT)
&& substr($token[1], 0, 2) === '/*'
&& substr($token[1], -2) !== '*/';
@ -133,7 +133,7 @@ class Lexer
*
* @return bool
*/
private function errorMayHaveOccurred() {
private function errorMayHaveOccurred() : bool {
if (defined('HHVM_VERSION')) {
// In HHVM token_get_all() does not throw warnings, so we need to conservatively
// assume that an error occurred
@ -229,7 +229,7 @@ class Lexer
*
* @return int Token id
*/
public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) {
public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) : int {
$startAttributes = array();
$endAttributes = array();
@ -313,7 +313,7 @@ class Lexer
*
* @return array Array of tokens in token_get_all() format
*/
public function getTokens() {
public function getTokens() : array {
return $this->tokens;
}
@ -322,7 +322,7 @@ class Lexer
*
* @return string Remaining text
*/
public function handleHaltCompiler() {
public function handleHaltCompiler() : string {
// text after T_HALT_COMPILER, still including ();
$textAfter = substr($this->code, $this->filePos);
@ -349,7 +349,7 @@ class Lexer
*
* @return array The token map
*/
protected function createTokenMap() {
protected function createTokenMap() : array {
$tokenMap = array();
// 256 is the minimum possible token number, as everything below

View File

@ -53,7 +53,7 @@ class NameContext {
* @param int $type One of Stmt\Use_::TYPE_*
* @param array $errorAttrs Attributes to use to report an error
*/
public function addAlias(Name $name, $aliasName, $type, array $errorAttrs = []) {
public function addAlias(Name $name, string $aliasName, int $type, array $errorAttrs = []) {
// Constant names are case sensitive, everything else case insensitive
if ($type === Stmt\Use_::TYPE_CONSTANT) {
$aliasLookupName = $aliasName;
@ -99,7 +99,7 @@ class NameContext {
*
* @return null|Name Resolved name, or null if static resolution is not possible
*/
public function getResolvedName(Name $name, $type) {
public function getResolvedName(Name $name, int $type) {
// don't resolve special class names
if ($type === Stmt\Use_::TYPE_NORMAL
&& in_array(strtolower($name->toString()), array('self', 'parent', 'static'))) {
@ -143,7 +143,7 @@ class NameContext {
*
* @return Name Resolved name
*/
public function getResolvedClassName(Name $name) {
public function getResolvedClassName(Name $name) : Name {
return $this->getResolvedName($name, Stmt\Use_::TYPE_NORMAL);
}
@ -155,7 +155,7 @@ class NameContext {
*
* @return Name[] Possible representations of the name
*/
public function getPossibleNames(FullyQualified $name, $type) {
public function getPossibleNames(FullyQualified $name, int $type) : array {
$nameStr = (string) $name;
$lcName = strtolower($name);
@ -204,7 +204,7 @@ class NameContext {
*
* @return Name Shortest representation
*/
public function getShortName(Name\FullyQualified $name, $type) {
public function getShortName(Name\FullyQualified $name, int $type) : Name {
$possibleNames = $this->getPossibleNames($name, $type);
// Find shortest name

View File

@ -9,28 +9,28 @@ interface Node
*
* @return string Type of the node
*/
public function getType();
public function getType() : string;
/**
* Gets the names of the sub nodes.
*
* @return array Names of sub nodes
*/
public function getSubNodeNames();
public function getSubNodeNames() : array;
/**
* Gets line the node started in.
*
* @return int Line
*/
public function getLine();
public function getLine() : int;
/**
* Sets line the node started in.
*
* @param int $line Line
*/
public function setLine($line);
public function setLine(int $line);
/**
* Gets the doc comment of the node.
@ -56,7 +56,7 @@ interface Node
* @param string $key
* @param mixed $value
*/
public function setAttribute($key, $value);
public function setAttribute(string $key, $value);
/**
* Returns whether an attribute exists.
@ -65,7 +65,7 @@ interface Node
*
* @return bool
*/
public function hasAttribute($key);
public function hasAttribute(string $key) : bool;
/**
* Returns the value of an attribute.
@ -75,12 +75,12 @@ interface Node
*
* @return mixed
*/
public function &getAttribute($key, $default = null);
public function &getAttribute(string $key, $default = null);
/**
* Returns all attributes for the given node.
*
* @return array
*/
public function getAttributes();
public function getAttributes() : array;
}

View File

@ -21,14 +21,14 @@ class Arg extends NodeAbstract
* @param bool $unpack Whether to unpack the argument
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value, $byRef = false, $unpack = false, array $attributes = array()) {
public function __construct(Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('value', 'byRef', 'unpack');
}
}

View File

@ -27,7 +27,7 @@ class Const_ extends NodeAbstract
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('name', 'value');
}
}

View File

@ -24,7 +24,7 @@ class ArrayDimFetch extends Expr
$this->dim = $dim;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'dim');
}
}

View File

@ -21,14 +21,14 @@ class ArrayItem extends Expr
* @param bool $byRef Whether to assign by reference
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array()) {
public function __construct(Expr $value, Expr $key = null, bool $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
$this->byRef = $byRef;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('key', 'value', 'byRef');
}
}

View File

@ -24,7 +24,7 @@ class Array_ extends Expr
$this->items = $items;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('items');
}
}

View File

@ -24,7 +24,7 @@ class Assign extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'expr');
}
}

View File

@ -24,7 +24,7 @@ abstract class AssignOp extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'expr');
}
}

View File

@ -24,7 +24,7 @@ class AssignRef extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'expr');
}
}

View File

@ -24,7 +24,7 @@ abstract class BinaryOp extends Expr
$this->right = $right;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('left', 'right');
}
}

View File

@ -20,7 +20,7 @@ class BitwiseNot extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -20,7 +20,7 @@ class BooleanNot extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -20,7 +20,7 @@ abstract class Cast extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -26,7 +26,7 @@ class ClassConstFetch extends Expr
$this->name = \is_string($name) ? new Identifier($name) : $name;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('class', 'name');
}
}

View File

@ -20,7 +20,7 @@ class Clone_ extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -44,15 +44,15 @@ class Closure extends Expr implements FunctionLike
$this->stmts = $subNodes['stmts'] ?? array();
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts');
}
public function returnsByRef() {
public function returnsByRef() : bool {
return $this->byRef;
}
public function getParams() {
public function getParams() : array {
return $this->params;
}
@ -60,7 +60,7 @@ class Closure extends Expr implements FunctionLike
return $this->returnType;
}
public function getStmts() {
public function getStmts() : array {
return $this->stmts;
}
}

View File

@ -18,13 +18,13 @@ class ClosureUse extends Expr
* @param bool $byRef Whether to use by reference
* @param array $attributes Additional attributes
*/
public function __construct(Expr\Variable $var, $byRef = false, array $attributes = array()) {
public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->byRef = $byRef;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'byRef');
}
}

View File

@ -21,7 +21,7 @@ class ConstFetch extends Expr
$this->name = $name;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('name');
}
}

View File

@ -20,7 +20,7 @@ class Empty_ extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -21,7 +21,7 @@ class Error extends Expr
parent::__construct($attributes);
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array();
}
}

View File

@ -20,7 +20,7 @@ class ErrorSuppress extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -20,7 +20,7 @@ class Eval_ extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -24,7 +24,7 @@ class Exit_ extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -25,7 +25,7 @@ class FuncCall extends Expr
$this->args = $args;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('name', 'args');
}
}

View File

@ -23,13 +23,13 @@ class Include_ extends Expr
* @param int $type Type of include
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, $type, array $attributes = array()) {
public function __construct(Expr $expr, int $type, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->type = $type;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr', 'type');
}
}

View File

@ -25,7 +25,7 @@ class Instanceof_ extends Expr
$this->class = $class;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr', 'class');
}
}

View File

@ -20,7 +20,7 @@ class Isset_ extends Expr
$this->vars = $vars;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('vars');
}
}

View File

@ -20,7 +20,7 @@ class List_ extends Expr
$this->items = $items;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('items');
}
}

View File

@ -30,7 +30,7 @@ class MethodCall extends Expr
$this->args = $args;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'name', 'args');
}
}

View File

@ -25,7 +25,7 @@ class New_ extends Expr
$this->args = $args;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('class', 'args');
}
}

View File

@ -20,7 +20,7 @@ class PostDec extends Expr
$this->var = $var;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var');
}
}

View File

@ -20,7 +20,7 @@ class PostInc extends Expr
$this->var = $var;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var');
}
}

View File

@ -20,7 +20,7 @@ class PreDec extends Expr
$this->var = $var;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var');
}
}

View File

@ -20,7 +20,7 @@ class PreInc extends Expr
$this->var = $var;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var');
}
}

View File

@ -20,7 +20,7 @@ class Print_ extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -25,7 +25,7 @@ class PropertyFetch extends Expr
$this->name = \is_string($name) ? new Identifier($name) : $name;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('var', 'name');
}
}

View File

@ -20,7 +20,7 @@ class ShellExec extends Expr
$this->parts = $parts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('parts');
}
}

View File

@ -30,7 +30,7 @@ class StaticCall extends Expr
$this->args = $args;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('class', 'name', 'args');
}
}

View File

@ -26,7 +26,7 @@ class StaticPropertyFetch extends Expr
$this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('class', 'name');
}
}

View File

@ -28,7 +28,7 @@ class Ternary extends Expr
$this->else = $else;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('cond', 'if', 'else');
}
}

View File

@ -20,7 +20,7 @@ class UnaryMinus extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -20,7 +20,7 @@ class UnaryPlus extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -20,7 +20,7 @@ class Variable extends Expr
$this->name = $name;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('name');
}
}

View File

@ -20,7 +20,7 @@ class YieldFrom extends Expr
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

View File

@ -24,7 +24,7 @@ class Yield_ extends Expr
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('key', 'value');
}
}

View File

@ -11,14 +11,14 @@ interface FunctionLike extends Node
*
* @return bool
*/
public function returnsByRef();
public function returnsByRef() : bool;
/**
* List of parameters
*
* @return Node\Param[]
*/
public function getParams();
public function getParams() : array;
/**
* Get the declared return type or null
@ -32,5 +32,5 @@ interface FunctionLike extends Node
*
* @return Node\Stmt[]
*/
public function getStmts();
public function getStmts() : array;
}

View File

@ -18,12 +18,12 @@ class Identifier extends NodeAbstract
* @param string $name Identifier as string
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = array()) {
public function __construct(string $name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('name');
}
@ -32,7 +32,7 @@ class Identifier extends NodeAbstract
*
* @return string Identifier as string.
*/
public function __toString() {
public function __toString() : string {
return $this->name;
}
}

View File

@ -23,7 +23,7 @@ class Name extends NodeAbstract
$this->parts = self::prepareName($name);
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('parts');
}
@ -32,7 +32,7 @@ class Name extends NodeAbstract
*
* @return string First part of the name
*/
public function getFirst() {
public function getFirst() : string {
return $this->parts[0];
}
@ -41,7 +41,7 @@ class Name extends NodeAbstract
*
* @return string Last part of the name
*/
public function getLast() {
public function getLast() : string {
return $this->parts[count($this->parts) - 1];
}
@ -50,7 +50,7 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() {
public function isUnqualified() : bool {
return 1 == count($this->parts);
}
@ -59,7 +59,7 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is qualified
*/
public function isQualified() {
public function isQualified() : bool {
return 1 < count($this->parts);
}
@ -68,7 +68,7 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() {
public function isFullyQualified() : bool {
return false;
}
@ -77,7 +77,7 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is relative
*/
public function isRelative() {
public function isRelative() : bool {
return false;
}
@ -87,7 +87,7 @@ class Name extends NodeAbstract
*
* @return string String representation
*/
public function toString() {
public function toString() : string {
return implode('\\', $this->parts);
}
@ -97,7 +97,7 @@ class Name extends NodeAbstract
*
* @return string String representation
*/
public function toCodeString() {
public function toCodeString() : string {
return $this->toString();
}
@ -107,7 +107,7 @@ class Name extends NodeAbstract
*
* @return string String representation
*/
public function __toString() {
public function __toString() : string {
return implode('\\', $this->parts);
}
@ -127,7 +127,7 @@ class Name extends NodeAbstract
*
* @return static|null Sliced name
*/
public function slice($offset, $length = null) {
public function slice(int $offset, int $length = null) {
$numParts = count($this->parts);
$realOffset = $offset < 0 ? $offset + $numParts : $offset;
@ -191,7 +191,7 @@ class Name extends NodeAbstract
*
* @return string[] Prepared name
*/
private static function prepareName($name) {
private static function prepareName($name) : array {
if (\is_string($name)) {
return explode('\\', $name);
} elseif (\is_array($name)) {

View File

@ -9,7 +9,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() {
public function isUnqualified() : bool {
return false;
}
@ -18,7 +18,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is qualified
*/
public function isQualified() {
public function isQualified() : bool {
return false;
}
@ -27,7 +27,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() {
public function isFullyQualified() : bool {
return true;
}
@ -36,11 +36,11 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is relative
*/
public function isRelative() {
public function isRelative() : bool {
return false;
}
public function toCodeString() {
public function toCodeString() : string {
return '\\' . $this->toString();
}
}

View File

@ -9,7 +9,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() {
public function isUnqualified() : bool {
return false;
}
@ -18,7 +18,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is qualified
*/
public function isQualified() {
public function isQualified() : bool {
return false;
}
@ -27,7 +27,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() {
public function isFullyQualified() : bool {
return false;
}
@ -36,11 +36,11 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is relative
*/
public function isRelative() {
public function isRelative() : bool {
return true;
}
public function toCodeString() {
public function toCodeString() : string {
return 'namespace\\' . $this->toString();
}
}

View File

@ -20,7 +20,7 @@ class NullableType extends NodeAbstract
$this->type = \is_string($type) ? new Identifier($type) : $type;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('type');
}
}

View File

@ -29,7 +29,7 @@ class Param extends NodeAbstract
*/
public function __construct(
Expr\Variable $var, Expr $default = null, $type = null,
$byRef = false, $variadic = false, array $attributes = array()
bool $byRef = false, bool $variadic = false, array $attributes = array()
) {
parent::__construct($attributes);
$this->type = \is_string($type) ? new Identifier($type) : $type;
@ -39,7 +39,7 @@ class Param extends NodeAbstract
$this->default = $default;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('type', 'byRef', 'variadic', 'var', 'default');
}
}

View File

@ -15,12 +15,12 @@ class DNumber extends Scalar
* @param float $value Value of the number
* @param array $attributes Additional attributes
*/
public function __construct($value, array $attributes = array()) {
public function __construct(float $value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('value');
}
@ -33,7 +33,7 @@ class DNumber extends Scalar
*
* @return float The parsed number
*/
public static function parse($str) {
public static function parse(string $str) : float {
// if string contains any of .eE just cast it to float
if (false !== strpbrk($str, '.eE')) {
return (float) $str;

View File

@ -21,7 +21,7 @@ class Encapsed extends Scalar
$this->parts = $parts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('parts');
}
}

View File

@ -15,12 +15,12 @@ class EncapsedStringPart extends Scalar
* @param string $value String value
* @param array $attributes Additional attributes
*/
public function __construct($value, array $attributes = array()) {
public function __construct(string $value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('value');
}
}

View File

@ -22,12 +22,12 @@ class LNumber extends Scalar
* @param int $value Value of the number
* @param array $attributes Additional attributes
*/
public function __construct($value, array $attributes = array()) {
public function __construct(int $value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('value');
}
@ -40,7 +40,7 @@ class LNumber extends Scalar
*
* @return LNumber The constructed LNumber, including kind attribute
*/
public static function fromString($str, array $attributes = array(), $allowInvalidOctal = false) {
public static function fromString(string $str, array $attributes = array(), bool $allowInvalidOctal = false) : LNumber {
if ('0' !== $str[0] || '0' === $str) {
$attributes['kind'] = LNumber::KIND_DEC;
return new LNumber((int) $str, $attributes);

View File

@ -15,7 +15,7 @@ abstract class MagicConst extends Scalar
parent::__construct($attributes);
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array();
}
@ -24,5 +24,5 @@ abstract class MagicConst extends Scalar
*
* @return string Name of magic constant
*/
abstract public function getName();
abstract public function getName() : string;
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Class_ extends MagicConst
{
public function getName() {
public function getName() : string {
return '__CLASS__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Dir extends MagicConst
{
public function getName() {
public function getName() : string {
return '__DIR__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class File extends MagicConst
{
public function getName() {
public function getName() : string {
return '__FILE__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Function_ extends MagicConst
{
public function getName() {
public function getName() : string {
return '__FUNCTION__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Line extends MagicConst
{
public function getName() {
public function getName() : string {
return '__LINE__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Method extends MagicConst
{
public function getName() {
public function getName() : string {
return '__METHOD__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Namespace_ extends MagicConst
{
public function getName() {
public function getName() : string {
return '__NAMESPACE__';
}
}

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Scalar\MagicConst;
class Trait_ extends MagicConst
{
public function getName() {
public function getName() : string {
return '__TRAIT__';
}
}

View File

@ -33,12 +33,12 @@ class String_ extends Scalar
* @param string $value Value of the string
* @param array $attributes Additional attributes
*/
public function __construct($value, array $attributes = array()) {
public function __construct(string $value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('value');
}
@ -52,7 +52,7 @@ class String_ extends Scalar
*
* @return string The parsed string
*/
public static function parse($str, $parseUnicodeEscape = true) {
public static function parse(string $str, bool $parseUnicodeEscape = true) : string {
$bLength = 0;
if ('b' === $str[0] || 'B' === $str[0]) {
$bLength = 1;
@ -82,7 +82,7 @@ class String_ extends Scalar
*
* @return string String with escape sequences parsed
*/
public static function parseEscapeSequences($str, $quote, $parseUnicodeEscape = true) {
public static function parseEscapeSequences(string $str, $quote, bool $parseUnicodeEscape = true) : string {
if (null !== $quote) {
$str = str_replace('\\' . $quote, $quote, $str);
}
@ -118,7 +118,7 @@ class String_ extends Scalar
*
* @return string UTF-8 representation of code point
*/
private static function codePointToUtf8($num) {
private static function codePointToUtf8(int $num) : string {
if ($num <= 0x7F) {
return chr($num);
}
@ -146,7 +146,7 @@ class String_ extends Scalar
*
* @return string Parsed string
*/
public static function parseDocString($startToken, $str, $parseUnicodeEscape = true) {
public static function parseDocString(string $startToken, string $str, bool $parseUnicodeEscape = true) : string {
// strip last newline (thanks tokenizer for sticking it into the string!)
$str = preg_replace('~(\r\n|\n|\r)\z~', '', $str);

View File

@ -20,7 +20,7 @@ class Break_ extends Node\Stmt
$this->num = $num;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('num');
}
}

View File

@ -24,7 +24,7 @@ class Case_ extends Node\Stmt
$this->stmts = $stmts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('cond', 'stmts');
}
}

View File

@ -31,7 +31,7 @@ class Catch_ extends Node\Stmt
$this->stmts = $stmts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('types', 'var', 'stmts');
}
}

View File

@ -18,13 +18,13 @@ class ClassConst extends Node\Stmt
* @param int $flags Modifiers
* @param array $attributes Additional attributes
*/
public function __construct(array $consts, $flags = 0, array $attributes = array()) {
public function __construct(array $consts, int $flags = 0, array $attributes = array()) {
parent::__construct($attributes);
$this->flags = $flags;
$this->consts = $consts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('flags', 'consts');
}
@ -33,7 +33,7 @@ class ClassConst extends Node\Stmt
*
* @return bool
*/
public function isPublic() {
public function isPublic() : bool {
return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
}
@ -43,7 +43,7 @@ class ClassConst extends Node\Stmt
*
* @return bool
*/
public function isProtected() {
public function isProtected() : bool {
return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
}
@ -52,7 +52,7 @@ class ClassConst extends Node\Stmt
*
* @return bool
*/
public function isPrivate() {
public function isPrivate() : bool {
return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
}
}

View File

@ -18,7 +18,7 @@ abstract class ClassLike extends Node\Stmt {
*
* @return ClassMethod[]
*/
public function getMethods() {
public function getMethods() : array {
$methods = array();
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod) {
@ -35,7 +35,7 @@ abstract class ClassLike extends Node\Stmt {
*
* @return ClassMethod|null Method node or null if the method does not exist
*/
public function getMethod($name) {
public function getMethod(string $name) {
$lowerName = strtolower($name);
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod && $lowerName === strtolower($stmt->name)) {

View File

@ -61,15 +61,15 @@ class ClassMethod extends Node\Stmt implements FunctionLike
$this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : array();
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('flags', 'byRef', 'name', 'params', 'returnType', 'stmts');
}
public function returnsByRef() {
public function returnsByRef() : bool {
return $this->byRef;
}
public function getParams() {
public function getParams() : array {
return $this->params;
}
@ -77,7 +77,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
return $this->returnType;
}
public function getStmts() {
public function getStmts() : array {
return $this->stmts;
}
@ -86,7 +86,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
*
* @return bool
*/
public function isPublic() {
public function isPublic() : bool {
return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
}
@ -96,7 +96,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
*
* @return bool
*/
public function isProtected() {
public function isProtected() : bool {
return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
}
@ -105,7 +105,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
*
* @return bool
*/
public function isPrivate() {
public function isPrivate() : bool {
return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
}
@ -114,7 +114,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
*
* @return bool
*/
public function isAbstract() {
public function isAbstract() : bool {
return (bool) ($this->flags & Class_::MODIFIER_ABSTRACT);
}
@ -123,7 +123,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
* #
* @return bool
*/
public function isFinal() {
public function isFinal() : bool {
return (bool) ($this->flags & Class_::MODIFIER_FINAL);
}
@ -132,7 +132,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
*
* @return bool
*/
public function isStatic() {
public function isStatic() : bool {
return (bool) ($this->flags & Class_::MODIFIER_STATIC);
}
@ -141,7 +141,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
*
* @return bool
*/
public function isMagic() {
public function isMagic() : bool {
return isset(self::$magicNames[strtolower($this->name)]);
}
}

View File

@ -49,7 +49,7 @@ class Class_ extends ClassLike
$this->stmts = $subNodes['stmts'] ?? array();
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('flags', 'name', 'extends', 'implements', 'stmts');
}
@ -58,7 +58,7 @@ class Class_ extends ClassLike
*
* @return bool
*/
public function isAbstract() {
public function isAbstract() : bool {
return (bool) ($this->flags & self::MODIFIER_ABSTRACT);
}
@ -67,7 +67,7 @@ class Class_ extends ClassLike
*
* @return bool
*/
public function isFinal() {
public function isFinal() : bool {
return (bool) ($this->flags & self::MODIFIER_FINAL);
}
@ -76,7 +76,7 @@ class Class_ extends ClassLike
*
* @return bool
*/
public function isAnonymous() {
public function isAnonymous() : bool {
return null === $this->name;
}

View File

@ -20,7 +20,7 @@ class Const_ extends Node\Stmt
$this->consts = $consts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('consts');
}
}

View File

@ -20,7 +20,7 @@ class Continue_ extends Node\Stmt
$this->num = $num;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('num');
}
}

View File

@ -24,7 +24,7 @@ class DeclareDeclare extends Node\Stmt
$this->value = $value;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('key', 'value');
}
}

View File

@ -24,7 +24,7 @@ class Declare_ extends Node\Stmt
$this->stmts = $stmts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('declares', 'stmts');
}
}

View File

@ -24,7 +24,7 @@ class Do_ extends Node\Stmt
$this->stmts = $stmts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('stmts', 'cond');
}
}

View File

@ -20,7 +20,7 @@ class Echo_ extends Node\Stmt
$this->exprs = $exprs;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('exprs');
}
}

View File

@ -24,7 +24,7 @@ class ElseIf_ extends Node\Stmt
$this->stmts = $stmts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('cond', 'stmts');
}
}

View File

@ -20,7 +20,7 @@ class Else_ extends Node\Stmt
$this->stmts = $stmts;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('stmts');
}
}

View File

@ -23,7 +23,7 @@ class Expression extends Node\Stmt
$this->expr = $expr;
}
public function getSubNodeNames() {
public function getSubNodeNames() : array {
return array('expr');
}
}

Some files were not shown because too many files have changed in this diff Show More