Code Clean up, more testing

Remove unused code and classes.
Clean up code to remove all named constant from them and throw
deprecation alerts if used.
Add basic psalm setup in root folder and remove from www folder
This commit is contained in:
Clemens Schwaighofer
2023-03-09 15:55:57 +09:00
parent d952c5f774
commit 03fbcaecfb
149 changed files with 3406 additions and 1937 deletions

View File

@@ -8,10 +8,11 @@ namespace Microsoft\PhpParser\Node\Expression;
use Microsoft\PhpParser\Node\DelimitedList;
use Microsoft\PhpParser\Node\Expression;
use Microsoft\PhpParser\Node\QualifiedName;
use Microsoft\PhpParser\Token;
class CallExpression extends Expression {
/** @var Expression */
/** @var QualifiedName|Expression */
public $callableExpression;
/** @var Token */

View File

@@ -14,7 +14,7 @@ class YieldExpression extends Expression {
/** @var Token */
public $yieldOrYieldFromKeyword;
/** @var ArrayElement */
/** @var ArrayElement|null */
public $arrayElement;
const CHILD_NAMES = ['yieldOrYieldFromKeyword', 'arrayElement'];

View File

@@ -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;
use Microsoft\PhpParser\MissingToken;
use Microsoft\PhpParser\Node;
use Microsoft\PhpParser\Node\DelimitedList\QualifiedNameList;
use Microsoft\PhpParser\Token;
class ParenthesizedIntersectionType extends Node{
/** @var Token */
public $openParen;
/** @var QualifiedNameList|MissingToken */
public $children;
/** @var Token */
public $closeParen;
const CHILD_NAMES = [
'openParen',
'children',
'closeParen'
];
}

View File

@@ -13,7 +13,7 @@ class SourceFileNode extends Node {
/** @var string */
public $fileContents;
/** @var string */
/** @var ?string */
public $uri;
/** @var Node[] */

View File

@@ -22,9 +22,12 @@ class ClassDeclaration extends StatementNode implements NamespacedNameInterface,
/** @var AttributeGroup[]|null */
public $attributes;
/** @var Token */
/** @var Token abstract/final/readonly modifier */
public $abstractOrFinalModifier;
/** @var Token[] additional abstract/final/readonly modifiers */
public $modifiers;
/** @var Token */
public $classKeyword;
@@ -43,6 +46,7 @@ class ClassDeclaration extends StatementNode implements NamespacedNameInterface,
const CHILD_NAMES = [
'attributes',
'abstractOrFinalModifier',
'modifiers',
'classKeyword',
'name',
'classBaseClause',

View File

@@ -0,0 +1,45 @@
<?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\Token;
class HaltCompilerStatement extends Expression {
/** @var Token */
public $haltCompilerKeyword;
/** @var Token */
public $openParen;
/** @var Token */
public $closeParen;
/** @var Token (there is an implicit ')' before php close tags (`?>`)) */
public $semicolonOrCloseTag;
/** @var Token|null TokenKind::InlineHtml data unless there are no bytes (This is optional if there is nothing after the semicolon) */
public $data;
const CHILD_NAMES = [
'haltCompilerKeyword',
'openParen',
'closeParen',
'semicolonOrCloseTag',
'data',
];
/**
* @return int
*/
public function getHaltCompilerOffset() {
// This accounts for the fact that PHP close tags may include a single newline,
// and that $this->data may be null.
return $this->semicolonOrCloseTag->getEndPosition();
}
}