phan 설치
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\DelimitedList\UseVariableNameList;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class AnonymousFunctionUseClause extends Node {
|
||||
/** @var Token */
|
||||
public $useKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var UseVariableNameList */
|
||||
public $useVariableNameList;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'useKeyword',
|
||||
'openParen',
|
||||
'useVariableNameList',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ArrayElement extends Node {
|
||||
|
||||
/** @var Expression|null */
|
||||
public $elementKey;
|
||||
|
||||
/** @var Token|null */
|
||||
public $arrowToken;
|
||||
|
||||
/** @var Token|null */
|
||||
public $byRef;
|
||||
|
||||
/** @var Token|null if this is set for PHP 7.4's array spread operator, then other preceding tokens aren't */
|
||||
public $dotDotDot;
|
||||
|
||||
/** @var Expression */
|
||||
public $elementValue;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'elementKey',
|
||||
'arrowToken',
|
||||
'byRef',
|
||||
'dotDotDot',
|
||||
'elementValue'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class CaseStatementNode extends Node {
|
||||
/** @var Token */
|
||||
public $caseKeyword;
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
/** @var Token */
|
||||
public $defaultLabelTerminator;
|
||||
/** @var StatementNode[] */
|
||||
public $statementList;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'caseKeyword',
|
||||
'expression',
|
||||
'defaultLabelTerminator',
|
||||
'statementList'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class CatchClause extends Node {
|
||||
/** @var Token */
|
||||
public $catch;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var QualifiedName */
|
||||
public $qualifiedName;
|
||||
/**
|
||||
* @var QualifiedName[]|Token[] Remaining tokens and qualified names in the catch clause
|
||||
* (e.g. `catch (FirstException|SecondException $x)` would contain
|
||||
* the representation of `|SecondException`)
|
||||
*
|
||||
* TODO: In the next backwards incompatible release, replace qualifiedName with qualifiedNameList?
|
||||
*/
|
||||
public $otherQualifiedNameList;
|
||||
/** @var Token */
|
||||
public $variableName;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var StatementNode */
|
||||
public $compoundStatement;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'catch',
|
||||
'openParen',
|
||||
'qualifiedName',
|
||||
'otherQualifiedNameList',
|
||||
'variableName',
|
||||
'closeParen',
|
||||
'compoundStatement'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ClassBaseClause extends Node {
|
||||
/** @var Token */
|
||||
public $extendsKeyword;
|
||||
|
||||
/** @var QualifiedName */
|
||||
public $baseClass;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'extendsKeyword',
|
||||
'baseClass'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ClassConstDeclaration extends Node {
|
||||
|
||||
/** @var Token[] */
|
||||
public $modifiers;
|
||||
|
||||
/** @var Token */
|
||||
public $constKeyword;
|
||||
|
||||
/** @var DelimitedList\ConstElementList */
|
||||
public $constElements;
|
||||
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'modifiers',
|
||||
'constKeyword',
|
||||
'constElements',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ClassInterfaceClause extends Node {
|
||||
/** @var Token */
|
||||
public $implementsKeyword;
|
||||
|
||||
/** @var DelimitedList\QualifiedNameList|null */
|
||||
public $interfaceNameList;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'implementsKeyword',
|
||||
'interfaceNameList'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ClassMembersNode extends Node {
|
||||
/** @var Token */
|
||||
public $openBrace;
|
||||
|
||||
/** @var Node[] */
|
||||
public $classMemberDeclarations;
|
||||
|
||||
/** @var Token */
|
||||
public $closeBrace;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'openBrace',
|
||||
'classMemberDeclarations',
|
||||
'closeBrace'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\NamespacedNameInterface;
|
||||
use Microsoft\PhpParser\NamespacedNameTrait;
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ConstElement extends Node implements NamespacedNameInterface {
|
||||
use NamespacedNameTrait;
|
||||
|
||||
/** @var Token */
|
||||
public $name;
|
||||
|
||||
/** @var Token */
|
||||
public $equalsToken;
|
||||
|
||||
/** @var Expression */
|
||||
public $assignment;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'name',
|
||||
'equalsToken',
|
||||
'assignment'
|
||||
];
|
||||
|
||||
public function getNameParts() : array {
|
||||
return [$this->name];
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name->getText($this->getFileContents());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class DeclareDirective extends Node {
|
||||
/** @var Token */
|
||||
public $name;
|
||||
/** @var Token */
|
||||
public $equals;
|
||||
/** @var Token */
|
||||
public $literal;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'name',
|
||||
'equals',
|
||||
'literal'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class DefaultStatementNode extends Node {
|
||||
/** @var Token */
|
||||
public $defaultKeyword;
|
||||
/** @var Token */
|
||||
public $defaultLabelTerminator;
|
||||
/** @var StatementNode[] */
|
||||
public $statementList;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'defaultKeyword',
|
||||
'defaultLabelTerminator',
|
||||
'statementList'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
use Microsoft\PhpParser\TokenKind;
|
||||
|
||||
abstract class DelimitedList extends Node {
|
||||
/** @var Token[]|Node[] */
|
||||
public $children;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'children'
|
||||
];
|
||||
|
||||
const DELIMITERS = [TokenKind::CommaToken, TokenKind::BarToken, TokenKind::SemicolonToken];
|
||||
|
||||
public function getElements() : \Generator {
|
||||
foreach ($this->children as $child) {
|
||||
if ($child instanceof Node) {
|
||||
yield $child;
|
||||
} elseif ($child instanceof Token && !\in_array($child->kind, self::DELIMITERS)) {
|
||||
yield $child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getValues() {
|
||||
foreach ($this->children as $idx=>$value) {
|
||||
if ($idx % 2 == 0) {
|
||||
yield $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addElement($node) {
|
||||
if ($node === null) {
|
||||
return;
|
||||
}
|
||||
if ($this->children === null) {
|
||||
$this->children = [$node];
|
||||
return;
|
||||
}
|
||||
$this->children[] = $node;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class ArgumentExpressionList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class ArrayElementList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class ConstElementList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class ExpressionList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class ListExpressionList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class NamespaceUseClauseList extends DelimitedList {
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class NamespaceUseGroupClauseList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class ParameterDeclarationList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class QualifiedNameList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class QualifiedNameParts extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class StaticVariableNameList extends DelimitedList {
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class TraitSelectOrAliasClauseList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class UseVariableNameList extends DelimitedList {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
|
||||
class VariableNameList extends DelimitedList {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ElseClauseNode extends Node {
|
||||
/** @var Token */
|
||||
public $elseKeyword;
|
||||
/** @var Token */
|
||||
public $colon;
|
||||
/** @var StatementNode|StatementNode[] */
|
||||
public $statements;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'elseKeyword',
|
||||
'colon',
|
||||
'statements'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ElseIfClauseNode extends Node {
|
||||
/** @var Token */
|
||||
public $elseIfKeyword;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var Token|null */
|
||||
public $colon;
|
||||
/** @var StatementNode|StatementNode[] */
|
||||
public $statements;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'elseIfKeyword',
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen',
|
||||
'colon',
|
||||
'statements'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
|
||||
abstract class Expression extends Node {
|
||||
}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\FunctionLike;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\FunctionBody;
|
||||
use Microsoft\PhpParser\Node\FunctionHeader;
|
||||
use Microsoft\PhpParser\Node\FunctionReturnType;
|
||||
use Microsoft\PhpParser\Node\FunctionUseClause;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class AnonymousFunctionCreationExpression extends Expression implements FunctionLike {
|
||||
/** @var Token|null */
|
||||
public $staticModifier;
|
||||
|
||||
use FunctionHeader, FunctionUseClause, FunctionReturnType, FunctionBody;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'staticModifier',
|
||||
|
||||
// FunctionHeader
|
||||
'functionKeyword',
|
||||
'byRefToken',
|
||||
'name',
|
||||
'openParen',
|
||||
'parameters',
|
||||
'closeParen',
|
||||
|
||||
// FunctionUseClause
|
||||
'anonymousFunctionUseClause',
|
||||
|
||||
// FunctionReturnType
|
||||
'colonToken',
|
||||
'questionToken',
|
||||
'returnType',
|
||||
'otherReturnTypes',
|
||||
|
||||
// FunctionBody
|
||||
'compoundStatementOrSemicolon'
|
||||
];
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ArgumentExpression extends Expression {
|
||||
/** @var Token|null */
|
||||
public $byRefToken; // TODO removed in newer versions of PHP. Also only accept variable, not expression if byRef
|
||||
|
||||
/** @var Token|null */
|
||||
public $dotDotDotToken;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'byRefToken',
|
||||
'dotDotDotToken',
|
||||
'expression'
|
||||
];
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ArrayCreationExpression extends Expression {
|
||||
|
||||
/** @var Token|null */
|
||||
public $arrayKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParenOrBracket;
|
||||
|
||||
/** @var DelimitedList\ArrayElementList */
|
||||
public $arrayElements;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParenOrBracket;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'arrayKeyword',
|
||||
'openParenOrBracket',
|
||||
'arrayElements',
|
||||
'closeParenOrBracket'
|
||||
];
|
||||
}
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\FunctionLike;
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\FunctionHeader;
|
||||
use Microsoft\PhpParser\Node\FunctionReturnType;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ArrowFunctionCreationExpression extends Expression implements FunctionLike {
|
||||
/** @var Token|null */
|
||||
public $staticModifier;
|
||||
|
||||
use FunctionHeader, FunctionReturnType;
|
||||
|
||||
/** @var Token `=>` */
|
||||
public $arrowToken;
|
||||
|
||||
/** @var Node|Token */
|
||||
public $resultExpression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'staticModifier',
|
||||
|
||||
// FunctionHeader
|
||||
'functionKeyword',
|
||||
'byRefToken',
|
||||
'name',
|
||||
'openParen',
|
||||
'parameters',
|
||||
'closeParen',
|
||||
|
||||
// FunctionReturnType
|
||||
'colonToken',
|
||||
'questionToken',
|
||||
'returnType',
|
||||
'otherReturnTypes',
|
||||
|
||||
// body
|
||||
'arrowToken',
|
||||
'resultExpression',
|
||||
];
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class AssignmentExpression extends BinaryExpression {
|
||||
|
||||
/** @var Expression */
|
||||
public $leftOperand;
|
||||
|
||||
/** @var Token */
|
||||
public $operator;
|
||||
|
||||
/** @var Token */
|
||||
public $byRef;
|
||||
|
||||
/** @var Expression */
|
||||
public $rightOperand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'leftOperand',
|
||||
'operator',
|
||||
'byRef',
|
||||
'rightOperand'
|
||||
];
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class BinaryExpression extends Expression {
|
||||
|
||||
/** @var Expression */
|
||||
public $leftOperand;
|
||||
|
||||
/** @var Token */
|
||||
public $operator;
|
||||
|
||||
/** @var Expression */
|
||||
public $rightOperand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'leftOperand',
|
||||
'operator',
|
||||
'rightOperand'
|
||||
];
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class BracedExpression extends Expression {
|
||||
/** @var Token */
|
||||
public $openBrace;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
/** @var Token */
|
||||
public $closeBrace;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'openBrace',
|
||||
'expression',
|
||||
'closeBrace'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class CallExpression extends Expression {
|
||||
/** @var Expression */
|
||||
public $callableExpression;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var DelimitedList\ArgumentExpressionList|null */
|
||||
public $argumentExpressionList;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'callableExpression',
|
||||
'openParen',
|
||||
'argumentExpressionList',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class CastExpression extends UnaryExpression {
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var Token */
|
||||
public $castType;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
/** @var Variable */
|
||||
public $operand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'openParen',
|
||||
'castType',
|
||||
'closeParen',
|
||||
'operand'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class CloneExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $cloneKeyword;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'cloneKeyword',
|
||||
'expression'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\DelimitedList\ExpressionList;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
/**
|
||||
* This represents either a literal echo expression (`echo expr`)
|
||||
* or a short echo tag (`<?= expr...`)
|
||||
*
|
||||
* TODO: An echo statement cannot be used as an expression.
|
||||
* Consider refactoring this to become EchoStatement in a future backwards incompatible release.
|
||||
*/
|
||||
class EchoExpression extends Expression {
|
||||
|
||||
/**
|
||||
* @var Token|null this is null if generated from `<?=`
|
||||
*/
|
||||
public $echoKeyword;
|
||||
|
||||
/** @var ExpressionList */
|
||||
public $expressions;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'echoKeyword',
|
||||
'expressions'
|
||||
];
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class EmptyIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $emptyKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'emptyKeyword',
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ErrorControlExpression extends UnaryExpression {
|
||||
|
||||
/** @var Token */
|
||||
public $operator;
|
||||
|
||||
/** @var UnaryExpression */
|
||||
public $operand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'operator',
|
||||
'operand'
|
||||
];
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class EvalIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $evalKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'evalKeyword',
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ExitIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $exitOrDieKeyword;
|
||||
|
||||
/** @var Token|null */
|
||||
public $openParen;
|
||||
|
||||
/** @var Expression|null */
|
||||
public $expression;
|
||||
|
||||
/** @var Token|null */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'exitOrDieKeyword',
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class IssetIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $issetKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var DelimitedList\ExpressionList */
|
||||
public $expressions;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'issetKeyword',
|
||||
'openParen',
|
||||
'expressions',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ListIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $listKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var DelimitedList\ListExpressionList */
|
||||
public $listElements;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'listKeyword',
|
||||
'openParen',
|
||||
'listElements',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class MemberAccessExpression extends Expression {
|
||||
|
||||
/** @var Expression */
|
||||
public $dereferencableExpression;
|
||||
|
||||
/** @var Token */
|
||||
public $arrowToken;
|
||||
|
||||
/** @var Token */
|
||||
public $memberName;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'dereferencableExpression',
|
||||
'arrowToken',
|
||||
'memberName'
|
||||
];
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\ClassBaseClause;
|
||||
use Microsoft\PhpParser\Node\ClassInterfaceClause;
|
||||
use Microsoft\PhpParser\Node\ClassMembersNode;
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\QualifiedName;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ObjectCreationExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $newKeword;
|
||||
|
||||
/** @var QualifiedName|Variable|Token */
|
||||
public $classTypeDesignator;
|
||||
|
||||
/** @var Token|null */
|
||||
public $openParen;
|
||||
|
||||
/** @var DelimitedList\ArgumentExpressionList|null */
|
||||
public $argumentExpressionList;
|
||||
|
||||
/** @var Token|null */
|
||||
public $closeParen;
|
||||
|
||||
/** @var ClassBaseClause|null */
|
||||
public $classBaseClause;
|
||||
|
||||
/** @var ClassInterfaceClause|null */
|
||||
public $classInterfaceClause;
|
||||
|
||||
/** @var ClassMembersNode|null */
|
||||
public $classMembers;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'newKeword', // TODO
|
||||
'classTypeDesignator',
|
||||
'openParen',
|
||||
'argumentExpressionList',
|
||||
'closeParen',
|
||||
'classBaseClause',
|
||||
'classInterfaceClause',
|
||||
'classMembers'
|
||||
];
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ParenthesizedExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class PostfixUpdateExpression extends Expression {
|
||||
/** @var Variable */
|
||||
public $operand;
|
||||
|
||||
/** @var Token */
|
||||
public $incrementOrDecrementOperator;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'operand',
|
||||
'incrementOrDecrementOperator'
|
||||
];
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class PrefixUpdateExpression extends UnaryExpression {
|
||||
|
||||
/** @var Token */
|
||||
public $incrementOrDecrementOperator;
|
||||
|
||||
/** @var Variable */
|
||||
public $operand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'incrementOrDecrementOperator',
|
||||
'operand'
|
||||
];
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class PrintIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $printKeyword;
|
||||
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'printKeyword',
|
||||
'expression'
|
||||
];
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\QualifiedName;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ScopedPropertyAccessExpression extends Expression {
|
||||
|
||||
/** @var Expression|QualifiedName|Token */
|
||||
public $scopeResolutionQualifier;
|
||||
|
||||
/** @var Token */
|
||||
public $doubleColon;
|
||||
|
||||
/** @var Token|Variable */
|
||||
public $memberName;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'scopeResolutionQualifier',
|
||||
'doubleColon',
|
||||
'memberName'
|
||||
];
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ScriptInclusionExpression extends Expression {
|
||||
/** @var Token */
|
||||
public $requireOrIncludeKeyword;
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'requireOrIncludeKeyword',
|
||||
'expression'
|
||||
];
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class SubscriptExpression extends Expression {
|
||||
|
||||
/** @var Expression */
|
||||
public $postfixExpression;
|
||||
|
||||
/** @var Token */
|
||||
public $openBracketOrBrace;
|
||||
|
||||
/** @var Expression */
|
||||
public $accessExpression;
|
||||
|
||||
/** @var Token */
|
||||
public $closeBracketOrBrace;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'postfixExpression',
|
||||
'openBracketOrBrace',
|
||||
'accessExpression',
|
||||
'closeBracketOrBrace'
|
||||
];
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class TernaryExpression extends Expression {
|
||||
|
||||
/** @var Expression|Token (only a token when token before '?' is invalid/missing) */
|
||||
public $condition;
|
||||
|
||||
/** @var Token */
|
||||
public $questionToken;
|
||||
|
||||
/** @var Expression */
|
||||
public $ifExpression;
|
||||
|
||||
/** @var Token */
|
||||
public $colonToken;
|
||||
|
||||
/** @var Expression */
|
||||
public $elseExpression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'condition',
|
||||
'questionToken',
|
||||
'ifExpression',
|
||||
'colonToken',
|
||||
'elseExpression'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
class UnaryExpression extends Expression {
|
||||
/** @var UnaryExpression|Variable */
|
||||
public $operand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'operand'
|
||||
];
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class UnaryOpExpression extends UnaryExpression {
|
||||
|
||||
/** @var Token */
|
||||
public $operator;
|
||||
|
||||
/** @var UnaryExpression */
|
||||
public $operand;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'operator',
|
||||
'operand'
|
||||
];
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class UnsetIntrinsicExpression extends Expression {
|
||||
|
||||
/** @var Token */
|
||||
public $unsetKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
|
||||
/** @var DelimitedList\ExpressionList */
|
||||
public $expressions;
|
||||
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'unsetKeyword',
|
||||
'openParen',
|
||||
'expressions',
|
||||
'closeParen'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class Variable extends Expression {
|
||||
/** @var Token */
|
||||
public $dollar;
|
||||
|
||||
/** @var Token|Variable|BracedExpression */
|
||||
public $name;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'dollar',
|
||||
'name'
|
||||
];
|
||||
|
||||
public function getName() {
|
||||
if (
|
||||
$this->name instanceof Token &&
|
||||
$name = ltrim($this->name->getText($this->getFileContents()), '$')
|
||||
) {
|
||||
return $name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Expression;
|
||||
|
||||
use Microsoft\PhpParser\Node\ArrayElement;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class YieldExpression extends Expression {
|
||||
/** @var Token */
|
||||
public $yieldOrYieldFromKeyword;
|
||||
|
||||
/** @var ArrayElement */
|
||||
public $arrayElement;
|
||||
|
||||
const CHILD_NAMES = ['yieldOrYieldFromKeyword', 'arrayElement'];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class FinallyClause extends Node {
|
||||
/** @var Token */
|
||||
public $finallyToken;
|
||||
/** @var StatementNode */
|
||||
public $compoundStatement;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'finallyToken',
|
||||
'compoundStatement'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ForeachKey extends Node {
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
/** @var Token */
|
||||
public $arrow;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'expression',
|
||||
'arrow'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ForeachValue extends Node {
|
||||
/** @var Token|null */
|
||||
public $ampersand;
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'ampersand',
|
||||
'expression'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node\Statement\CompoundStatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
trait FunctionBody {
|
||||
/** @var CompoundStatementNode|Token */
|
||||
public $compoundStatementOrSemicolon;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
trait FunctionHeader {
|
||||
/** @var Token */
|
||||
public $functionKeyword;
|
||||
/** @var Token */
|
||||
public $byRefToken;
|
||||
/** @var null|Token */
|
||||
public $name;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var DelimitedList\ParameterDeclarationList */
|
||||
public $parameters;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
trait FunctionReturnType {
|
||||
/** @var Token */
|
||||
public $colonToken;
|
||||
/** @var Token|null */
|
||||
public $questionToken;
|
||||
/** @var Token|QualifiedName */
|
||||
public $returnType;
|
||||
/** @var DelimitedList\QualifiedNameList|null TODO: Merge with returnType in a future backwards incompatible release */
|
||||
public $otherReturnTypes;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
trait FunctionUseClause {
|
||||
/** @var AnonymousFunctionUseClause|null */
|
||||
public $anonymousFunctionUseClause;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class InterfaceBaseClause extends Node {
|
||||
/** @var Token */
|
||||
public $extendsKeyword;
|
||||
|
||||
/** @var DelimitedList\QualifiedNameList */
|
||||
public $interfaceNameList;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'extendsKeyword',
|
||||
'interfaceNameList'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class InterfaceMembers extends Node {
|
||||
/** @var Token */
|
||||
public $openBrace;
|
||||
|
||||
/** @var Node[] */
|
||||
public $interfaceMemberDeclarations;
|
||||
|
||||
/** @var Token */
|
||||
public $closeBrace;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'openBrace',
|
||||
'interfaceMemberDeclarations',
|
||||
'closeBrace'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Diagnostic;
|
||||
use Microsoft\PhpParser\DiagnosticKind;
|
||||
use Microsoft\PhpParser\DiagnosticsProvider;
|
||||
use Microsoft\PhpParser\FunctionLike;
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
use Microsoft\PhpParser\TokenKind;
|
||||
|
||||
class MethodDeclaration extends Node implements FunctionLike {
|
||||
/** @var Token[] */
|
||||
public $modifiers;
|
||||
|
||||
use FunctionHeader, FunctionReturnType, FunctionBody;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'modifiers',
|
||||
|
||||
// FunctionHeader
|
||||
'functionKeyword',
|
||||
'byRefToken',
|
||||
'name',
|
||||
'openParen',
|
||||
'parameters',
|
||||
'closeParen',
|
||||
|
||||
// FunctionReturnType
|
||||
'colonToken',
|
||||
'questionToken',
|
||||
'returnType',
|
||||
'otherReturnTypes',
|
||||
|
||||
// FunctionBody
|
||||
'compoundStatementOrSemicolon'
|
||||
];
|
||||
|
||||
public function hasModifier(int $targetModifier) : bool {
|
||||
if ($this->modifiers === null) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->modifiers as $modifier) {
|
||||
if ($modifier->kind === $targetModifier) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isStatic() : bool {
|
||||
return $this->hasModifier(TokenKind::StaticKeyword);
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name->getText($this->getFileContents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Diagnostic|null - Callers should use DiagnosticsProvider::getDiagnostics instead
|
||||
* @internal
|
||||
* @override
|
||||
*/
|
||||
public function getDiagnosticForNode() {
|
||||
foreach ($this->modifiers as $modifier) {
|
||||
if ($modifier->kind === TokenKind::VarKeyword) {
|
||||
return new Diagnostic(
|
||||
DiagnosticKind::Error,
|
||||
"Unexpected modifier '" . DiagnosticsProvider::getTextForTokenKind($modifier->kind) . "'",
|
||||
$modifier->start,
|
||||
$modifier->length
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class MissingMemberDeclaration extends Node {
|
||||
|
||||
/** @var Token[] */
|
||||
public $modifiers;
|
||||
|
||||
/** @var Token|null needed along with typeDeclaration for what looked like typed property declarations but was missing VariableName */
|
||||
public $questionToken;
|
||||
|
||||
/** @var QualifiedName|Token|null */
|
||||
public $typeDeclaration;
|
||||
|
||||
/** @var DelimitedList\QualifiedNameList|null */
|
||||
public $otherTypeDeclarations;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'modifiers',
|
||||
'questionToken',
|
||||
'typeDeclaration',
|
||||
'otherTypeDeclarations',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class NamespaceAliasingClause extends Node {
|
||||
/** @var Token */
|
||||
public $asKeyword;
|
||||
/** @var Token */
|
||||
public $name;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'asKeyword',
|
||||
'name'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class NamespaceUseClause extends Node {
|
||||
/** @var QualifiedName */
|
||||
public $namespaceName;
|
||||
/** @var NamespaceAliasingClause */
|
||||
public $namespaceAliasingClause;
|
||||
/** @var Token|null */
|
||||
public $openBrace;
|
||||
/** @var DelimitedList\NamespaceUseGroupClauseList|null */
|
||||
public $groupClauses;
|
||||
/** @var Token|null */
|
||||
public $closeBrace;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'namespaceName',
|
||||
'namespaceAliasingClause',
|
||||
'openBrace',
|
||||
'groupClauses',
|
||||
'closeBrace'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class NamespaceUseGroupClause extends Node {
|
||||
|
||||
/** @var Token */
|
||||
public $functionOrConst;
|
||||
/** @var QualifiedName */
|
||||
public $namespaceName;
|
||||
/** @var NamespaceAliasingClause */
|
||||
public $namespaceAliasingClause;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'functionOrConst',
|
||||
'namespaceName',
|
||||
'namespaceAliasingClause'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class NumericLiteral extends Expression {
|
||||
/** @var Token */
|
||||
public $children;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'children'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class Parameter extends Node {
|
||||
/** @var Token|null */
|
||||
public $questionToken;
|
||||
/** @var QualifiedName|Token|null */
|
||||
public $typeDeclaration;
|
||||
/**
|
||||
* @var DelimitedList\QualifiedNameList a list of other types, to support php 8 union types while remaining backwards compatible.
|
||||
* TODO: Merge with typeDeclaration in a future backwards incompatible release.
|
||||
*/
|
||||
public $otherTypeDeclarations;
|
||||
/** @var Token|null */
|
||||
public $byRefToken;
|
||||
/** @var Token|null */
|
||||
public $dotDotDotToken;
|
||||
/** @var Token */
|
||||
public $variableName;
|
||||
/** @var Token|null */
|
||||
public $equalsToken;
|
||||
/** @var null|Expression */
|
||||
public $default;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'questionToken',
|
||||
'typeDeclaration',
|
||||
'otherTypeDeclarations',
|
||||
'byRefToken',
|
||||
'dotDotDotToken',
|
||||
'variableName',
|
||||
'equalsToken',
|
||||
'default'
|
||||
];
|
||||
|
||||
public function isVariadic() {
|
||||
return $this->byRefToken !== null;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
if (
|
||||
$this->variableName instanceof Token &&
|
||||
$name = substr($this->variableName->getText($this->getFileContents()), 1)
|
||||
) {
|
||||
return $name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
use Microsoft\PhpParser\TokenKind;
|
||||
|
||||
class PropertyDeclaration extends Node {
|
||||
|
||||
/** @var Token[] */
|
||||
public $modifiers;
|
||||
|
||||
/** @var Token|null question token for PHP 7.4 type declaration */
|
||||
public $questionToken;
|
||||
|
||||
/** @var QualifiedName|Token|null */
|
||||
public $typeDeclaration;
|
||||
|
||||
/**
|
||||
* @var DelimitedList\QualifiedNameList|null
|
||||
* TODO: Unify with typeDeclaration in a future backwards incompatible release
|
||||
*/
|
||||
public $otherTypeDeclarations;
|
||||
|
||||
/** @var DelimitedList\ExpressionList */
|
||||
public $propertyElements;
|
||||
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'modifiers',
|
||||
'questionToken',
|
||||
'typeDeclaration',
|
||||
'otherTypeDeclarations',
|
||||
'propertyElements',
|
||||
'semicolon'
|
||||
];
|
||||
|
||||
public function isStatic() : bool {
|
||||
if ($this->modifiers === null) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->modifiers as $modifier) {
|
||||
if ($modifier->kind === TokenKind::StaticKeyword) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\NamespacedNameInterface;
|
||||
use Microsoft\PhpParser\NamespacedNameTrait;
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\Expression\AnonymousFunctionCreationExpression;
|
||||
use Microsoft\PhpParser\Node\Expression\ArrowFunctionCreationExpression;
|
||||
use Microsoft\PhpParser\Node\Expression\CallExpression;
|
||||
use Microsoft\PhpParser\Node\Expression\ObjectCreationExpression;
|
||||
use Microsoft\PhpParser\ResolvedName;
|
||||
use Microsoft\PhpParser\Token;
|
||||
use Microsoft\PhpParser\TokenKind;
|
||||
|
||||
class QualifiedName extends Node implements NamespacedNameInterface {
|
||||
use NamespacedNameTrait;
|
||||
|
||||
/** @var Token */
|
||||
public $globalSpecifier; // \_opt
|
||||
/** @var RelativeSpecifier */
|
||||
public $relativeSpecifier; // namespace\
|
||||
/** @var array */
|
||||
public $nameParts;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'globalSpecifier',
|
||||
'relativeSpecifier',
|
||||
'nameParts'
|
||||
];
|
||||
|
||||
/**
|
||||
* Checks whether a QualifiedName is prefixed with a backslash global specifier.
|
||||
* @return bool
|
||||
*/
|
||||
public function isFullyQualifiedName() : bool {
|
||||
return isset($this->globalSpecifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a QualifiedName begins with a "namespace" keyword
|
||||
* @return bool
|
||||
*/
|
||||
public function isRelativeName() : bool {
|
||||
return isset($this->relativeSpecifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a Name includes at least one namespace separator (and is neither fully-qualified nor relative)
|
||||
* @return bool
|
||||
*/
|
||||
public function isQualifiedName() : bool {
|
||||
return
|
||||
!$this->isFullyQualifiedName() &&
|
||||
!$this->isRelativeName() &&
|
||||
\count($this->nameParts) > 1; // at least one namespace separator
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a name is does not include a namespace separator.
|
||||
* @return bool
|
||||
*/
|
||||
public function isUnqualifiedName() : bool {
|
||||
return !($this->isFullyQualifiedName() || $this->isRelativeName() || $this->isQualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets resolved name based on name resolution rules defined in:
|
||||
* http://php.net/manual/en/language.namespaces.rules.php
|
||||
*
|
||||
* Returns null if one of the following conditions is met:
|
||||
* - name resolution is not valid for this element (e.g. part of the name in a namespace definition)
|
||||
* - name cannot be resolved (unqualified namespaced function/constant names that are not explicitly imported.)
|
||||
*
|
||||
* @return null|string|ResolvedName
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getResolvedName($namespaceDefinition = null) {
|
||||
// Name resolution not applicable to constructs that define symbol names or aliases.
|
||||
if (($this->parent instanceof Node\Statement\NamespaceDefinition && $this->parent->name->getStart() === $this->getStart()) ||
|
||||
$this->parent instanceof Node\Statement\NamespaceUseDeclaration ||
|
||||
$this->parent instanceof Node\NamespaceUseClause ||
|
||||
$this->parent instanceof Node\NamespaceUseGroupClause ||
|
||||
$this->parent->parent instanceof Node\TraitUseClause ||
|
||||
$this->parent instanceof Node\TraitSelectOrAliasClause ||
|
||||
($this->parent instanceof TraitSelectOrAliasClause &&
|
||||
($this->parent->asOrInsteadOfKeyword == null || $this->parent->asOrInsteadOfKeyword->kind === TokenKind::AsKeyword))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (in_array($lowerText = strtolower($this->getText()), ["self", "static", "parent"])) {
|
||||
return $lowerText;
|
||||
}
|
||||
|
||||
// FULLY QUALIFIED NAMES
|
||||
// - resolve to the name without leading namespace separator.
|
||||
if ($this->isFullyQualifiedName()) {
|
||||
return ResolvedName::buildName($this->nameParts, $this->getFileContents());
|
||||
}
|
||||
|
||||
// RELATIVE NAMES
|
||||
// - resolve to the name with namespace replaced by the current namespace.
|
||||
// - if current namespace is global, strip leading namespace\ prefix.
|
||||
if ($this->isRelativeName()) {
|
||||
return $this->getNamespacedName();
|
||||
}
|
||||
|
||||
list($namespaceImportTable, $functionImportTable, $constImportTable) = $this->getImportTablesForCurrentScope();
|
||||
|
||||
// QUALIFIED NAMES
|
||||
// - first segment of the name is translated according to the current class/namespace import table.
|
||||
// - If no import rule applies, the current namespace is prepended to the name.
|
||||
if ($this->isQualifiedName()) {
|
||||
return $this->tryResolveFromImportTable($namespaceImportTable) ?? $this->getNamespacedName();
|
||||
}
|
||||
|
||||
// UNQUALIFIED NAMES
|
||||
// - translated according to the current import table for the respective symbol type.
|
||||
// (class-like => namespace import table, constant => const import table, function => function import table)
|
||||
// - if no import rule applies:
|
||||
// - all symbol types: if current namespace is global, resolve to global namespace.
|
||||
// - class-like symbols: resolve from current namespace.
|
||||
// - function or const: resolved at runtime (from current namespace, with fallback to global namespace).
|
||||
if ($this->isConstantName()) {
|
||||
$resolvedName = $this->tryResolveFromImportTable($constImportTable, /* case-sensitive */ true);
|
||||
$namespaceDefinition = $this->getNamespaceDefinition();
|
||||
if ($namespaceDefinition !== null && $namespaceDefinition->name === null) {
|
||||
$resolvedName = $resolvedName ?? ResolvedName::buildName($this->nameParts, $this->getFileContents());
|
||||
}
|
||||
return $resolvedName;
|
||||
} elseif ($this->parent instanceof CallExpression) {
|
||||
$resolvedName = $this->tryResolveFromImportTable($functionImportTable);
|
||||
if (($namespaceDefinition = $this->getNamespaceDefinition()) === null || $namespaceDefinition->name === null) {
|
||||
$resolvedName = $resolvedName ?? ResolvedName::buildName($this->nameParts, $this->getFileContents());
|
||||
}
|
||||
return $resolvedName;
|
||||
}
|
||||
|
||||
return $this->tryResolveFromImportTable($namespaceImportTable) ?? $this->getNamespacedName();
|
||||
}
|
||||
|
||||
public function getLastNamePart() {
|
||||
$parts = $this->nameParts;
|
||||
for ($i = \count($parts) - 1; $i >= 0; $i--) {
|
||||
// TODO - also handle reserved word tokens
|
||||
if ($parts[$i]->kind === TokenKind::Name) {
|
||||
return $parts[$i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResolvedName[] $importTable
|
||||
* @param bool $isCaseSensitive
|
||||
* @return string|null
|
||||
*/
|
||||
private function tryResolveFromImportTable($importTable, bool $isCaseSensitive = false) {
|
||||
$content = $this->getFileContents();
|
||||
$index = $this->nameParts[0]->getText($content);
|
||||
// if (!$isCaseSensitive) {
|
||||
// $index = strtolower($index);
|
||||
// }
|
||||
if(isset($importTable[$index])) {
|
||||
$resolvedName = $importTable[$index];
|
||||
$resolvedName->addNameParts(\array_slice($this->nameParts, 1), $content);
|
||||
return $resolvedName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private function isConstantName() : bool {
|
||||
return
|
||||
($this->parent instanceof Node\Statement\ExpressionStatement || $this->parent instanceof Expression) &&
|
||||
!(
|
||||
$this->parent instanceof Node\Expression\MemberAccessExpression || $this->parent instanceof CallExpression ||
|
||||
$this->parent instanceof ObjectCreationExpression ||
|
||||
$this->parent instanceof Node\Expression\ScopedPropertyAccessExpression || $this->parent instanceof AnonymousFunctionCreationExpression ||
|
||||
$this->parent instanceof ArrowFunctionCreationExpression ||
|
||||
($this->parent instanceof Node\Expression\BinaryExpression && $this->parent->operator->kind === TokenKind::InstanceOfKeyword)
|
||||
);
|
||||
}
|
||||
|
||||
public function getNameParts() : array {
|
||||
return $this->nameParts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class RelativeSpecifier extends Node {
|
||||
/** @var Token */
|
||||
public $namespaceKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $backslash;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'namespaceKeyword',
|
||||
'backslash'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ReservedWord extends Expression {
|
||||
/** @var Token */
|
||||
public $children;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'children'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class SourceFileNode extends Node {
|
||||
/** @var string */
|
||||
public $fileContents;
|
||||
|
||||
/** @var string */
|
||||
public $uri;
|
||||
|
||||
/** @var Node[] */
|
||||
public $statementList;
|
||||
|
||||
/** @var Token */
|
||||
public $endOfFileToken;
|
||||
|
||||
const CHILD_NAMES = ['statementList', 'endOfFileToken'];
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Diagnostic;
|
||||
use Microsoft\PhpParser\DiagnosticKind;
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
use Microsoft\PhpParser\TokenKind;
|
||||
|
||||
class BreakOrContinueStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $breakOrContinueKeyword;
|
||||
/** @var Expression|null */
|
||||
public $breakoutLevel;
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'breakOrContinueKeyword',
|
||||
'breakoutLevel',
|
||||
'semicolon'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return Diagnostic|null - Callers should use DiagnosticsProvider::getDiagnostics instead
|
||||
* @internal
|
||||
* @override
|
||||
*/
|
||||
public function getDiagnosticForNode() {
|
||||
if ($this->breakoutLevel === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$breakoutLevel = $this->breakoutLevel;
|
||||
while ($breakoutLevel instanceof Node\Expression\ParenthesizedExpression) {
|
||||
$breakoutLevel = $breakoutLevel->expression;
|
||||
}
|
||||
|
||||
if (
|
||||
$breakoutLevel instanceof Node\NumericLiteral
|
||||
&& $breakoutLevel->children->kind === TokenKind::IntegerLiteralToken
|
||||
) {
|
||||
$literalString = $breakoutLevel->getText();
|
||||
$firstTwoChars = \substr($literalString, 0, 2);
|
||||
|
||||
if ($firstTwoChars === '0b' || $firstTwoChars === '0B') {
|
||||
if (\bindec(\substr($literalString, 2)) > 0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (\intval($literalString, 0) > 0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($breakoutLevel instanceof Token) {
|
||||
$start = $breakoutLevel->getStartPosition();
|
||||
}
|
||||
else {
|
||||
$start = $breakoutLevel->getStart();
|
||||
}
|
||||
$end = $breakoutLevel->getEndPosition();
|
||||
|
||||
return new Diagnostic(
|
||||
DiagnosticKind::Error,
|
||||
"Positive integer literal expected.",
|
||||
$start,
|
||||
$end - $start
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\ClassLike;
|
||||
use Microsoft\PhpParser\NamespacedNameInterface;
|
||||
use Microsoft\PhpParser\NamespacedNameTrait;
|
||||
use Microsoft\PhpParser\Node\ClassBaseClause;
|
||||
use Microsoft\PhpParser\Node\ClassInterfaceClause;
|
||||
use Microsoft\PhpParser\Node\ClassMembersNode;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ClassDeclaration extends StatementNode implements NamespacedNameInterface, ClassLike {
|
||||
use NamespacedNameTrait;
|
||||
|
||||
/** @var Token */
|
||||
public $abstractOrFinalModifier;
|
||||
|
||||
/** @var Token */
|
||||
public $classKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $name;
|
||||
|
||||
/** @var ClassBaseClause */
|
||||
public $classBaseClause;
|
||||
|
||||
/** @var ClassInterfaceClause */
|
||||
public $classInterfaceClause;
|
||||
|
||||
/** @var ClassMembersNode */
|
||||
public $classMembers;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'abstractOrFinalModifier',
|
||||
'classKeyword',
|
||||
'name',
|
||||
'classBaseClause',
|
||||
'classInterfaceClause',
|
||||
'classMembers'
|
||||
];
|
||||
|
||||
public function getNameParts() : array {
|
||||
return [$this->name];
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class CompoundStatementNode extends StatementNode {
|
||||
/** @var Token */
|
||||
public $openBrace;
|
||||
|
||||
/** @var array|Node[] */
|
||||
public $statements;
|
||||
|
||||
/** @var Token */
|
||||
public $closeBrace;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'openBrace',
|
||||
'statements',
|
||||
'closeBrace'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ConstDeclaration extends StatementNode {
|
||||
/** @var Token */
|
||||
public $constKeyword;
|
||||
|
||||
/** @var DelimitedList\ConstElementList */
|
||||
public $constElements;
|
||||
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'constKeyword',
|
||||
'constElements',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class DeclareStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $declareKeyword;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var Node */
|
||||
public $declareDirective;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var Token|null */
|
||||
public $colon;
|
||||
/** @var StatementNode|StatementNode[] */
|
||||
public $statements;
|
||||
/** @var Token|null */
|
||||
public $enddeclareKeyword;
|
||||
/** @var Token|null */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'declareKeyword',
|
||||
'openParen',
|
||||
'declareDirective',
|
||||
'closeParen',
|
||||
'colon',
|
||||
'statements',
|
||||
'enddeclareKeyword',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class DoStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $do;
|
||||
/** @var StatementNode */
|
||||
public $statement;
|
||||
/** @var Token */
|
||||
public $whileToken;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var Token|null */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'do',
|
||||
'statement',
|
||||
'whileToken',
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class EmptyStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ExpressionStatement extends StatementNode {
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'expression',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ForStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $for;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var Expression|null */
|
||||
public $forInitializer;
|
||||
/** @var Token */
|
||||
public $exprGroupSemicolon1;
|
||||
/** @var Expression|null */
|
||||
public $forControl;
|
||||
/** @var Token */
|
||||
public $exprGroupSemicolon2;
|
||||
/** @var Expression|null */
|
||||
public $forEndOfLoop;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var Token|null */
|
||||
public $colon;
|
||||
/** @var StatementNode|StatementNode[] */
|
||||
public $statements;
|
||||
/** @var Token|null */
|
||||
public $endFor;
|
||||
/** @var Token|null */
|
||||
public $endForSemicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'for',
|
||||
'openParen',
|
||||
'forInitializer',
|
||||
'exprGroupSemicolon1',
|
||||
'forControl',
|
||||
'exprGroupSemicolon2',
|
||||
'forEndOfLoop',
|
||||
'closeParen',
|
||||
'colon',
|
||||
'statements',
|
||||
'endFor',
|
||||
'endForSemicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\ForeachKey;
|
||||
use Microsoft\PhpParser\Node\ForeachValue;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class ForeachStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $foreach;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var Expression */
|
||||
public $forEachCollectionName;
|
||||
/** @var Token */
|
||||
public $asKeyword;
|
||||
/** @var ForeachKey|null */
|
||||
public $foreachKey;
|
||||
/** @var ForeachValue */
|
||||
public $foreachValue;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var Token|null */
|
||||
public $colon;
|
||||
/** @var StatementNode|StatementNode[] */
|
||||
public $statements;
|
||||
/** @var Token|null */
|
||||
public $endForeach;
|
||||
/** @var Token|null */
|
||||
public $endForeachSemicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'foreach',
|
||||
'openParen',
|
||||
'forEachCollectionName',
|
||||
'asKeyword',
|
||||
'foreachKey',
|
||||
'foreachValue',
|
||||
'closeParen',
|
||||
'colon',
|
||||
'statements',
|
||||
'endForeach',
|
||||
'endForeachSemicolon'
|
||||
];
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\FunctionLike;
|
||||
use Microsoft\PhpParser\NamespacedNameInterface;
|
||||
use Microsoft\PhpParser\NamespacedNameTrait;
|
||||
use Microsoft\PhpParser\Node\FunctionBody;
|
||||
use Microsoft\PhpParser\Node\FunctionHeader;
|
||||
use Microsoft\PhpParser\Node\FunctionReturnType;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
|
||||
class FunctionDeclaration extends StatementNode implements NamespacedNameInterface, FunctionLike {
|
||||
use FunctionHeader, FunctionReturnType, FunctionBody;
|
||||
use NamespacedNameTrait;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
// FunctionHeader
|
||||
'functionKeyword',
|
||||
'byRefToken',
|
||||
'name',
|
||||
'openParen',
|
||||
'parameters',
|
||||
'closeParen',
|
||||
|
||||
// FunctionReturnType
|
||||
'colonToken',
|
||||
'questionToken',
|
||||
'returnType',
|
||||
'otherReturnTypes',
|
||||
|
||||
// FunctionBody
|
||||
'compoundStatementOrSemicolon'
|
||||
];
|
||||
|
||||
public function getNameParts() : array {
|
||||
return [$this->name];
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class FunctionStaticDeclaration extends StatementNode {
|
||||
|
||||
/** @var Token */
|
||||
public $staticKeyword;
|
||||
|
||||
/** @var DelimitedList\StaticVariableNameList */
|
||||
public $staticVariableNameList;
|
||||
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'staticKeyword',
|
||||
'staticVariableNameList',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\DelimitedList;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class GlobalDeclaration extends StatementNode {
|
||||
|
||||
/** @var Token */
|
||||
public $globalKeyword;
|
||||
|
||||
/** @var DelimitedList\VariableNameList */
|
||||
public $variableNameList;
|
||||
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'globalKeyword',
|
||||
'variableNameList',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class GotoStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $goto;
|
||||
/** @var Token */
|
||||
public $name;
|
||||
/** @var Token */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'goto',
|
||||
'name',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\ElseClauseNode;
|
||||
use Microsoft\PhpParser\Node\ElseIfClauseNode;
|
||||
use Microsoft\PhpParser\Node\Expression;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class IfStatementNode extends StatementNode {
|
||||
/** @var Token */
|
||||
public $ifKeyword;
|
||||
/** @var Token */
|
||||
public $openParen;
|
||||
/** @var Expression */
|
||||
public $expression;
|
||||
/** @var Token */
|
||||
public $closeParen;
|
||||
/** @var Token|null */
|
||||
public $colon;
|
||||
/** @var StatementNode|StatementNode[] */
|
||||
public $statements;
|
||||
/** @var ElseIfClauseNode[] */
|
||||
public $elseIfClauses;
|
||||
/** @var ElseClauseNode|null */
|
||||
public $elseClause;
|
||||
/** @var Token|null */
|
||||
public $endifKeyword;
|
||||
/** @var Token|null */
|
||||
public $semicolon;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'ifKeyword',
|
||||
'openParen',
|
||||
'expression',
|
||||
'closeParen',
|
||||
'colon',
|
||||
'statements',
|
||||
'elseIfClauses',
|
||||
'elseClause',
|
||||
'endifKeyword',
|
||||
'semicolon'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class InlineHtml extends StatementNode {
|
||||
/** @var Token|null */
|
||||
public $scriptSectionEndTag;
|
||||
|
||||
/** @var Token */
|
||||
public $text;
|
||||
|
||||
/** @var Token|null */
|
||||
public $scriptSectionStartTag;
|
||||
|
||||
/**
|
||||
* @var ExpressionStatement|null used to represent the expression echoed by `<?=` while parsing.
|
||||
*
|
||||
* This should always be null in the returned AST,
|
||||
* and is deliberately excluded from CHILD_NAMES.
|
||||
*
|
||||
* This will be null under any of these conditions:
|
||||
*
|
||||
* - The scriptSectionStartTag isn't TokenKind::ScriptSectionStartWithEchoTag,
|
||||
* - The echoStatement was normalized and moved into a statement list.
|
||||
* If a caller doesn't do this, that's a bug.
|
||||
*/
|
||||
public $echoStatement;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'scriptSectionEndTag',
|
||||
'text',
|
||||
'scriptSectionStartTag',
|
||||
];
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\ClassLike;
|
||||
use Microsoft\PhpParser\NamespacedNameInterface;
|
||||
use Microsoft\PhpParser\NamespacedNameTrait;
|
||||
use Microsoft\PhpParser\Node\InterfaceBaseClause;
|
||||
use Microsoft\PhpParser\Node\InterfaceMembers;
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class InterfaceDeclaration extends StatementNode implements NamespacedNameInterface, ClassLike {
|
||||
use NamespacedNameTrait;
|
||||
|
||||
/** @var Token */
|
||||
public $interfaceKeyword;
|
||||
|
||||
/** @var Token */
|
||||
public $name;
|
||||
|
||||
/** @var InterfaceBaseClause|null */
|
||||
public $interfaceBaseClause;
|
||||
|
||||
/** @var InterfaceMembers */
|
||||
public $interfaceMembers;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'interfaceKeyword',
|
||||
'name',
|
||||
'interfaceBaseClause',
|
||||
'interfaceMembers'
|
||||
];
|
||||
|
||||
public function getNameParts() : array {
|
||||
return [$this->name];
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
namespace Microsoft\PhpParser\Node\Statement;
|
||||
|
||||
use Microsoft\PhpParser\Node\StatementNode;
|
||||
use Microsoft\PhpParser\Token;
|
||||
|
||||
class NamedLabelStatement extends StatementNode {
|
||||
/** @var Token */
|
||||
public $name;
|
||||
/** @var Token */
|
||||
public $colon;
|
||||
/** @var StatementNode */
|
||||
public $statement;
|
||||
|
||||
const CHILD_NAMES = [
|
||||
'name',
|
||||
'colon',
|
||||
'statement'
|
||||
];
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user