From dd63ddbc248e069660a1ce477d8597e363e55ced Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 28 Aug 2022 22:57:06 +0200 Subject: [PATCH] Add php-cs-fixer config and reformat The formatting in this project has become something of a mess, because it changed over time. Add a CS fixer config and reformat to the desired style, which is PSR-12, but with sane brace placement. --- .php-cs-fixer.dist.php | 22 +++++ lib/PhpParser/Builder.php | 5 +- lib/PhpParser/Builder/ClassConst.php | 3 +- lib/PhpParser/Builder/Class_.php | 5 +- lib/PhpParser/Builder/Declaration.php | 3 +- lib/PhpParser/Builder/EnumCase.php | 3 +- lib/PhpParser/Builder/Enum_.php | 5 +- lib/PhpParser/Builder/FunctionLike.php | 3 +- lib/PhpParser/Builder/Function_.php | 5 +- lib/PhpParser/Builder/Interface_.php | 5 +- lib/PhpParser/Builder/Method.php | 5 +- lib/PhpParser/Builder/Namespace_.php | 5 +- lib/PhpParser/Builder/Param.php | 5 +- lib/PhpParser/Builder/Property.php | 5 +- lib/PhpParser/Builder/TraitUse.php | 5 +- lib/PhpParser/Builder/TraitUseAdaptation.php | 7 +- lib/PhpParser/Builder/Trait_.php | 5 +- lib/PhpParser/Builder/Use_.php | 5 +- lib/PhpParser/BuilderFactory.php | 59 +++++++------- lib/PhpParser/BuilderHelpers.php | 22 +++-- lib/PhpParser/Comment.php | 29 ++++--- lib/PhpParser/Comment/Doc.php | 3 +- .../ConstExprEvaluationException.php | 4 +- lib/PhpParser/ConstExprEvaluator.php | 10 +-- lib/PhpParser/Error.php | 21 +++-- lib/PhpParser/ErrorHandler.php | 3 +- lib/PhpParser/ErrorHandler/Collecting.php | 7 +- lib/PhpParser/ErrorHandler/Throwing.php | 3 +- lib/PhpParser/Internal/DiffElem.php | 3 +- lib/PhpParser/Internal/Differ.php | 3 +- .../Internal/PrintableNewAnonClassNode.php | 7 +- lib/PhpParser/Internal/TokenPolyfill.php | 7 +- lib/PhpParser/Internal/TokenStream.php | 15 ++-- lib/PhpParser/JsonDecoder.php | 13 ++- lib/PhpParser/Lexer.php | 3 +- lib/PhpParser/Lexer/Emulative.php | 22 +++-- .../Lexer/TokenEmulator/AttributeEmulator.php | 15 ++-- .../CoaleseEqualTokenEmulator.php | 15 ++-- .../Lexer/TokenEmulator/EnumTokenEmulator.php | 15 ++-- .../TokenEmulator/ExplicitOctalEmulator.php | 3 +- .../FlexibleDocStringEmulator.php | 15 ++-- .../Lexer/TokenEmulator/FnTokenEmulator.php | 12 +-- .../Lexer/TokenEmulator/KeywordEmulator.php | 18 ++--- .../TokenEmulator/MatchTokenEmulator.php | 12 +-- .../TokenEmulator/NullsafeTokenEmulator.php | 15 ++-- .../NumericLiteralSeparatorEmulator.php | 18 ++--- .../TokenEmulator/ReadonlyTokenEmulator.php | 15 ++-- .../Lexer/TokenEmulator/ReverseEmulator.php | 3 +- .../Lexer/TokenEmulator/TokenEmulator.php | 3 +- lib/PhpParser/NameContext.php | 11 ++- lib/PhpParser/Node.php | 27 +++---- lib/PhpParser/Node/Arg.php | 9 +-- lib/PhpParser/Node/Attribute.php | 7 +- lib/PhpParser/Node/AttributeGroup.php | 7 +- lib/PhpParser/Node/ClosureUse.php | 9 +-- lib/PhpParser/Node/ComplexType.php | 3 +- lib/PhpParser/Node/Const_.php | 7 +- lib/PhpParser/Node/Expr.php | 3 +- lib/PhpParser/Node/Expr/ArrayDimFetch.php | 9 +-- lib/PhpParser/Node/Expr/ArrayItem.php | 7 +- lib/PhpParser/Node/Expr/Array_.php | 9 +-- lib/PhpParser/Node/Expr/ArrowFunction.php | 15 ++-- lib/PhpParser/Node/Expr/Assign.php | 9 +-- lib/PhpParser/Node/Expr/AssignOp.php | 5 +- .../Node/Expr/AssignOp/BitwiseAnd.php | 5 +- .../Node/Expr/AssignOp/BitwiseOr.php | 5 +- .../Node/Expr/AssignOp/BitwiseXor.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Coalesce.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Concat.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Div.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Minus.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Mod.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Mul.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Plus.php | 5 +- lib/PhpParser/Node/Expr/AssignOp/Pow.php | 5 +- .../Node/Expr/AssignOp/ShiftLeft.php | 5 +- .../Node/Expr/AssignOp/ShiftRight.php | 5 +- lib/PhpParser/Node/Expr/AssignRef.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp.php | 7 +- .../Node/Expr/BinaryOp/BitwiseAnd.php | 9 +-- .../Node/Expr/BinaryOp/BitwiseOr.php | 9 +-- .../Node/Expr/BinaryOp/BitwiseXor.php | 9 +-- .../Node/Expr/BinaryOp/BooleanAnd.php | 9 +-- .../Node/Expr/BinaryOp/BooleanOr.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Concat.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Div.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Equal.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Greater.php | 9 +-- .../Node/Expr/BinaryOp/GreaterOrEqual.php | 9 +-- .../Node/Expr/BinaryOp/Identical.php | 9 +-- .../Node/Expr/BinaryOp/LogicalAnd.php | 9 +-- .../Node/Expr/BinaryOp/LogicalOr.php | 9 +-- .../Node/Expr/BinaryOp/LogicalXor.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Minus.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Mod.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Mul.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php | 9 +-- .../Node/Expr/BinaryOp/NotIdentical.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Plus.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Pow.php | 9 +-- .../Node/Expr/BinaryOp/ShiftLeft.php | 9 +-- .../Node/Expr/BinaryOp/ShiftRight.php | 9 +-- lib/PhpParser/Node/Expr/BinaryOp/Smaller.php | 9 +-- .../Node/Expr/BinaryOp/SmallerOrEqual.php | 9 +-- .../Node/Expr/BinaryOp/Spaceship.php | 9 +-- lib/PhpParser/Node/Expr/BitwiseNot.php | 9 +-- lib/PhpParser/Node/Expr/BooleanNot.php | 9 +-- lib/PhpParser/Node/Expr/Cast.php | 5 +- lib/PhpParser/Node/Expr/Cast/Array_.php | 5 +- lib/PhpParser/Node/Expr/Cast/Bool_.php | 5 +- lib/PhpParser/Node/Expr/Cast/Double.php | 5 +- lib/PhpParser/Node/Expr/Cast/Int_.php | 5 +- lib/PhpParser/Node/Expr/Cast/Object_.php | 5 +- lib/PhpParser/Node/Expr/Cast/String_.php | 5 +- lib/PhpParser/Node/Expr/Cast/Unset_.php | 5 +- lib/PhpParser/Node/Expr/ClassConstFetch.php | 9 +-- lib/PhpParser/Node/Expr/Clone_.php | 9 +-- lib/PhpParser/Node/Expr/Closure.php | 15 ++-- lib/PhpParser/Node/Expr/ConstFetch.php | 9 +-- lib/PhpParser/Node/Expr/Empty_.php | 9 +-- lib/PhpParser/Node/Expr/Error.php | 9 +-- lib/PhpParser/Node/Expr/ErrorSuppress.php | 9 +-- lib/PhpParser/Node/Expr/Eval_.php | 9 +-- lib/PhpParser/Node/Expr/Exit_.php | 9 +-- lib/PhpParser/Node/Expr/FuncCall.php | 9 +-- lib/PhpParser/Node/Expr/Include_.php | 9 +-- lib/PhpParser/Node/Expr/Instanceof_.php | 9 +-- lib/PhpParser/Node/Expr/Isset_.php | 9 +-- lib/PhpParser/Node/Expr/List_.php | 9 +-- lib/PhpParser/Node/Expr/Match_.php | 7 +- lib/PhpParser/Node/Expr/MethodCall.php | 9 +-- lib/PhpParser/Node/Expr/New_.php | 9 +-- .../Node/Expr/NullsafeMethodCall.php | 9 +-- .../Node/Expr/NullsafePropertyFetch.php | 9 +-- lib/PhpParser/Node/Expr/PostDec.php | 9 +-- lib/PhpParser/Node/Expr/PostInc.php | 9 +-- lib/PhpParser/Node/Expr/PreDec.php | 7 +- lib/PhpParser/Node/Expr/PreInc.php | 9 +-- lib/PhpParser/Node/Expr/Print_.php | 9 +-- lib/PhpParser/Node/Expr/PropertyFetch.php | 9 +-- lib/PhpParser/Node/Expr/ShellExec.php | 9 +-- lib/PhpParser/Node/Expr/StaticCall.php | 9 +-- .../Node/Expr/StaticPropertyFetch.php | 9 +-- lib/PhpParser/Node/Expr/Ternary.php | 9 +-- lib/PhpParser/Node/Expr/Throw_.php | 7 +- lib/PhpParser/Node/Expr/UnaryMinus.php | 9 +-- lib/PhpParser/Node/Expr/UnaryPlus.php | 9 +-- lib/PhpParser/Node/Expr/Variable.php | 9 +-- lib/PhpParser/Node/Expr/YieldFrom.php | 9 +-- lib/PhpParser/Node/Expr/Yield_.php | 9 +-- lib/PhpParser/Node/FunctionLike.php | 9 +-- lib/PhpParser/Node/Identifier.php | 17 ++-- lib/PhpParser/Node/IntersectionType.php | 8 +- lib/PhpParser/Node/MatchArm.php | 7 +- lib/PhpParser/Node/Name.php | 31 ++++--- lib/PhpParser/Node/Name/FullyQualified.php | 17 ++-- lib/PhpParser/Node/Name/Relative.php | 17 ++-- lib/PhpParser/Node/NullableType.php | 9 +-- lib/PhpParser/Node/Param.php | 7 +- lib/PhpParser/Node/Scalar.php | 3 +- lib/PhpParser/Node/Scalar/DNumber.php | 12 ++- lib/PhpParser/Node/Scalar/Encapsed.php | 9 +-- .../Node/Scalar/EncapsedStringPart.php | 9 +-- lib/PhpParser/Node/Scalar/LNumber.php | 9 +-- lib/PhpParser/Node/Scalar/MagicConst.php | 7 +- .../Node/Scalar/MagicConst/Class_.php | 9 +-- lib/PhpParser/Node/Scalar/MagicConst/Dir.php | 9 +-- lib/PhpParser/Node/Scalar/MagicConst/File.php | 9 +-- .../Node/Scalar/MagicConst/Function_.php | 9 +-- lib/PhpParser/Node/Scalar/MagicConst/Line.php | 9 +-- .../Node/Scalar/MagicConst/Method.php | 9 +-- .../Node/Scalar/MagicConst/Namespace_.php | 9 +-- .../Node/Scalar/MagicConst/Trait_.php | 9 +-- lib/PhpParser/Node/Scalar/String_.php | 18 ++--- lib/PhpParser/Node/Stmt.php | 3 +- lib/PhpParser/Node/Stmt/Break_.php | 9 +-- lib/PhpParser/Node/Stmt/Case_.php | 9 +-- lib/PhpParser/Node/Stmt/Catch_.php | 7 +- lib/PhpParser/Node/Stmt/ClassConst.php | 15 ++-- lib/PhpParser/Node/Stmt/ClassLike.php | 11 ++- lib/PhpParser/Node/Stmt/ClassMethod.php | 27 +++---- lib/PhpParser/Node/Stmt/Class_.php | 15 ++-- lib/PhpParser/Node/Stmt/Const_.php | 9 +-- lib/PhpParser/Node/Stmt/Continue_.php | 9 +-- lib/PhpParser/Node/Stmt/DeclareDeclare.php | 9 +-- lib/PhpParser/Node/Stmt/Declare_.php | 9 +-- lib/PhpParser/Node/Stmt/Do_.php | 9 +-- lib/PhpParser/Node/Stmt/Echo_.php | 9 +-- lib/PhpParser/Node/Stmt/ElseIf_.php | 9 +-- lib/PhpParser/Node/Stmt/Else_.php | 9 +-- lib/PhpParser/Node/Stmt/EnumCase.php | 7 +- lib/PhpParser/Node/Stmt/Enum_.php | 7 +- lib/PhpParser/Node/Stmt/Expression.php | 9 +-- lib/PhpParser/Node/Stmt/Finally_.php | 9 +-- lib/PhpParser/Node/Stmt/For_.php | 9 +-- lib/PhpParser/Node/Stmt/Foreach_.php | 9 +-- lib/PhpParser/Node/Stmt/Function_.php | 15 ++-- lib/PhpParser/Node/Stmt/Global_.php | 9 +-- lib/PhpParser/Node/Stmt/Goto_.php | 9 +-- lib/PhpParser/Node/Stmt/GroupUse.php | 9 +-- lib/PhpParser/Node/Stmt/HaltCompiler.php | 9 +-- lib/PhpParser/Node/Stmt/If_.php | 9 +-- lib/PhpParser/Node/Stmt/InlineHTML.php | 9 +-- lib/PhpParser/Node/Stmt/Interface_.php | 7 +- lib/PhpParser/Node/Stmt/Label.php | 9 +-- lib/PhpParser/Node/Stmt/Namespace_.php | 9 +-- lib/PhpParser/Node/Stmt/Nop.php | 9 +-- lib/PhpParser/Node/Stmt/Property.php | 17 ++-- lib/PhpParser/Node/Stmt/PropertyProperty.php | 9 +-- lib/PhpParser/Node/Stmt/Return_.php | 9 +-- lib/PhpParser/Node/Stmt/StaticVar.php | 9 +-- lib/PhpParser/Node/Stmt/Static_.php | 9 +-- lib/PhpParser/Node/Stmt/Switch_.php | 9 +-- lib/PhpParser/Node/Stmt/Throw_.php | 9 +-- lib/PhpParser/Node/Stmt/TraitUse.php | 9 +-- .../Node/Stmt/TraitUseAdaptation.php | 3 +- .../Node/Stmt/TraitUseAdaptation/Alias.php | 9 +-- .../Stmt/TraitUseAdaptation/Precedence.php | 9 +-- lib/PhpParser/Node/Stmt/Trait_.php | 7 +- lib/PhpParser/Node/Stmt/TryCatch.php | 7 +- lib/PhpParser/Node/Stmt/Unset_.php | 9 +-- lib/PhpParser/Node/Stmt/UseUse.php | 11 ++- lib/PhpParser/Node/Stmt/Use_.php | 9 +-- lib/PhpParser/Node/Stmt/While_.php | 9 +-- lib/PhpParser/Node/UnionType.php | 9 +-- lib/PhpParser/Node/VarLikeIdentifier.php | 5 +- lib/PhpParser/NodeAbstract.php | 25 +++--- lib/PhpParser/NodeDumper.php | 5 +- lib/PhpParser/NodeFinder.php | 11 ++- lib/PhpParser/NodeTraverser.php | 9 +-- lib/PhpParser/NodeTraverserInterface.php | 5 +- lib/PhpParser/NodeVisitor.php | 3 +- lib/PhpParser/NodeVisitor/CloningVisitor.php | 3 +- lib/PhpParser/NodeVisitor/FindingVisitor.php | 5 +- .../NodeVisitor/FirstFindingVisitor.php | 3 +- lib/PhpParser/NodeVisitor/NameResolver.php | 18 ++--- .../NodeVisitor/NodeConnectingVisitor.php | 3 +- .../NodeVisitor/ParentConnectingVisitor.php | 17 ++-- lib/PhpParser/NodeVisitorAbstract.php | 3 +- lib/PhpParser/Parser.php | 3 +- lib/PhpParser/ParserAbstract.php | 25 +++--- lib/PhpParser/ParserFactory.php | 3 +- lib/PhpParser/PrettyPrinter/Standard.php | 16 ++-- lib/PhpParser/PrettyPrinterAbstract.php | 81 +++++++++++-------- 245 files changed, 1033 insertions(+), 1282 deletions(-) create mode 100644 .php-cs-fixer.dist.php diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..19efd866 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,22 @@ +exclude('PhpParser/Parser') + ->in(__DIR__ . '/lib') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + // We use PSR12 with consistent brace placement. + 'curly_braces_position' => [ + 'functions_opening_brace' => 'same_line', + 'classes_opening_brace' => 'same_line', + ], + // declare(strict_types=1) on the same line as false, + // Keep argument formatting for now. + 'method_argument_space' => ['on_multiline' => 'ignore'], + ]) + ->setFinder($finder) +; diff --git a/lib/PhpParser/Builder.php b/lib/PhpParser/Builder.php index 26d8921e..d6aa124c 100644 --- a/lib/PhpParser/Builder.php +++ b/lib/PhpParser/Builder.php @@ -2,12 +2,11 @@ namespace PhpParser; -interface Builder -{ +interface Builder { /** * Returns the built node. * * @return Node The built node */ - public function getNode() : Node; + public function getNode(): Node; } diff --git a/lib/PhpParser/Builder/ClassConst.php b/lib/PhpParser/Builder/ClassConst.php index 058cb23c..fc31cd93 100644 --- a/lib/PhpParser/Builder/ClassConst.php +++ b/lib/PhpParser/Builder/ClassConst.php @@ -12,8 +12,7 @@ use PhpParser\Node\Const_; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; -class ClassConst implements PhpParser\Builder -{ +class ClassConst implements PhpParser\Builder { protected $flags = 0; protected $attributes = []; protected $constants = []; diff --git a/lib/PhpParser/Builder/Class_.php b/lib/PhpParser/Builder/Class_.php index 38103eb9..6c58b542 100644 --- a/lib/PhpParser/Builder/Class_.php +++ b/lib/PhpParser/Builder/Class_.php @@ -9,8 +9,7 @@ use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt; -class Class_ extends Declaration -{ +class Class_ extends Declaration { protected $name; protected $extends = null; @@ -135,7 +134,7 @@ class Class_ extends Declaration * * @return Stmt\Class_ The built class node */ - public function getNode() : PhpParser\Node { + public function getNode(): PhpParser\Node { return new Stmt\Class_($this->name, [ 'flags' => $this->flags, 'extends' => $this->extends, diff --git a/lib/PhpParser/Builder/Declaration.php b/lib/PhpParser/Builder/Declaration.php index 83094992..df50cfb6 100644 --- a/lib/PhpParser/Builder/Declaration.php +++ b/lib/PhpParser/Builder/Declaration.php @@ -5,8 +5,7 @@ namespace PhpParser\Builder; use PhpParser; use PhpParser\BuilderHelpers; -abstract class Declaration implements PhpParser\Builder -{ +abstract class Declaration implements PhpParser\Builder { protected $attributes = []; abstract public function addStmt($stmt); diff --git a/lib/PhpParser/Builder/EnumCase.php b/lib/PhpParser/Builder/EnumCase.php index 02fa83e6..7856bcc2 100644 --- a/lib/PhpParser/Builder/EnumCase.php +++ b/lib/PhpParser/Builder/EnumCase.php @@ -10,8 +10,7 @@ use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; -class EnumCase implements PhpParser\Builder -{ +class EnumCase implements PhpParser\Builder { protected $name; protected $value = null; protected $attributes = []; diff --git a/lib/PhpParser/Builder/Enum_.php b/lib/PhpParser/Builder/Enum_.php index be7eef95..1b486943 100644 --- a/lib/PhpParser/Builder/Enum_.php +++ b/lib/PhpParser/Builder/Enum_.php @@ -9,8 +9,7 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Stmt; -class Enum_ extends Declaration -{ +class Enum_ extends Declaration { protected $name; protected $scalarType = null; @@ -106,7 +105,7 @@ class Enum_ extends Declaration * * @return Stmt\Enum_ The built enum node */ - public function getNode() : PhpParser\Node { + public function getNode(): PhpParser\Node { return new Stmt\Enum_($this->name, [ 'scalarType' => $this->scalarType, 'implements' => $this->implements, diff --git a/lib/PhpParser/Builder/FunctionLike.php b/lib/PhpParser/Builder/FunctionLike.php index 98ea9d33..1cb92fe0 100644 --- a/lib/PhpParser/Builder/FunctionLike.php +++ b/lib/PhpParser/Builder/FunctionLike.php @@ -5,8 +5,7 @@ namespace PhpParser\Builder; use PhpParser\BuilderHelpers; use PhpParser\Node; -abstract class FunctionLike extends Declaration -{ +abstract class FunctionLike extends Declaration { protected $returnByRef = false; protected $params = []; diff --git a/lib/PhpParser/Builder/Function_.php b/lib/PhpParser/Builder/Function_.php index 1cd73c0d..c7555160 100644 --- a/lib/PhpParser/Builder/Function_.php +++ b/lib/PhpParser/Builder/Function_.php @@ -7,8 +7,7 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Stmt; -class Function_ extends FunctionLike -{ +class Function_ extends FunctionLike { protected $name; protected $stmts = []; @@ -55,7 +54,7 @@ class Function_ extends FunctionLike * * @return Stmt\Function_ The built function node */ - public function getNode() : Node { + public function getNode(): Node { return new Stmt\Function_($this->name, [ 'byRef' => $this->returnByRef, 'params' => $this->params, diff --git a/lib/PhpParser/Builder/Interface_.php b/lib/PhpParser/Builder/Interface_.php index 7806e85f..585550d7 100644 --- a/lib/PhpParser/Builder/Interface_.php +++ b/lib/PhpParser/Builder/Interface_.php @@ -8,8 +8,7 @@ use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt; -class Interface_ extends Declaration -{ +class Interface_ extends Declaration { protected $name; protected $extends = []; protected $constants = []; @@ -83,7 +82,7 @@ class Interface_ extends Declaration * * @return Stmt\Interface_ The built interface node */ - public function getNode() : PhpParser\Node { + public function getNode(): PhpParser\Node { return new Stmt\Interface_($this->name, [ 'extends' => $this->extends, 'stmts' => array_merge($this->constants, $this->methods), diff --git a/lib/PhpParser/Builder/Method.php b/lib/PhpParser/Builder/Method.php index 68e7023e..fb4a1553 100644 --- a/lib/PhpParser/Builder/Method.php +++ b/lib/PhpParser/Builder/Method.php @@ -8,8 +8,7 @@ use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Stmt; -class Method extends FunctionLike -{ +class Method extends FunctionLike { protected $name; protected $flags = 0; @@ -134,7 +133,7 @@ class Method extends FunctionLike * * @return Stmt\ClassMethod The built method node */ - public function getNode() : Node { + public function getNode(): Node { return new Stmt\ClassMethod($this->name, [ 'flags' => $this->flags, 'byRef' => $this->returnByRef, diff --git a/lib/PhpParser/Builder/Namespace_.php b/lib/PhpParser/Builder/Namespace_.php index 1c751e16..ec7dc3ea 100644 --- a/lib/PhpParser/Builder/Namespace_.php +++ b/lib/PhpParser/Builder/Namespace_.php @@ -7,8 +7,7 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Stmt; -class Namespace_ extends Declaration -{ +class Namespace_ extends Declaration { private $name; private $stmts = []; @@ -39,7 +38,7 @@ class Namespace_ extends Declaration * * @return Stmt\Namespace_ The built node */ - public function getNode() : Node { + public function getNode(): Node { return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes); } } diff --git a/lib/PhpParser/Builder/Param.php b/lib/PhpParser/Builder/Param.php index 793fc933..7f2a41d2 100644 --- a/lib/PhpParser/Builder/Param.php +++ b/lib/PhpParser/Builder/Param.php @@ -6,8 +6,7 @@ use PhpParser; use PhpParser\BuilderHelpers; use PhpParser\Node; -class Param implements PhpParser\Builder -{ +class Param implements PhpParser\Builder { protected $name; protected $default = null; @@ -100,7 +99,7 @@ class Param implements PhpParser\Builder * * @return Node\Param The built parameter node */ - public function getNode() : Node { + public function getNode(): Node { return new Node\Param( new Node\Expr\Variable($this->name), $this->default, $this->type, $this->byRef, $this->variadic, [], 0, $this->attributeGroups diff --git a/lib/PhpParser/Builder/Property.php b/lib/PhpParser/Builder/Property.php index f8c352ad..2fd67a88 100644 --- a/lib/PhpParser/Builder/Property.php +++ b/lib/PhpParser/Builder/Property.php @@ -11,8 +11,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt; use PhpParser\Node\ComplexType; -class Property implements PhpParser\Builder -{ +class Property implements PhpParser\Builder { protected $name; protected $flags = 0; @@ -148,7 +147,7 @@ class Property implements PhpParser\Builder * * @return Stmt\Property The built property node */ - public function getNode() : PhpParser\Node { + public function getNode(): PhpParser\Node { return new Stmt\Property( $this->flags !== 0 ? $this->flags : Modifiers::PUBLIC, [ diff --git a/lib/PhpParser/Builder/TraitUse.php b/lib/PhpParser/Builder/TraitUse.php index 311e8cd7..17e8a447 100644 --- a/lib/PhpParser/Builder/TraitUse.php +++ b/lib/PhpParser/Builder/TraitUse.php @@ -7,8 +7,7 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Stmt; -class TraitUse implements Builder -{ +class TraitUse implements Builder { protected $traits = []; protected $adaptations = []; @@ -58,7 +57,7 @@ class TraitUse implements Builder * * @return Node The built node */ - public function getNode() : Node { + public function getNode(): Node { return new Stmt\TraitUse($this->traits, $this->adaptations); } } diff --git a/lib/PhpParser/Builder/TraitUseAdaptation.php b/lib/PhpParser/Builder/TraitUseAdaptation.php index d6d72624..b416429e 100644 --- a/lib/PhpParser/Builder/TraitUseAdaptation.php +++ b/lib/PhpParser/Builder/TraitUseAdaptation.php @@ -8,8 +8,7 @@ use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Stmt; -class TraitUseAdaptation implements Builder -{ +class TraitUseAdaptation implements Builder { public const TYPE_UNDEFINED = 0; public const TYPE_ALIAS = 1; public const TYPE_PRECEDENCE = 2; @@ -34,7 +33,7 @@ class TraitUseAdaptation implements Builder public function __construct($trait, $method) { $this->type = self::TYPE_UNDEFINED; - $this->trait = is_null($trait)? null: BuilderHelpers::normalizeName($trait); + $this->trait = is_null($trait) ? null : BuilderHelpers::normalizeName($trait); $this->method = BuilderHelpers::normalizeIdentifier($method); } @@ -136,7 +135,7 @@ class TraitUseAdaptation implements Builder * * @return Node The built node */ - public function getNode() : Node { + public function getNode(): Node { switch ($this->type) { case self::TYPE_ALIAS: return new Stmt\TraitUseAdaptation\Alias($this->trait, $this->method, $this->modifier, $this->alias); diff --git a/lib/PhpParser/Builder/Trait_.php b/lib/PhpParser/Builder/Trait_.php index 97f32f98..92d66949 100644 --- a/lib/PhpParser/Builder/Trait_.php +++ b/lib/PhpParser/Builder/Trait_.php @@ -7,8 +7,7 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Stmt; -class Trait_ extends Declaration -{ +class Trait_ extends Declaration { protected $name; protected $uses = []; protected $properties = []; @@ -67,7 +66,7 @@ class Trait_ extends Declaration * * @return Stmt\Trait_ The built interface node */ - public function getNode() : PhpParser\Node { + public function getNode(): PhpParser\Node { return new Stmt\Trait_( $this->name, [ 'stmts' => array_merge($this->uses, $this->properties, $this->methods), diff --git a/lib/PhpParser/Builder/Use_.php b/lib/PhpParser/Builder/Use_.php index 4bd3d12d..7caed263 100644 --- a/lib/PhpParser/Builder/Use_.php +++ b/lib/PhpParser/Builder/Use_.php @@ -7,8 +7,7 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Stmt; -class Use_ implements Builder -{ +class Use_ implements Builder { protected $name; protected $type; protected $alias = null; @@ -41,7 +40,7 @@ class Use_ implements Builder * * @return Stmt\Use_ The built node */ - public function getNode() : Node { + public function getNode(): Node { return new Stmt\Use_([ new Stmt\UseUse($this->name, $this->alias) ], $this->type); diff --git a/lib/PhpParser/BuilderFactory.php b/lib/PhpParser/BuilderFactory.php index fef2579b..4e77f857 100644 --- a/lib/PhpParser/BuilderFactory.php +++ b/lib/PhpParser/BuilderFactory.php @@ -10,8 +10,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Use_; -class BuilderFactory -{ +class BuilderFactory { /** * Creates an attribute node. * @@ -20,7 +19,7 @@ class BuilderFactory * * @return Node\Attribute */ - public function attribute($name, array $args = []) : Node\Attribute { + public function attribute($name, array $args = []): Node\Attribute { return new Node\Attribute( BuilderHelpers::normalizeName($name), $this->args($args) @@ -34,7 +33,7 @@ class BuilderFactory * * @return Builder\Namespace_ The created namespace builder */ - public function namespace($name) : Builder\Namespace_ { + public function namespace($name): Builder\Namespace_ { return new Builder\Namespace_($name); } @@ -45,7 +44,7 @@ class BuilderFactory * * @return Builder\Class_ The created class builder */ - public function class(string $name) : Builder\Class_ { + public function class(string $name): Builder\Class_ { return new Builder\Class_($name); } @@ -56,7 +55,7 @@ class BuilderFactory * * @return Builder\Interface_ The created interface builder */ - public function interface(string $name) : Builder\Interface_ { + public function interface(string $name): Builder\Interface_ { return new Builder\Interface_($name); } @@ -67,7 +66,7 @@ class BuilderFactory * * @return Builder\Trait_ The created trait builder */ - public function trait(string $name) : Builder\Trait_ { + public function trait(string $name): Builder\Trait_ { return new Builder\Trait_($name); } @@ -78,7 +77,7 @@ class BuilderFactory * * @return Builder\Enum_ The created enum builder */ - public function enum(string $name) : Builder\Enum_ { + public function enum(string $name): Builder\Enum_ { return new Builder\Enum_($name); } @@ -89,7 +88,7 @@ class BuilderFactory * * @return Builder\TraitUse The create trait use builder */ - public function useTrait(...$traits) : Builder\TraitUse { + public function useTrait(...$traits): Builder\TraitUse { return new Builder\TraitUse(...$traits); } @@ -101,7 +100,7 @@ class BuilderFactory * * @return Builder\TraitUseAdaptation The create trait use adaptation builder */ - public function traitUseAdaptation($trait, $method = null) : Builder\TraitUseAdaptation { + public function traitUseAdaptation($trait, $method = null): Builder\TraitUseAdaptation { if ($method === null) { $method = $trait; $trait = null; @@ -117,7 +116,7 @@ class BuilderFactory * * @return Builder\Method The created method builder */ - public function method(string $name) : Builder\Method { + public function method(string $name): Builder\Method { return new Builder\Method($name); } @@ -128,7 +127,7 @@ class BuilderFactory * * @return Builder\Param The created parameter builder */ - public function param(string $name) : Builder\Param { + public function param(string $name): Builder\Param { return new Builder\Param($name); } @@ -139,7 +138,7 @@ class BuilderFactory * * @return Builder\Property The created property builder */ - public function property(string $name) : Builder\Property { + public function property(string $name): Builder\Property { return new Builder\Property($name); } @@ -150,7 +149,7 @@ class BuilderFactory * * @return Builder\Function_ The created function builder */ - public function function(string $name) : Builder\Function_ { + public function function(string $name): Builder\Function_ { return new Builder\Function_($name); } @@ -161,7 +160,7 @@ class BuilderFactory * * @return Builder\Use_ The created use builder */ - public function use($name) : Builder\Use_ { + public function use($name): Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_NORMAL); } @@ -172,7 +171,7 @@ class BuilderFactory * * @return Builder\Use_ The created use function builder */ - public function useFunction($name) : Builder\Use_ { + public function useFunction($name): Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_FUNCTION); } @@ -183,7 +182,7 @@ class BuilderFactory * * @return Builder\Use_ The created use const builder */ - public function useConst($name) : Builder\Use_ { + public function useConst($name): Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_CONSTANT); } @@ -195,7 +194,7 @@ class BuilderFactory * * @return Builder\ClassConst The created use const builder */ - public function classConst($name, $value) : Builder\ClassConst { + public function classConst($name, $value): Builder\ClassConst { return new Builder\ClassConst($name, $value); } @@ -206,7 +205,7 @@ class BuilderFactory * * @return Builder\EnumCase The created use const builder */ - public function enumCase($name) : Builder\EnumCase { + public function enumCase($name): Builder\EnumCase { return new Builder\EnumCase($name); } @@ -217,7 +216,7 @@ class BuilderFactory * * @return Expr */ - public function val($value) : Expr { + public function val($value): Expr { return BuilderHelpers::normalizeValue($value); } @@ -228,7 +227,7 @@ class BuilderFactory * * @return Expr\Variable */ - public function var($name) : Expr\Variable { + public function var($name): Expr\Variable { if (!\is_string($name) && !$name instanceof Expr) { throw new \LogicException('Variable name must be string or Expr'); } @@ -245,7 +244,7 @@ class BuilderFactory * * @return Arg[] */ - public function args(array $args) : array { + public function args(array $args): array { $normalizedArgs = []; foreach ($args as $key => $arg) { if (!($arg instanceof Arg)) { @@ -267,7 +266,7 @@ class BuilderFactory * * @return Expr\FuncCall */ - public function funcCall($name, array $args = []) : Expr\FuncCall { + public function funcCall($name, array $args = []): Expr\FuncCall { return new Expr\FuncCall( BuilderHelpers::normalizeNameOrExpr($name), $this->args($args) @@ -283,7 +282,7 @@ class BuilderFactory * * @return Expr\MethodCall */ - public function methodCall(Expr $var, $name, array $args = []) : Expr\MethodCall { + public function methodCall(Expr $var, $name, array $args = []): Expr\MethodCall { return new Expr\MethodCall( $var, BuilderHelpers::normalizeIdentifierOrExpr($name), @@ -300,7 +299,7 @@ class BuilderFactory * * @return Expr\StaticCall */ - public function staticCall($class, $name, array $args = []) : Expr\StaticCall { + public function staticCall($class, $name, array $args = []): Expr\StaticCall { return new Expr\StaticCall( BuilderHelpers::normalizeNameOrExpr($class), BuilderHelpers::normalizeIdentifierOrExpr($name), @@ -316,7 +315,7 @@ class BuilderFactory * * @return Expr\New_ */ - public function new($class, array $args = []) : Expr\New_ { + public function new($class, array $args = []): Expr\New_ { return new Expr\New_( BuilderHelpers::normalizeNameOrExpr($class), $this->args($args) @@ -330,7 +329,7 @@ class BuilderFactory * * @return Expr\ConstFetch */ - public function constFetch($name) : Expr\ConstFetch { + public function constFetch($name): Expr\ConstFetch { return new Expr\ConstFetch(BuilderHelpers::normalizeName($name)); } @@ -342,7 +341,7 @@ class BuilderFactory * * @return Expr\PropertyFetch */ - public function propertyFetch(Expr $var, $name) : Expr\PropertyFetch { + public function propertyFetch(Expr $var, $name): Expr\PropertyFetch { return new Expr\PropertyFetch($var, BuilderHelpers::normalizeIdentifierOrExpr($name)); } @@ -368,7 +367,7 @@ class BuilderFactory * * @return Concat */ - public function concat(...$exprs) : Concat { + public function concat(...$exprs): Concat { $numExprs = count($exprs); if ($numExprs < 2) { throw new \LogicException('Expected at least two expressions'); @@ -385,7 +384,7 @@ class BuilderFactory * @param string|Expr $expr * @return Expr */ - private function normalizeStringExpr($expr) : Expr { + private function normalizeStringExpr($expr): Expr { if ($expr instanceof Expr) { return $expr; } diff --git a/lib/PhpParser/BuilderHelpers.php b/lib/PhpParser/BuilderHelpers.php index af6ceb99..069def81 100644 --- a/lib/PhpParser/BuilderHelpers.php +++ b/lib/PhpParser/BuilderHelpers.php @@ -15,8 +15,7 @@ use PhpParser\Node\Stmt; * * @internal */ -final class BuilderHelpers -{ +final class BuilderHelpers { /** * Normalizes a node: Converts builder objects to nodes. * @@ -24,7 +23,7 @@ final class BuilderHelpers * * @return Node The normalized node */ - public static function normalizeNode($node) : Node { + public static function normalizeNode($node): Node { if ($node instanceof Builder) { return $node->getNode(); } @@ -45,7 +44,7 @@ final class BuilderHelpers * * @return Stmt The normalized statement node */ - public static function normalizeStmt($node) : Stmt { + public static function normalizeStmt($node): Stmt { $node = self::normalizeNode($node); if ($node instanceof Stmt) { return $node; @@ -65,7 +64,7 @@ final class BuilderHelpers * * @return Identifier The normalized identifier */ - public static function normalizeIdentifier($name) : Identifier { + public static function normalizeIdentifier($name): Identifier { if ($name instanceof Identifier) { return $name; } @@ -103,7 +102,7 @@ final class BuilderHelpers * * @return Name The normalized name */ - public static function normalizeName($name) : Name { + public static function normalizeName($name): Name { if ($name instanceof Name) { return $name; } @@ -219,7 +218,7 @@ final class BuilderHelpers * * @return Expr The normalized value */ - public static function normalizeValue($value) : Expr { + public static function normalizeValue($value): Expr { if ($value instanceof Node\Expr) { return $value; } @@ -279,7 +278,7 @@ final class BuilderHelpers * * @return Comment\Doc The normalized doc comment */ - public static function normalizeDocComment($docComment) : Comment\Doc { + public static function normalizeDocComment($docComment): Comment\Doc { if ($docComment instanceof Comment\Doc) { return $docComment; } @@ -298,8 +297,7 @@ final class BuilderHelpers * * @return Node\AttributeGroup The Attribute Group */ - public static function normalizeAttribute($attribute) : Node\AttributeGroup - { + public static function normalizeAttribute($attribute): Node\AttributeGroup { if ($attribute instanceof Node\AttributeGroup) { return $attribute; } @@ -319,7 +317,7 @@ final class BuilderHelpers * * @return int New modifiers */ - public static function addModifier(int $modifiers, int $modifier) : int { + public static function addModifier(int $modifiers, int $modifier): int { Stmt\Class_::verifyModifier($modifiers, $modifier); return $modifiers | $modifier; } @@ -328,7 +326,7 @@ final class BuilderHelpers * Adds a modifier and returns new modifier bitmask. * @return int New modifiers */ - public static function addClassModifier(int $existingModifiers, int $modifierToSet) : int { + public static function addClassModifier(int $existingModifiers, int $modifierToSet): int { Stmt\Class_::verifyClassModifier($existingModifiers, $modifierToSet); return $existingModifiers | $modifierToSet; } diff --git a/lib/PhpParser/Comment.php b/lib/PhpParser/Comment.php index 7e6e41a5..2cc491b8 100644 --- a/lib/PhpParser/Comment.php +++ b/lib/PhpParser/Comment.php @@ -2,8 +2,7 @@ namespace PhpParser; -class Comment implements \JsonSerializable -{ +class Comment implements \JsonSerializable { protected $text; protected $startLine; protected $startFilePos; @@ -39,7 +38,7 @@ class Comment implements \JsonSerializable * * @return string The comment text (including comment delimiters like /*) */ - public function getText() : string { + public function getText(): string { return $this->text; } @@ -48,7 +47,7 @@ class Comment implements \JsonSerializable * * @return int Line number (or -1 if not available) */ - public function getStartLine() : int { + public function getStartLine(): int { return $this->startLine; } @@ -57,7 +56,7 @@ class Comment implements \JsonSerializable * * @return int File offset (or -1 if not available) */ - public function getStartFilePos() : int { + public function getStartFilePos(): int { return $this->startFilePos; } @@ -66,7 +65,7 @@ class Comment implements \JsonSerializable * * @return int Token offset (or -1 if not available) */ - public function getStartTokenPos() : int { + public function getStartTokenPos(): int { return $this->startTokenPos; } @@ -75,7 +74,7 @@ class Comment implements \JsonSerializable * * @return int Line number (or -1 if not available) */ - public function getEndLine() : int { + public function getEndLine(): int { return $this->endLine; } @@ -84,7 +83,7 @@ class Comment implements \JsonSerializable * * @return int File offset (or -1 if not available) */ - public function getEndFilePos() : int { + public function getEndFilePos(): int { return $this->endFilePos; } @@ -93,7 +92,7 @@ class Comment implements \JsonSerializable * * @return int Token offset (or -1 if not available) */ - public function getEndTokenPos() : int { + public function getEndTokenPos(): int { return $this->endTokenPos; } @@ -104,7 +103,7 @@ class Comment implements \JsonSerializable * * @return int Line number */ - public function getLine() : int { + public function getLine(): int { return $this->startLine; } @@ -115,7 +114,7 @@ class Comment implements \JsonSerializable * * @return int File offset */ - public function getFilePos() : int { + public function getFilePos(): int { return $this->startFilePos; } @@ -126,7 +125,7 @@ class Comment implements \JsonSerializable * * @return int Token offset */ - public function getTokenPos() : int { + public function getTokenPos(): int { return $this->startTokenPos; } @@ -135,7 +134,7 @@ class Comment implements \JsonSerializable * * @return string The comment text (including comment delimiters like /*) */ - public function __toString() : string { + public function __toString(): string { return $this->text; } @@ -207,7 +206,7 @@ class Comment implements \JsonSerializable * @param string $str String to check * @return int Length in characters. Tabs count as single characters. */ - private function getShortestWhitespacePrefixLen(string $str) : int { + private function getShortestWhitespacePrefixLen(string $str): int { $lines = explode("\n", $str); $shortestPrefixLen = \INF; foreach ($lines as $line) { @@ -224,7 +223,7 @@ class Comment implements \JsonSerializable * @return array * @psalm-return array{nodeType:string, text:mixed, line:mixed, filePos:mixed} */ - public function jsonSerialize() : array { + public function jsonSerialize(): array { // Technically not a node, but we make it look like one anyway $type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment'; return [ diff --git a/lib/PhpParser/Comment/Doc.php b/lib/PhpParser/Comment/Doc.php index a9db6128..bb3e9146 100644 --- a/lib/PhpParser/Comment/Doc.php +++ b/lib/PhpParser/Comment/Doc.php @@ -2,6 +2,5 @@ namespace PhpParser\Comment; -class Doc extends \PhpParser\Comment -{ +class Doc extends \PhpParser\Comment { } diff --git a/lib/PhpParser/ConstExprEvaluationException.php b/lib/PhpParser/ConstExprEvaluationException.php index ce5f9b2b..7964058a 100644 --- a/lib/PhpParser/ConstExprEvaluationException.php +++ b/lib/PhpParser/ConstExprEvaluationException.php @@ -2,5 +2,5 @@ namespace PhpParser; -class ConstExprEvaluationException extends \Exception -{} +class ConstExprEvaluationException extends \Exception { +} diff --git a/lib/PhpParser/ConstExprEvaluator.php b/lib/PhpParser/ConstExprEvaluator.php index 06b73cc8..09328880 100644 --- a/lib/PhpParser/ConstExprEvaluator.php +++ b/lib/PhpParser/ConstExprEvaluator.php @@ -2,10 +2,11 @@ namespace PhpParser; -use function array_merge; use PhpParser\Node\Expr; use PhpParser\Node\Scalar; +use function array_merge; + /** * Evaluates constant expressions. * @@ -25,8 +26,7 @@ use PhpParser\Node\Scalar; * point to string conversions are affected by the precision ini setting. Secondly, they are also * affected by the LC_NUMERIC locale. */ -class ConstExprEvaluator -{ +class ConstExprEvaluator { private $fallbackEvaluator; /** @@ -38,7 +38,7 @@ class ConstExprEvaluator * @param callable|null $fallbackEvaluator To call if subexpression cannot be evaluated */ public function __construct(?callable $fallbackEvaluator = null) { - $this->fallbackEvaluator = $fallbackEvaluator ?? function(Expr $expr) { + $this->fallbackEvaluator = $fallbackEvaluator ?? function (Expr $expr) { throw new ConstExprEvaluationException( "Expression of type {$expr->getType()} cannot be evaluated" ); @@ -63,7 +63,7 @@ class ConstExprEvaluator * @throws ConstExprEvaluationException if the expression cannot be evaluated or an error occurred */ public function evaluateSilently(Expr $expr) { - set_error_handler(function($num, $str, $file, $line) { + set_error_handler(function ($num, $str, $file, $line) { throw new \ErrorException($str, 0, $num, $file, $line); }); diff --git a/lib/PhpParser/Error.php b/lib/PhpParser/Error.php index d1fb959d..12a7724d 100644 --- a/lib/PhpParser/Error.php +++ b/lib/PhpParser/Error.php @@ -2,8 +2,7 @@ namespace PhpParser; -class Error extends \RuntimeException -{ +class Error extends \RuntimeException { protected $rawMessage; protected $attributes; @@ -29,7 +28,7 @@ class Error extends \RuntimeException * * @return string Error message */ - public function getRawMessage() : string { + public function getRawMessage(): string { return $this->rawMessage; } @@ -38,7 +37,7 @@ class Error extends \RuntimeException * * @return int Error start line */ - public function getStartLine() : int { + public function getStartLine(): int { return $this->attributes['startLine'] ?? -1; } @@ -47,7 +46,7 @@ class Error extends \RuntimeException * * @return int Error end line */ - public function getEndLine() : int { + public function getEndLine(): int { return $this->attributes['endLine'] ?? -1; } @@ -56,7 +55,7 @@ class Error extends \RuntimeException * * @return array */ - public function getAttributes() : array { + public function getAttributes(): array { return $this->attributes; } @@ -97,7 +96,7 @@ class Error extends \RuntimeException * * @return bool */ - public function hasColumnInfo() : bool { + public function hasColumnInfo(): bool { return isset($this->attributes['startFilePos'], $this->attributes['endFilePos']); } @@ -107,7 +106,7 @@ class Error extends \RuntimeException * @param string $code Source code of the file * @return int */ - public function getStartColumn(string $code) : int { + public function getStartColumn(string $code): int { if (!$this->hasColumnInfo()) { throw new \RuntimeException('Error does not have column information'); } @@ -121,7 +120,7 @@ class Error extends \RuntimeException * @param string $code Source code of the file * @return int */ - public function getEndColumn(string $code) : int { + public function getEndColumn(string $code): int { if (!$this->hasColumnInfo()) { throw new \RuntimeException('Error does not have column information'); } @@ -136,7 +135,7 @@ class Error extends \RuntimeException * * @return string Formatted message */ - public function getMessageWithColumnInfo(string $code) : string { + public function getMessageWithColumnInfo(string $code): string { return sprintf( '%s from %d:%d to %d:%d', $this->getRawMessage(), $this->getStartLine(), $this->getStartColumn($code), @@ -152,7 +151,7 @@ class Error extends \RuntimeException * * @return int 1-based column (relative to start of line) */ - private function toColumn(string $code, int $pos) : int { + private function toColumn(string $code, int $pos): int { if ($pos > strlen($code)) { throw new \RuntimeException('Invalid position information'); } diff --git a/lib/PhpParser/ErrorHandler.php b/lib/PhpParser/ErrorHandler.php index d620e745..96d58706 100644 --- a/lib/PhpParser/ErrorHandler.php +++ b/lib/PhpParser/ErrorHandler.php @@ -2,8 +2,7 @@ namespace PhpParser; -interface ErrorHandler -{ +interface ErrorHandler { /** * Handle an error generated during lexing, parsing or some other operation. * diff --git a/lib/PhpParser/ErrorHandler/Collecting.php b/lib/PhpParser/ErrorHandler/Collecting.php index 784b61b1..5eff5fac 100644 --- a/lib/PhpParser/ErrorHandler/Collecting.php +++ b/lib/PhpParser/ErrorHandler/Collecting.php @@ -10,8 +10,7 @@ use PhpParser\ErrorHandler; * * This allows graceful handling of errors. */ -class Collecting implements ErrorHandler -{ +class Collecting implements ErrorHandler { /** @var Error[] Collected errors */ private $errors = []; @@ -24,7 +23,7 @@ class Collecting implements ErrorHandler * * @return Error[] */ - public function getErrors() : array { + public function getErrors(): array { return $this->errors; } @@ -33,7 +32,7 @@ class Collecting implements ErrorHandler * * @return bool */ - public function hasErrors() : bool { + public function hasErrors(): bool { return !empty($this->errors); } diff --git a/lib/PhpParser/ErrorHandler/Throwing.php b/lib/PhpParser/ErrorHandler/Throwing.php index aeee989b..da6cb25f 100644 --- a/lib/PhpParser/ErrorHandler/Throwing.php +++ b/lib/PhpParser/ErrorHandler/Throwing.php @@ -10,8 +10,7 @@ use PhpParser\ErrorHandler; * * This is the default strategy used by all components. */ -class Throwing implements ErrorHandler -{ +class Throwing implements ErrorHandler { public function handleError(Error $error) { throw $error; } diff --git a/lib/PhpParser/Internal/DiffElem.php b/lib/PhpParser/Internal/DiffElem.php index a26d557a..d10409f4 100644 --- a/lib/PhpParser/Internal/DiffElem.php +++ b/lib/PhpParser/Internal/DiffElem.php @@ -5,8 +5,7 @@ namespace PhpParser\Internal; /** * @internal */ -class DiffElem -{ +class DiffElem { public const TYPE_KEEP = 0; public const TYPE_REMOVE = 1; public const TYPE_ADD = 2; diff --git a/lib/PhpParser/Internal/Differ.php b/lib/PhpParser/Internal/Differ.php index 8c919699..dff59773 100644 --- a/lib/PhpParser/Internal/Differ.php +++ b/lib/PhpParser/Internal/Differ.php @@ -10,8 +10,7 @@ namespace PhpParser\Internal; * * @internal */ -class Differ -{ +class Differ { private $isEqual; /** diff --git a/lib/PhpParser/Internal/PrintableNewAnonClassNode.php b/lib/PhpParser/Internal/PrintableNewAnonClassNode.php index bc84b880..d4b31c15 100644 --- a/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +++ b/lib/PhpParser/Internal/PrintableNewAnonClassNode.php @@ -15,8 +15,7 @@ use PhpParser\Node\Expr; * * @internal */ -class PrintableNewAnonClassNode extends Expr -{ +class PrintableNewAnonClassNode extends Expr { /** @var Node\AttributeGroup[] PHP attribute groups */ public $attrGroups; /** @var Node\Arg[] Arguments */ @@ -51,11 +50,11 @@ class PrintableNewAnonClassNode extends Expr ); } - public function getType() : string { + public function getType(): string { return 'Expr_PrintableNewAnonClass'; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'args', 'extends', 'implements', 'stmts']; } } diff --git a/lib/PhpParser/Internal/TokenPolyfill.php b/lib/PhpParser/Internal/TokenPolyfill.php index ba414dc8..f854fb92 100644 --- a/lib/PhpParser/Internal/TokenPolyfill.php +++ b/lib/PhpParser/Internal/TokenPolyfill.php @@ -3,7 +3,8 @@ namespace PhpParser\Internal; if (\PHP_VERSION_ID >= 80000) { - class TokenPolyfill extends \PhpToken {} + class TokenPolyfill extends \PhpToken { + } return; } @@ -78,7 +79,7 @@ class TokenPolyfill { if ($this->id === $entry) { return true; } - } else if (\is_string($entry)) { + } elseif (\is_string($entry)) { if ($this->text === $entry) { return true; } @@ -196,7 +197,7 @@ class TokenPolyfill { if ($j > $i + 1) { if ($id === \T_NS_SEPARATOR) { $id = \T_NAME_FULLY_QUALIFIED; - } else if ($id === \T_NAMESPACE) { + } elseif ($id === \T_NAMESPACE) { $id = \T_NAME_RELATIVE; } else { $id = \T_NAME_QUALIFIED; diff --git a/lib/PhpParser/Internal/TokenStream.php b/lib/PhpParser/Internal/TokenStream.php index 87d0773d..72a28dca 100644 --- a/lib/PhpParser/Internal/TokenStream.php +++ b/lib/PhpParser/Internal/TokenStream.php @@ -9,8 +9,7 @@ use PhpParser\Token; * * @internal */ -class TokenStream -{ +class TokenStream { /** @var Token[] Tokens (in PhpToken::tokenize() format) */ private $tokens; /** @var int[] Map from position to indentation */ @@ -34,7 +33,7 @@ class TokenStream * * @return bool */ - public function haveParens(int $startPos, int $endPos) : bool { + public function haveParens(int $startPos, int $endPos): bool { return $this->haveTokenImmediatelyBefore($startPos, '(') && $this->haveTokenImmediatelyAfter($endPos, ')'); } @@ -47,7 +46,7 @@ class TokenStream * * @return bool */ - public function haveBraces(int $startPos, int $endPos) : bool { + public function haveBraces(int $startPos, int $endPos): bool { return ($this->haveTokenImmediatelyBefore($startPos, '{') || $this->haveTokenImmediatelyBefore($startPos, T_CURLY_OPEN)) && $this->haveTokenImmediatelyAfter($endPos, '}'); @@ -63,7 +62,7 @@ class TokenStream * * @return bool Whether the expected token was found */ - public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType) : bool { + public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType): bool { $tokens = $this->tokens; $pos--; for (; $pos >= 0; $pos--) { @@ -88,7 +87,7 @@ class TokenStream * * @return bool Whether the expected token was found */ - public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType) : bool { + public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType): bool { $tokens = $this->tokens; $pos++; for ($c = \count($tokens); $pos < $c; $pos++) { @@ -210,7 +209,7 @@ class TokenStream * * @return int Indentation depth (in spaces) */ - public function getIndentationBefore(int $pos) : int { + public function getIndentationBefore(int $pos): int { return $this->indentMap[$pos]; } @@ -223,7 +222,7 @@ class TokenStream * * @return string Code corresponding to token range, adjusted for indentation */ - public function getTokenCode(int $from, int $to, int $indent) : string { + public function getTokenCode(int $from, int $to, int $indent): string { $tokens = $this->tokens; $result = ''; for ($pos = $from; $pos < $to; $pos++) { diff --git a/lib/PhpParser/JsonDecoder.php b/lib/PhpParser/JsonDecoder.php index 47d2003d..fa9d6619 100644 --- a/lib/PhpParser/JsonDecoder.php +++ b/lib/PhpParser/JsonDecoder.php @@ -2,8 +2,7 @@ namespace PhpParser; -class JsonDecoder -{ +class JsonDecoder { /** @var \ReflectionClass[] Node type to reflection class map */ private $reflectionClassCache; @@ -29,7 +28,7 @@ class JsonDecoder return $value; } - private function decodeArray(array $array) : array { + private function decodeArray(array $array): array { $decodedArray = []; foreach ($array as $key => $value) { $decodedArray[$key] = $this->decodeRecursive($value); @@ -37,7 +36,7 @@ class JsonDecoder return $decodedArray; } - private function decodeNode(array $value) : Node { + private function decodeNode(array $value): Node { $nodeType = $value['nodeType']; if (!\is_string($nodeType)) { throw new \RuntimeException('Node type must be a string'); @@ -66,7 +65,7 @@ class JsonDecoder return $node; } - private function decodeComment(array $value) : Comment { + private function decodeComment(array $value): Comment { $className = $value['nodeType'] === 'Comment' ? Comment::class : Comment\Doc::class; if (!isset($value['text'])) { throw new \RuntimeException('Comment must have text'); @@ -79,7 +78,7 @@ class JsonDecoder ); } - private function reflectionClassFromNodeType(string $nodeType) : \ReflectionClass { + private function reflectionClassFromNodeType(string $nodeType): \ReflectionClass { if (!isset($this->reflectionClassCache[$nodeType])) { $className = $this->classNameFromNodeType($nodeType); $this->reflectionClassCache[$nodeType] = new \ReflectionClass($className); @@ -87,7 +86,7 @@ class JsonDecoder return $this->reflectionClassCache[$nodeType]; } - private function classNameFromNodeType(string $nodeType) : string { + private function classNameFromNodeType(string $nodeType): string { $className = 'PhpParser\\Node\\' . strtr($nodeType, '_', '\\'); if (class_exists($className)) { return $className; diff --git a/lib/PhpParser/Lexer.php b/lib/PhpParser/Lexer.php index 3c28bafc..842852af 100644 --- a/lib/PhpParser/Lexer.php +++ b/lib/PhpParser/Lexer.php @@ -6,8 +6,7 @@ use PhpParser\Parser\Tokens; require __DIR__ . '/compatibility_tokens.php'; -class Lexer -{ +class Lexer { /** @var string Code being tokenized */ protected $code; /** @var Token[] Array of tokens */ diff --git a/lib/PhpParser/Lexer/Emulative.php b/lib/PhpParser/Lexer/Emulative.php index c1bc947a..39d8d264 100644 --- a/lib/PhpParser/Lexer/Emulative.php +++ b/lib/PhpParser/Lexer/Emulative.php @@ -19,8 +19,7 @@ use PhpParser\Lexer\TokenEmulator\ReverseEmulator; use PhpParser\Lexer\TokenEmulator\TokenEmulator; use PhpParser\PhpVersion; -class Emulative extends Lexer -{ +class Emulative extends Lexer { /** @var mixed[] Patches used to reverse changes introduced in the code */ private $patches = []; @@ -37,8 +36,7 @@ class Emulative extends Lexer * 'phpVersion' (PhpVersion object or string) that specifies the * version to emulate. Defaults to newest supported. */ - public function __construct(array $options = []) - { + public function __construct(array $options = []) { $version = $options['phpVersion'] ?? PhpVersion::getNewestSupported(); if (!$version instanceof PhpVersion) { $version = PhpVersion::fromString($version); @@ -68,14 +66,14 @@ class Emulative extends Lexer $emulatorPhpVersion = $emulator->getPhpVersion(); if ($this->isForwardEmulationNeeded($emulatorPhpVersion)) { $this->emulators[] = $emulator; - } else if ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { + } elseif ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { $this->emulators[] = new ReverseEmulator($emulator); } } } public function startLexing(string $code, ?ErrorHandler $errorHandler = null) { - $emulators = array_filter($this->emulators, function($emulator) use($code) { + $emulators = array_filter($this->emulators, function ($emulator) use ($code) { return $emulator->isEmulationNeeded($code); }); @@ -118,17 +116,15 @@ class Emulative extends Lexer && $this->targetPhpVersion->older($emulatorPhpVersion); } - private function sortPatches() - { + private function sortPatches() { // Patches may be contributed by different emulators. // Make sure they are sorted by increasing patch position. - usort($this->patches, function($p1, $p2) { + usort($this->patches, function ($p1, $p2) { return $p1[0] <=> $p2[0]; }); } - private function fixupTokens() - { + private function fixupTokens() { if (\count($this->patches) === 0) { return; } @@ -166,7 +162,7 @@ class Emulative extends Lexer $token->text, $patchText, $patchPos - $pos + $localPosDelta, 0 ); $localPosDelta += $patchTextLen; - } else if ($patchType === 'replace') { + } elseif ($patchType === 'replace') { // Replace inside the token string $token->text = substr_replace( $token->text, $patchText, $patchPos - $pos + $localPosDelta, $patchTextLen @@ -211,7 +207,7 @@ class Emulative extends Lexer if ($patchType === 'add') { $posDelta += strlen($patchText); $lineDelta += substr_count($patchText, "\n"); - } else if ($patchType === 'remove') { + } elseif ($patchType === 'remove') { $posDelta -= strlen($patchText); $lineDelta -= substr_count($patchText, "\n"); } diff --git a/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php index b24387bb..2c12f33a 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php @@ -5,20 +5,16 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; use PhpParser\Token; -final class AttributeEmulator extends TokenEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class AttributeEmulator extends TokenEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(8, 0); } - public function isEmulationNeeded(string $code) : bool - { + public function isEmulationNeeded(string $code): bool { return strpos($code, '#[') !== false; } - public function emulate(string $code, array $tokens): array - { + public function emulate(string $code, array $tokens): array { // We need to manually iterate and manage a count because we'll change // the tokens array on the way. for ($i = 0, $c = count($tokens); $i < $c; ++$i) { @@ -35,8 +31,7 @@ final class AttributeEmulator extends TokenEmulator return $tokens; } - public function reverseEmulate(string $code, array $tokens): array - { + public function reverseEmulate(string $code, array $tokens): array { // TODO return $tokens; } diff --git a/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php index 6b754a5b..99c98876 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php @@ -5,20 +5,16 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; use PhpParser\Token; -final class CoaleseEqualTokenEmulator extends TokenEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class CoaleseEqualTokenEmulator extends TokenEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(7, 4); } - public function isEmulationNeeded(string $code): bool - { + public function isEmulationNeeded(string $code): bool { return strpos($code, '??=') !== false; } - public function emulate(string $code, array $tokens): array - { + public function emulate(string $code, array $tokens): array { // We need to manually iterate and manage a count because we'll change // the tokens array on the way for ($i = 0, $c = count($tokens); $i < $c; ++$i) { @@ -37,8 +33,7 @@ final class CoaleseEqualTokenEmulator extends TokenEmulator return $tokens; } - public function reverseEmulate(string $code, array $tokens): array - { + public function reverseEmulate(string $code, array $tokens): array { // ??= was not valid code previously, don't bother. return $tokens; } diff --git a/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php index 79f37024..5418f52c 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php @@ -4,25 +4,20 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; -final class EnumTokenEmulator extends KeywordEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class EnumTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(8, 1); } - public function getKeywordString(): string - { + public function getKeywordString(): string { return 'enum'; } - public function getKeywordToken(): int - { + public function getKeywordToken(): int { return \T_ENUM; } - protected function isKeywordContext(array $tokens, int $pos): bool - { + protected function isKeywordContext(array $tokens, int $pos): bool { return parent::isKeywordContext($tokens, $pos) && isset($tokens[$pos + 2]) && $tokens[$pos + 1]->id === \T_WHITESPACE diff --git a/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php index 95ea3bd1..9cadf420 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php @@ -31,8 +31,7 @@ class ExplicitOctalEmulator extends TokenEmulator { return $tokens; } - private function resolveIntegerOrFloatToken(string $str): int - { + private function resolveIntegerOrFloatToken(string $str): int { $str = substr($str, 1); $str = str_replace('_', '', $str); $num = octdec($str); diff --git a/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php index 2c06bcd8..52e9897f 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php @@ -4,32 +4,27 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; -final class FlexibleDocStringEmulator extends TokenEmulator -{ +final class FlexibleDocStringEmulator extends TokenEmulator { private const FLEXIBLE_DOC_STRING_REGEX = <<<'REGEX' /<<<[ \t]*(['"]?)([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)\1\r?\n (?:.*\r?\n)*? (?\h*)\2(?![a-zA-Z0-9_\x80-\xff])(?(?:;?[\r\n])?)/x REGEX; - public function getPhpVersion(): PhpVersion - { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(7, 3); } - public function isEmulationNeeded(string $code) : bool - { + public function isEmulationNeeded(string $code): bool { return strpos($code, '<<<') !== false; } - public function emulate(string $code, array $tokens): array - { + public function emulate(string $code, array $tokens): array { // Handled by preprocessing + fixup. return $tokens; } - public function reverseEmulate(string $code, array $tokens): array - { + public function reverseEmulate(string $code, array $tokens): array { // Not supported. return $tokens; } diff --git a/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php index db3b1cad..55b99f15 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php @@ -4,20 +4,16 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; -final class FnTokenEmulator extends KeywordEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class FnTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(7, 4); } - public function getKeywordString(): string - { + public function getKeywordString(): string { return 'fn'; } - public function getKeywordToken(): int - { + public function getKeywordToken(): int { return \T_FN; } } diff --git a/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php index 3aa3b8ec..197f5052 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php @@ -4,25 +4,21 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\Token; -abstract class KeywordEmulator extends TokenEmulator -{ +abstract class KeywordEmulator extends TokenEmulator { abstract public function getKeywordString(): string; abstract public function getKeywordToken(): int; - public function isEmulationNeeded(string $code): bool - { + public function isEmulationNeeded(string $code): bool { return strpos(strtolower($code), $this->getKeywordString()) !== false; } /** @param Token[] $tokens */ - protected function isKeywordContext(array $tokens, int $pos): bool - { + protected function isKeywordContext(array $tokens, int $pos): bool { $previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos); return $previousNonSpaceToken === null || $previousNonSpaceToken->id !== \T_OBJECT_OPERATOR; } - public function emulate(string $code, array $tokens): array - { + public function emulate(string $code, array $tokens): array { $keywordString = $this->getKeywordString(); foreach ($tokens as $i => $token) { if ($token->id === T_STRING && strtolower($token->text) === $keywordString @@ -35,8 +31,7 @@ abstract class KeywordEmulator extends TokenEmulator } /** @param Token[] $tokens */ - private function getPreviousNonSpaceToken(array $tokens, int $start): ?Token - { + private function getPreviousNonSpaceToken(array $tokens, int $start): ?Token { for ($i = $start - 1; $i >= 0; --$i) { if ($tokens[$i]->id === T_WHITESPACE) { continue; @@ -48,8 +43,7 @@ abstract class KeywordEmulator extends TokenEmulator return null; } - public function reverseEmulate(string $code, array $tokens): array - { + public function reverseEmulate(string $code, array $tokens): array { $keywordToken = $this->getKeywordToken(); foreach ($tokens as $i => $token) { if ($token->id === $keywordToken) { diff --git a/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php index c0116247..0fa5fbc2 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php @@ -4,20 +4,16 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; -final class MatchTokenEmulator extends KeywordEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class MatchTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(8, 0); } - public function getKeywordString(): string - { + public function getKeywordString(): string { return 'match'; } - public function getKeywordToken(): int - { + public function getKeywordToken(): int { return \T_MATCH; } } diff --git a/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php index f157fcff..cede96f0 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php @@ -5,20 +5,16 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; use PhpParser\Token; -final class NullsafeTokenEmulator extends TokenEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class NullsafeTokenEmulator extends TokenEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(8, 0); } - public function isEmulationNeeded(string $code): bool - { + public function isEmulationNeeded(string $code): bool { return strpos($code, '?->') !== false; } - public function emulate(string $code, array $tokens): array - { + public function emulate(string $code, array $tokens): array { // We need to manually iterate and manage a count because we'll change // the tokens array on the way for ($i = 0, $c = count($tokens); $i < $c; ++$i) { @@ -57,8 +53,7 @@ final class NullsafeTokenEmulator extends TokenEmulator return $tokens; } - public function reverseEmulate(string $code, array $tokens): array - { + public function reverseEmulate(string $code, array $tokens): array { // ?-> was not valid code previously, don't bother. return $tokens; } diff --git a/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php index c007bab6..905b65f1 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php @@ -5,8 +5,7 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; use PhpParser\Token; -final class NumericLiteralSeparatorEmulator extends TokenEmulator -{ +final class NumericLiteralSeparatorEmulator extends TokenEmulator { private const BIN = '(?:0b[01]+(?:_[01]+)*)'; private const HEX = '(?:0x[0-9a-f]+(?:_[0-9a-f]+)*)'; private const DEC = '(?:[0-9]+(?:_[0-9]+)*)'; @@ -15,19 +14,16 @@ final class NumericLiteralSeparatorEmulator extends TokenEmulator private const FLOAT = '(?:' . self::SIMPLE_FLOAT . self::EXP . '?|' . self::DEC . self::EXP . ')'; private const NUMBER = '~' . self::FLOAT . '|' . self::BIN . '|' . self::HEX . '|' . self::DEC . '~iA'; - public function getPhpVersion(): PhpVersion - { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(7, 4); } - public function isEmulationNeeded(string $code) : bool - { + public function isEmulationNeeded(string $code): bool { return preg_match('~[0-9]_[0-9]~', $code) || preg_match('~0x[0-9a-f]+_[0-9a-f]~i', $code); } - public function emulate(string $code, array $tokens): array - { + public function emulate(string $code, array $tokens): array { // We need to manually iterate and manage a count because we'll change // the tokens array on the way for ($i = 0, $c = count($tokens); $i < $c; ++$i) { @@ -76,8 +72,7 @@ final class NumericLiteralSeparatorEmulator extends TokenEmulator return $tokens; } - private function resolveIntegerOrFloatToken(string $str): int - { + private function resolveIntegerOrFloatToken(string $str): int { $str = str_replace('_', '', $str); if (stripos($str, '0b') === 0) { @@ -93,8 +88,7 @@ final class NumericLiteralSeparatorEmulator extends TokenEmulator return is_float($num) ? T_DNUMBER : T_LNUMBER; } - public function reverseEmulate(string $code, array $tokens): array - { + public function reverseEmulate(string $code, array $tokens): array { // Numeric separators were not legal code previously, don't bother. return $tokens; } diff --git a/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php index a5526edc..37240f79 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php @@ -4,25 +4,20 @@ namespace PhpParser\Lexer\TokenEmulator; use PhpParser\PhpVersion; -final class ReadonlyTokenEmulator extends KeywordEmulator -{ - public function getPhpVersion(): PhpVersion - { +final class ReadonlyTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { return PhpVersion::fromComponents(8, 1); } - public function getKeywordString(): string - { + public function getKeywordString(): string { return 'readonly'; } - public function getKeywordToken(): int - { + public function getKeywordToken(): int { return \T_READONLY; } - protected function isKeywordContext(array $tokens, int $pos): bool - { + protected function isKeywordContext(array $tokens, int $pos): bool { if (!parent::isKeywordContext($tokens, $pos)) { return false; } diff --git a/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php index e63581ba..e73c87d4 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php @@ -7,8 +7,7 @@ use PhpParser\PhpVersion; /** * Reverses emulation direction of the inner emulator. */ -final class ReverseEmulator extends TokenEmulator -{ +final class ReverseEmulator extends TokenEmulator { /** @var TokenEmulator Inner emulator */ private $emulator; diff --git a/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php b/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php index ffc7b285..d06d4436 100644 --- a/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +++ b/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php @@ -6,8 +6,7 @@ use PhpParser\PhpVersion; use PhpParser\Token; /** @internal */ -abstract class TokenEmulator -{ +abstract class TokenEmulator { abstract public function getPhpVersion(): PhpVersion; abstract public function isEmulationNeeded(string $code): bool; diff --git a/lib/PhpParser/NameContext.php b/lib/PhpParser/NameContext.php index 600c7312..9aa50f43 100644 --- a/lib/PhpParser/NameContext.php +++ b/lib/PhpParser/NameContext.php @@ -6,8 +6,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt; -class NameContext -{ +class NameContext { /** @var null|Name Current namespace */ protected $namespace; @@ -142,7 +141,7 @@ class NameContext * * @return Name Resolved name */ - public function getResolvedClassName(Name $name) : Name { + public function getResolvedClassName(Name $name): Name { return $this->getResolvedName($name, Stmt\Use_::TYPE_NORMAL); } @@ -154,7 +153,7 @@ class NameContext * * @return Name[] Possible representations of the name */ - public function getPossibleNames(string $name, int $type) : array { + public function getPossibleNames(string $name, int $type): array { $lcName = strtolower($name); if ($type === Stmt\Use_::TYPE_NORMAL) { @@ -210,7 +209,7 @@ class NameContext * * @return Name Shortest representation */ - public function getShortName(string $name, int $type) : Name { + public function getShortName(string $name, int $type): Name { $possibleNames = $this->getPossibleNames($name, $type); // Find shortest name @@ -224,7 +223,7 @@ class NameContext } } - return $shortestName; + return $shortestName; } private function resolveAlias(Name $name, $type) { diff --git a/lib/PhpParser/Node.php b/lib/PhpParser/Node.php index 0e768338..df18c284 100644 --- a/lib/PhpParser/Node.php +++ b/lib/PhpParser/Node.php @@ -2,28 +2,27 @@ namespace PhpParser; -interface Node -{ +interface Node { /** * Gets the type of the node. * * @return string Type of the node */ - public function getType() : string; + public function getType(): string; /** * Gets the names of the sub nodes. * * @return array Names of sub nodes */ - public function getSubNodeNames() : array; + public function getSubNodeNames(): array; /** * Gets line the node started in (alias of getStartLine). * * @return int Start line (or -1 if not available) */ - public function getLine() : int; + public function getLine(): int; /** * Gets line the node started in. @@ -32,7 +31,7 @@ interface Node * * @return int Start line (or -1 if not available) */ - public function getStartLine() : int; + public function getStartLine(): int; /** * Gets the line the node ended in. @@ -41,7 +40,7 @@ interface Node * * @return int End line (or -1 if not available) */ - public function getEndLine() : int; + public function getEndLine(): int; /** * Gets the token offset of the first token that is part of this node. @@ -52,7 +51,7 @@ interface Node * * @return int Token start position (or -1 if not available) */ - public function getStartTokenPos() : int; + public function getStartTokenPos(): int; /** * Gets the token offset of the last token that is part of this node. @@ -63,7 +62,7 @@ interface Node * * @return int Token end position (or -1 if not available) */ - public function getEndTokenPos() : int; + public function getEndTokenPos(): int; /** * Gets the file offset of the first character that is part of this node. @@ -72,7 +71,7 @@ interface Node * * @return int File start position (or -1 if not available) */ - public function getStartFilePos() : int; + public function getStartFilePos(): int; /** * Gets the file offset of the last character that is part of this node. @@ -81,7 +80,7 @@ interface Node * * @return int File end position (or -1 if not available) */ - public function getEndFilePos() : int; + public function getEndFilePos(): int; /** * Gets all comments directly preceding this node. @@ -90,7 +89,7 @@ interface Node * * @return Comment[] */ - public function getComments() : array; + public function getComments(): array; /** * Gets the doc comment of the node. @@ -123,7 +122,7 @@ interface Node * * @return bool */ - public function hasAttribute(string $key) : bool; + public function hasAttribute(string $key): bool; /** * Returns the value of an attribute. @@ -140,7 +139,7 @@ interface Node * * @return array */ - public function getAttributes() : array; + public function getAttributes(): array; /** * Replaces all the attributes of this node. diff --git a/lib/PhpParser/Node/Arg.php b/lib/PhpParser/Node/Arg.php index c6009f0c..fa70f8ec 100644 --- a/lib/PhpParser/Node/Arg.php +++ b/lib/PhpParser/Node/Arg.php @@ -4,8 +4,7 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -class Arg extends NodeAbstract -{ +class Arg extends NodeAbstract { /** @var Identifier|null Parameter name (for named parameters) */ public $name; /** @var Expr Value to pass */ @@ -35,11 +34,11 @@ class Arg extends NodeAbstract $this->unpack = $unpack; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name', 'value', 'byRef', 'unpack']; } - - public function getType() : string { + + public function getType(): string { return 'Arg'; } } diff --git a/lib/PhpParser/Node/Attribute.php b/lib/PhpParser/Node/Attribute.php index c96f66e5..6635bd87 100644 --- a/lib/PhpParser/Node/Attribute.php +++ b/lib/PhpParser/Node/Attribute.php @@ -5,8 +5,7 @@ namespace PhpParser\Node; use PhpParser\Node; use PhpParser\NodeAbstract; -class Attribute extends NodeAbstract -{ +class Attribute extends NodeAbstract { /** @var Name Attribute name */ public $name; @@ -24,11 +23,11 @@ class Attribute extends NodeAbstract $this->args = $args; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name', 'args']; } - public function getType() : string { + public function getType(): string { return 'Attribute'; } } diff --git a/lib/PhpParser/Node/AttributeGroup.php b/lib/PhpParser/Node/AttributeGroup.php index 4a131f98..487a996c 100644 --- a/lib/PhpParser/Node/AttributeGroup.php +++ b/lib/PhpParser/Node/AttributeGroup.php @@ -4,8 +4,7 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -class AttributeGroup extends NodeAbstract -{ +class AttributeGroup extends NodeAbstract { /** @var Attribute[] Attributes */ public $attrs; @@ -18,11 +17,11 @@ class AttributeGroup extends NodeAbstract $this->attrs = $attrs; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrs']; } - public function getType() : string { + public function getType(): string { return 'AttributeGroup'; } } diff --git a/lib/PhpParser/Node/ClosureUse.php b/lib/PhpParser/Node/ClosureUse.php index 26348daa..1eba69db 100644 --- a/lib/PhpParser/Node/ClosureUse.php +++ b/lib/PhpParser/Node/ClosureUse.php @@ -4,8 +4,7 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -class ClosureUse extends NodeAbstract -{ +class ClosureUse extends NodeAbstract { /** @var Expr\Variable Variable to use */ public $var; /** @var bool Whether to use by reference */ @@ -24,11 +23,11 @@ class ClosureUse extends NodeAbstract $this->byRef = $byRef; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'byRef']; } - - public function getType() : string { + + public function getType(): string { return 'ClosureUse'; } } diff --git a/lib/PhpParser/Node/ComplexType.php b/lib/PhpParser/Node/ComplexType.php index 9505532a..05a5e5ee 100644 --- a/lib/PhpParser/Node/ComplexType.php +++ b/lib/PhpParser/Node/ComplexType.php @@ -9,6 +9,5 @@ use PhpParser\NodeAbstract; * * It does not provide any shared behavior and exists only for type-checking purposes. */ -abstract class ComplexType extends NodeAbstract -{ +abstract class ComplexType extends NodeAbstract { } diff --git a/lib/PhpParser/Node/Const_.php b/lib/PhpParser/Node/Const_.php index 07a74df8..a65db401 100644 --- a/lib/PhpParser/Node/Const_.php +++ b/lib/PhpParser/Node/Const_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -class Const_ extends NodeAbstract -{ +class Const_ extends NodeAbstract { /** @var Identifier Name */ public $name; /** @var Expr Value */ @@ -27,11 +26,11 @@ class Const_ extends NodeAbstract $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name', 'value']; } - public function getType() : string { + public function getType(): string { return 'Const'; } } diff --git a/lib/PhpParser/Node/Expr.php b/lib/PhpParser/Node/Expr.php index 6cf4df22..8b7dbb6c 100644 --- a/lib/PhpParser/Node/Expr.php +++ b/lib/PhpParser/Node/Expr.php @@ -4,6 +4,5 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -abstract class Expr extends NodeAbstract -{ +abstract class Expr extends NodeAbstract { } diff --git a/lib/PhpParser/Node/Expr/ArrayDimFetch.php b/lib/PhpParser/Node/Expr/ArrayDimFetch.php index 46db975c..99e3ebe2 100644 --- a/lib/PhpParser/Node/Expr/ArrayDimFetch.php +++ b/lib/PhpParser/Node/Expr/ArrayDimFetch.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class ArrayDimFetch extends Expr -{ +class ArrayDimFetch extends Expr { /** @var Expr Variable */ public $var; /** @var null|Expr Array index / dim */ @@ -24,11 +23,11 @@ class ArrayDimFetch extends Expr $this->dim = $dim; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'dim']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_ArrayDimFetch'; } } diff --git a/lib/PhpParser/Node/Expr/ArrayItem.php b/lib/PhpParser/Node/Expr/ArrayItem.php index 5aaa9867..7d6cdefe 100644 --- a/lib/PhpParser/Node/Expr/ArrayItem.php +++ b/lib/PhpParser/Node/Expr/ArrayItem.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class ArrayItem extends Expr -{ +class ArrayItem extends Expr { /** @var null|Expr Key */ public $key; /** @var Expr Value */ @@ -31,11 +30,11 @@ class ArrayItem extends Expr $this->unpack = $unpack; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['key', 'value', 'byRef', 'unpack']; } - public function getType() : string { + public function getType(): string { return 'Expr_ArrayItem'; } } diff --git a/lib/PhpParser/Node/Expr/Array_.php b/lib/PhpParser/Node/Expr/Array_.php index a922bd9b..5fd78928 100644 --- a/lib/PhpParser/Node/Expr/Array_.php +++ b/lib/PhpParser/Node/Expr/Array_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Array_ extends Expr -{ +class Array_ extends Expr { // For use in "kind" attribute public const KIND_LONG = 1; // array() syntax public const KIND_SHORT = 2; // [] syntax @@ -24,11 +23,11 @@ class Array_ extends Expr $this->items = $items; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['items']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Array'; } } diff --git a/lib/PhpParser/Node/Expr/ArrowFunction.php b/lib/PhpParser/Node/Expr/ArrowFunction.php index c273fb7e..969dc745 100644 --- a/lib/PhpParser/Node/Expr/ArrowFunction.php +++ b/lib/PhpParser/Node/Expr/ArrowFunction.php @@ -6,8 +6,7 @@ use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\FunctionLike; -class ArrowFunction extends Expr implements FunctionLike -{ +class ArrowFunction extends Expr implements FunctionLike { /** @var bool */ public $static; @@ -46,15 +45,15 @@ class ArrowFunction extends Expr implements FunctionLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr']; } - public function returnsByRef() : bool { + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array { + public function getParams(): array { return $this->params; } @@ -62,18 +61,18 @@ class ArrowFunction extends Expr implements FunctionLike return $this->returnType; } - public function getAttrGroups() : array { + public function getAttrGroups(): array { return $this->attrGroups; } /** * @return Node\Stmt\Return_[] */ - public function getStmts() : array { + public function getStmts(): array { return [new Node\Stmt\Return_($this->expr)]; } - public function getType() : string { + public function getType(): string { return 'Expr_ArrowFunction'; } } diff --git a/lib/PhpParser/Node/Expr/Assign.php b/lib/PhpParser/Node/Expr/Assign.php index cf9e6e82..0fadbfc4 100644 --- a/lib/PhpParser/Node/Expr/Assign.php +++ b/lib/PhpParser/Node/Expr/Assign.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Assign extends Expr -{ +class Assign extends Expr { /** @var Expr Variable */ public $var; /** @var Expr Expression */ @@ -24,11 +23,11 @@ class Assign extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Assign'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp.php b/lib/PhpParser/Node/Expr/AssignOp.php index bce8604f..77cb661c 100644 --- a/lib/PhpParser/Node/Expr/AssignOp.php +++ b/lib/PhpParser/Node/Expr/AssignOp.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -abstract class AssignOp extends Expr -{ +abstract class AssignOp extends Expr { /** @var Expr Variable */ public $var; /** @var Expr Expression */ @@ -24,7 +23,7 @@ abstract class AssignOp extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'expr']; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php b/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php index 420284cd..4f3623fb 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +++ b/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class BitwiseAnd extends AssignOp -{ - public function getType() : string { +class BitwiseAnd extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_BitwiseAnd'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php b/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php index 481ad3bb..23efe107 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php +++ b/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class BitwiseOr extends AssignOp -{ - public function getType() : string { +class BitwiseOr extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_BitwiseOr'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php b/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php index f41d4c8e..24be7303 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php +++ b/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class BitwiseXor extends AssignOp -{ - public function getType() : string { +class BitwiseXor extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_BitwiseXor'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php b/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php index c0e9b316..b78ea901 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Coalesce extends AssignOp -{ - public function getType() : string { +class Coalesce extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Coalesce'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Concat.php b/lib/PhpParser/Node/Expr/AssignOp/Concat.php index ac168207..f419e2ea 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Concat.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Concat.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Concat extends AssignOp -{ - public function getType() : string { +class Concat extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Concat'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Div.php b/lib/PhpParser/Node/Expr/AssignOp/Div.php index f1fcfc09..98b04727 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Div.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Div.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Div extends AssignOp -{ - public function getType() : string { +class Div extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Div'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Minus.php b/lib/PhpParser/Node/Expr/AssignOp/Minus.php index 82ef4517..20765993 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Minus.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Minus.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Minus extends AssignOp -{ - public function getType() : string { +class Minus extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Minus'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Mod.php b/lib/PhpParser/Node/Expr/AssignOp/Mod.php index be3b4a0a..526430e2 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Mod.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Mod.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Mod extends AssignOp -{ - public function getType() : string { +class Mod extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Mod'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Mul.php b/lib/PhpParser/Node/Expr/AssignOp/Mul.php index 5c196c3b..81241ac9 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Mul.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Mul.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Mul extends AssignOp -{ - public function getType() : string { +class Mul extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Mul'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Plus.php b/lib/PhpParser/Node/Expr/AssignOp/Plus.php index dd101c61..0bca8cc1 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Plus.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Plus.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Plus extends AssignOp -{ - public function getType() : string { +class Plus extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Plus'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/Pow.php b/lib/PhpParser/Node/Expr/AssignOp/Pow.php index 5e1307d1..4e3279c4 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/Pow.php +++ b/lib/PhpParser/Node/Expr/AssignOp/Pow.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class Pow extends AssignOp -{ - public function getType() : string { +class Pow extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_Pow'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php b/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php index b8f88269..7a5dd60c 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php +++ b/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class ShiftLeft extends AssignOp -{ - public function getType() : string { +class ShiftLeft extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_ShiftLeft'; } } diff --git a/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php b/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php index e0cc67b7..4f270864 100644 --- a/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php +++ b/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\AssignOp; -class ShiftRight extends AssignOp -{ - public function getType() : string { +class ShiftRight extends AssignOp { + public function getType(): string { return 'Expr_AssignOp_ShiftRight'; } } diff --git a/lib/PhpParser/Node/Expr/AssignRef.php b/lib/PhpParser/Node/Expr/AssignRef.php index de3c644c..407debd9 100644 --- a/lib/PhpParser/Node/Expr/AssignRef.php +++ b/lib/PhpParser/Node/Expr/AssignRef.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class AssignRef extends Expr -{ +class AssignRef extends Expr { /** @var Expr Variable reference is assigned to */ public $var; /** @var Expr Variable which is referenced */ @@ -24,11 +23,11 @@ class AssignRef extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_AssignRef'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp.php b/lib/PhpParser/Node/Expr/BinaryOp.php index d9c582b0..e72f62ed 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp.php +++ b/lib/PhpParser/Node/Expr/BinaryOp.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -abstract class BinaryOp extends Expr -{ +abstract class BinaryOp extends Expr { /** @var Expr The left hand side expression */ public $left; /** @var Expr The right hand side expression */ @@ -24,7 +23,7 @@ abstract class BinaryOp extends Expr $this->right = $right; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['left', 'right']; } @@ -36,5 +35,5 @@ abstract class BinaryOp extends Expr * * @return string */ - abstract public function getOperatorSigil() : string; + abstract public function getOperatorSigil(): string; } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php b/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php index d907393b..5930c541 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class BitwiseAnd extends BinaryOp -{ - public function getOperatorSigil() : string { +class BitwiseAnd extends BinaryOp { + public function getOperatorSigil(): string { return '&'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_BitwiseAnd'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php b/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php index d92069f3..adcefd0e 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class BitwiseOr extends BinaryOp -{ - public function getOperatorSigil() : string { +class BitwiseOr extends BinaryOp { + public function getOperatorSigil(): string { return '|'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_BitwiseOr'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php b/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php index 40fa94f8..92bca609 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class BitwiseXor extends BinaryOp -{ - public function getOperatorSigil() : string { +class BitwiseXor extends BinaryOp { + public function getOperatorSigil(): string { return '^'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_BitwiseXor'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php b/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php index 4c3c9e9b..82a6b5a2 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class BooleanAnd extends BinaryOp -{ - public function getOperatorSigil() : string { +class BooleanAnd extends BinaryOp { + public function getOperatorSigil(): string { return '&&'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_BooleanAnd'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php b/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php index 5ad41727..739edafa 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class BooleanOr extends BinaryOp -{ - public function getOperatorSigil() : string { +class BooleanOr extends BinaryOp { + public function getOperatorSigil(): string { return '||'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_BooleanOr'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php b/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php index b8cf6f45..ab75a23e 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Coalesce extends BinaryOp -{ - public function getOperatorSigil() : string { +class Coalesce extends BinaryOp { + public function getOperatorSigil(): string { return '??'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Coalesce'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Concat.php b/lib/PhpParser/Node/Expr/BinaryOp/Concat.php index 9a8d9873..a730f576 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Concat.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Concat.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Concat extends BinaryOp -{ - public function getOperatorSigil() : string { +class Concat extends BinaryOp { + public function getOperatorSigil(): string { return '.'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Concat'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Div.php b/lib/PhpParser/Node/Expr/BinaryOp/Div.php index d38df0db..ba1f629d 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Div.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Div.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Div extends BinaryOp -{ - public function getOperatorSigil() : string { +class Div extends BinaryOp { + public function getOperatorSigil(): string { return '/'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Div'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Equal.php b/lib/PhpParser/Node/Expr/BinaryOp/Equal.php index e7b11dc8..28bde812 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Equal.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Equal.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Equal extends BinaryOp -{ - public function getOperatorSigil() : string { +class Equal extends BinaryOp { + public function getOperatorSigil(): string { return '=='; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Equal'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Greater.php b/lib/PhpParser/Node/Expr/BinaryOp/Greater.php index da01f7a1..6215c50b 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Greater.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Greater.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Greater extends BinaryOp -{ - public function getOperatorSigil() : string { +class Greater extends BinaryOp { + public function getOperatorSigil(): string { return '>'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Greater'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php b/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php index d677502c..4d440b10 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class GreaterOrEqual extends BinaryOp -{ - public function getOperatorSigil() : string { +class GreaterOrEqual extends BinaryOp { + public function getOperatorSigil(): string { return '>='; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_GreaterOrEqual'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Identical.php b/lib/PhpParser/Node/Expr/BinaryOp/Identical.php index 3d96285c..e25d17cd 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Identical.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Identical extends BinaryOp -{ - public function getOperatorSigil() : string { +class Identical extends BinaryOp { + public function getOperatorSigil(): string { return '==='; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Identical'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php b/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php index 2a3afd54..9b9ea1f6 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class LogicalAnd extends BinaryOp -{ - public function getOperatorSigil() : string { +class LogicalAnd extends BinaryOp { + public function getOperatorSigil(): string { return 'and'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_LogicalAnd'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php b/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php index 21507dba..a6235ee7 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class LogicalOr extends BinaryOp -{ - public function getOperatorSigil() : string { +class LogicalOr extends BinaryOp { + public function getOperatorSigil(): string { return 'or'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_LogicalOr'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php b/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php index 261c6a91..7ff2fdb0 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class LogicalXor extends BinaryOp -{ - public function getOperatorSigil() : string { +class LogicalXor extends BinaryOp { + public function getOperatorSigil(): string { return 'xor'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_LogicalXor'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Minus.php b/lib/PhpParser/Node/Expr/BinaryOp/Minus.php index 54b3c6e9..8924c55e 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Minus.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Minus.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Minus extends BinaryOp -{ - public function getOperatorSigil() : string { +class Minus extends BinaryOp { + public function getOperatorSigil(): string { return '-'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Minus'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Mod.php b/lib/PhpParser/Node/Expr/BinaryOp/Mod.php index 10340404..56619de1 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Mod.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Mod.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Mod extends BinaryOp -{ - public function getOperatorSigil() : string { +class Mod extends BinaryOp { + public function getOperatorSigil(): string { return '%'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Mod'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Mul.php b/lib/PhpParser/Node/Expr/BinaryOp/Mul.php index b82d0b2f..98745fbe 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Mul.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Mul.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Mul extends BinaryOp -{ - public function getOperatorSigil() : string { +class Mul extends BinaryOp { + public function getOperatorSigil(): string { return '*'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Mul'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php b/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php index 51075da5..72d03c45 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class NotEqual extends BinaryOp -{ - public function getOperatorSigil() : string { +class NotEqual extends BinaryOp { + public function getOperatorSigil(): string { return '!='; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_NotEqual'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php b/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php index fa4050e0..e9befd80 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class NotIdentical extends BinaryOp -{ - public function getOperatorSigil() : string { +class NotIdentical extends BinaryOp { + public function getOperatorSigil(): string { return '!=='; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_NotIdentical'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Plus.php b/lib/PhpParser/Node/Expr/BinaryOp/Plus.php index 62f02299..fe34b84c 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Plus.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Plus.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Plus extends BinaryOp -{ - public function getOperatorSigil() : string { +class Plus extends BinaryOp { + public function getOperatorSigil(): string { return '+'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Plus'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Pow.php b/lib/PhpParser/Node/Expr/BinaryOp/Pow.php index 572a1e8e..e4e641cb 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Pow.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Pow.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Pow extends BinaryOp -{ - public function getOperatorSigil() : string { +class Pow extends BinaryOp { + public function getOperatorSigil(): string { return '**'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Pow'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php b/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php index 4e70b4ef..22c6260f 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class ShiftLeft extends BinaryOp -{ - public function getOperatorSigil() : string { +class ShiftLeft extends BinaryOp { + public function getOperatorSigil(): string { return '<<'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_ShiftLeft'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php b/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php index 45acbd04..cd42644a 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class ShiftRight extends BinaryOp -{ - public function getOperatorSigil() : string { +class ShiftRight extends BinaryOp { + public function getOperatorSigil(): string { return '>>'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_ShiftRight'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php b/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php index 3cb8e7e0..01e9b231 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Smaller extends BinaryOp -{ - public function getOperatorSigil() : string { +class Smaller extends BinaryOp { + public function getOperatorSigil(): string { return '<'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Smaller'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php b/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php index 83e8e214..2c88f383 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class SmallerOrEqual extends BinaryOp -{ - public function getOperatorSigil() : string { +class SmallerOrEqual extends BinaryOp { + public function getOperatorSigil(): string { return '<='; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_SmallerOrEqual'; } } diff --git a/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php b/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php index 8c6d787f..974ec7dd 100644 --- a/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php +++ b/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp; -class Spaceship extends BinaryOp -{ - public function getOperatorSigil() : string { +class Spaceship extends BinaryOp { + public function getOperatorSigil(): string { return '<=>'; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BinaryOp_Spaceship'; } } diff --git a/lib/PhpParser/Node/Expr/BitwiseNot.php b/lib/PhpParser/Node/Expr/BitwiseNot.php index ed44984b..6499bf98 100644 --- a/lib/PhpParser/Node/Expr/BitwiseNot.php +++ b/lib/PhpParser/Node/Expr/BitwiseNot.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class BitwiseNot extends Expr -{ +class BitwiseNot extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class BitwiseNot extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BitwiseNot'; } } diff --git a/lib/PhpParser/Node/Expr/BooleanNot.php b/lib/PhpParser/Node/Expr/BooleanNot.php index bf27e9f6..c00fd71c 100644 --- a/lib/PhpParser/Node/Expr/BooleanNot.php +++ b/lib/PhpParser/Node/Expr/BooleanNot.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class BooleanNot extends Expr -{ +class BooleanNot extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class BooleanNot extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_BooleanNot'; } } diff --git a/lib/PhpParser/Node/Expr/Cast.php b/lib/PhpParser/Node/Expr/Cast.php index 36769d4f..3a1e8c94 100644 --- a/lib/PhpParser/Node/Expr/Cast.php +++ b/lib/PhpParser/Node/Expr/Cast.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -abstract class Cast extends Expr -{ +abstract class Cast extends Expr { /** @var Expr Expression */ public $expr; @@ -20,7 +19,7 @@ abstract class Cast extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } } diff --git a/lib/PhpParser/Node/Expr/Cast/Array_.php b/lib/PhpParser/Node/Expr/Cast/Array_.php index 57cc473b..471cb824 100644 --- a/lib/PhpParser/Node/Expr/Cast/Array_.php +++ b/lib/PhpParser/Node/Expr/Cast/Array_.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class Array_ extends Cast -{ - public function getType() : string { +class Array_ extends Cast { + public function getType(): string { return 'Expr_Cast_Array'; } } diff --git a/lib/PhpParser/Node/Expr/Cast/Bool_.php b/lib/PhpParser/Node/Expr/Cast/Bool_.php index 04eb4af5..3aed497c 100644 --- a/lib/PhpParser/Node/Expr/Cast/Bool_.php +++ b/lib/PhpParser/Node/Expr/Cast/Bool_.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class Bool_ extends Cast -{ - public function getType() : string { +class Bool_ extends Cast { + public function getType(): string { return 'Expr_Cast_Bool'; } } diff --git a/lib/PhpParser/Node/Expr/Cast/Double.php b/lib/PhpParser/Node/Expr/Cast/Double.php index b71220fb..e7f5cd9b 100644 --- a/lib/PhpParser/Node/Expr/Cast/Double.php +++ b/lib/PhpParser/Node/Expr/Cast/Double.php @@ -4,14 +4,13 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class Double extends Cast -{ +class Double extends Cast { // For use in "kind" attribute public const KIND_DOUBLE = 1; // "double" syntax public const KIND_FLOAT = 2; // "float" syntax public const KIND_REAL = 3; // "real" syntax - public function getType() : string { + public function getType(): string { return 'Expr_Cast_Double'; } } diff --git a/lib/PhpParser/Node/Expr/Cast/Int_.php b/lib/PhpParser/Node/Expr/Cast/Int_.php index 01ed594b..20744b9b 100644 --- a/lib/PhpParser/Node/Expr/Cast/Int_.php +++ b/lib/PhpParser/Node/Expr/Cast/Int_.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class Int_ extends Cast -{ - public function getType() : string { +class Int_ extends Cast { + public function getType(): string { return 'Expr_Cast_Int'; } } diff --git a/lib/PhpParser/Node/Expr/Cast/Object_.php b/lib/PhpParser/Node/Expr/Cast/Object_.php index 163752be..dffa9e54 100644 --- a/lib/PhpParser/Node/Expr/Cast/Object_.php +++ b/lib/PhpParser/Node/Expr/Cast/Object_.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class Object_ extends Cast -{ - public function getType() : string { +class Object_ extends Cast { + public function getType(): string { return 'Expr_Cast_Object'; } } diff --git a/lib/PhpParser/Node/Expr/Cast/String_.php b/lib/PhpParser/Node/Expr/Cast/String_.php index b3d99270..c7605ab8 100644 --- a/lib/PhpParser/Node/Expr/Cast/String_.php +++ b/lib/PhpParser/Node/Expr/Cast/String_.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class String_ extends Cast -{ - public function getType() : string { +class String_ extends Cast { + public function getType(): string { return 'Expr_Cast_String'; } } diff --git a/lib/PhpParser/Node/Expr/Cast/Unset_.php b/lib/PhpParser/Node/Expr/Cast/Unset_.php index accda3e4..cb709a43 100644 --- a/lib/PhpParser/Node/Expr/Cast/Unset_.php +++ b/lib/PhpParser/Node/Expr/Cast/Unset_.php @@ -4,9 +4,8 @@ namespace PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast; -class Unset_ extends Cast -{ - public function getType() : string { +class Unset_ extends Cast { + public function getType(): string { return 'Expr_Cast_Unset'; } } diff --git a/lib/PhpParser/Node/Expr/ClassConstFetch.php b/lib/PhpParser/Node/Expr/ClassConstFetch.php index faf832f9..c3bbc731 100644 --- a/lib/PhpParser/Node/Expr/ClassConstFetch.php +++ b/lib/PhpParser/Node/Expr/ClassConstFetch.php @@ -6,8 +6,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -class ClassConstFetch extends Expr -{ +class ClassConstFetch extends Expr { /** @var Name|Expr Class name */ public $class; /** @var Identifier|Error Constant name */ @@ -26,11 +25,11 @@ class ClassConstFetch extends Expr $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['class', 'name']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_ClassConstFetch'; } } diff --git a/lib/PhpParser/Node/Expr/Clone_.php b/lib/PhpParser/Node/Expr/Clone_.php index db216b8f..2564ae47 100644 --- a/lib/PhpParser/Node/Expr/Clone_.php +++ b/lib/PhpParser/Node/Expr/Clone_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Clone_ extends Expr -{ +class Clone_ extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Clone_ extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Clone'; } } diff --git a/lib/PhpParser/Node/Expr/Closure.php b/lib/PhpParser/Node/Expr/Closure.php index 548d7608..2d40fa55 100644 --- a/lib/PhpParser/Node/Expr/Closure.php +++ b/lib/PhpParser/Node/Expr/Closure.php @@ -7,8 +7,7 @@ use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr; use PhpParser\Node\FunctionLike; -class Closure extends Expr implements FunctionLike -{ +class Closure extends Expr implements FunctionLike { /** @var bool Whether the closure is static */ public $static; /** @var bool Whether to return by reference */ @@ -49,15 +48,15 @@ class Closure extends Expr implements FunctionLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts']; } - public function returnsByRef() : bool { + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array { + public function getParams(): array { return $this->params; } @@ -66,15 +65,15 @@ class Closure extends Expr implements FunctionLike } /** @return Node\Stmt[] */ - public function getStmts() : array { + public function getStmts(): array { return $this->stmts; } - public function getAttrGroups() : array { + public function getAttrGroups(): array { return $this->attrGroups; } - public function getType() : string { + public function getType(): string { return 'Expr_Closure'; } } diff --git a/lib/PhpParser/Node/Expr/ConstFetch.php b/lib/PhpParser/Node/Expr/ConstFetch.php index 14ebd16b..bb3bd006 100644 --- a/lib/PhpParser/Node/Expr/ConstFetch.php +++ b/lib/PhpParser/Node/Expr/ConstFetch.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; use PhpParser\Node\Name; -class ConstFetch extends Expr -{ +class ConstFetch extends Expr { /** @var Name Constant name */ public $name; @@ -21,11 +20,11 @@ class ConstFetch extends Expr $this->name = $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_ConstFetch'; } } diff --git a/lib/PhpParser/Node/Expr/Empty_.php b/lib/PhpParser/Node/Expr/Empty_.php index 4042ec93..59770186 100644 --- a/lib/PhpParser/Node/Expr/Empty_.php +++ b/lib/PhpParser/Node/Expr/Empty_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Empty_ extends Expr -{ +class Empty_ extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Empty_ extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Empty'; } } diff --git a/lib/PhpParser/Node/Expr/Error.php b/lib/PhpParser/Node/Expr/Error.php index 1637f3ae..a4cb8486 100644 --- a/lib/PhpParser/Node/Expr/Error.php +++ b/lib/PhpParser/Node/Expr/Error.php @@ -10,8 +10,7 @@ use PhpParser\Node\Expr; * An error node may be placed at a position where an expression is required, but an error occurred. * Error nodes will not be present if the parser is run in throwOnError mode (the default). */ -class Error extends Expr -{ +class Error extends Expr { /** * Constructs an error node. * @@ -21,11 +20,11 @@ class Error extends Expr $this->attributes = $attributes; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return []; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Error'; } } diff --git a/lib/PhpParser/Node/Expr/ErrorSuppress.php b/lib/PhpParser/Node/Expr/ErrorSuppress.php index c44ff6f9..a47dd02f 100644 --- a/lib/PhpParser/Node/Expr/ErrorSuppress.php +++ b/lib/PhpParser/Node/Expr/ErrorSuppress.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class ErrorSuppress extends Expr -{ +class ErrorSuppress extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class ErrorSuppress extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_ErrorSuppress'; } } diff --git a/lib/PhpParser/Node/Expr/Eval_.php b/lib/PhpParser/Node/Expr/Eval_.php index 85685474..2d254bfd 100644 --- a/lib/PhpParser/Node/Expr/Eval_.php +++ b/lib/PhpParser/Node/Expr/Eval_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Eval_ extends Expr -{ +class Eval_ extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Eval_ extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Eval'; } } diff --git a/lib/PhpParser/Node/Expr/Exit_.php b/lib/PhpParser/Node/Expr/Exit_.php index 50bbf0f0..55b93499 100644 --- a/lib/PhpParser/Node/Expr/Exit_.php +++ b/lib/PhpParser/Node/Expr/Exit_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Exit_ extends Expr -{ +class Exit_ extends Expr { /* For use in "kind" attribute */ public const KIND_EXIT = 1; public const KIND_DIE = 2; @@ -24,11 +23,11 @@ class Exit_ extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Exit'; } } diff --git a/lib/PhpParser/Node/Expr/FuncCall.php b/lib/PhpParser/Node/Expr/FuncCall.php index 2de4d0dd..dd63f1b0 100644 --- a/lib/PhpParser/Node/Expr/FuncCall.php +++ b/lib/PhpParser/Node/Expr/FuncCall.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node; use PhpParser\Node\Expr; -class FuncCall extends CallLike -{ +class FuncCall extends CallLike { /** @var Node\Name|Expr Function name */ public $name; /** @var array Arguments */ @@ -25,11 +24,11 @@ class FuncCall extends CallLike $this->args = $args; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name', 'args']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_FuncCall'; } diff --git a/lib/PhpParser/Node/Expr/Include_.php b/lib/PhpParser/Node/Expr/Include_.php index 01b3bb6d..894d32a5 100644 --- a/lib/PhpParser/Node/Expr/Include_.php +++ b/lib/PhpParser/Node/Expr/Include_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Include_ extends Expr -{ +class Include_ extends Expr { public const TYPE_INCLUDE = 1; public const TYPE_INCLUDE_ONCE = 2; public const TYPE_REQUIRE = 3; @@ -29,11 +28,11 @@ class Include_ extends Expr $this->type = $type; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr', 'type']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Include'; } } diff --git a/lib/PhpParser/Node/Expr/Instanceof_.php b/lib/PhpParser/Node/Expr/Instanceof_.php index 9000d47b..800d187f 100644 --- a/lib/PhpParser/Node/Expr/Instanceof_.php +++ b/lib/PhpParser/Node/Expr/Instanceof_.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; use PhpParser\Node\Name; -class Instanceof_ extends Expr -{ +class Instanceof_ extends Expr { /** @var Expr Expression */ public $expr; /** @var Name|Expr Class name */ @@ -25,11 +24,11 @@ class Instanceof_ extends Expr $this->class = $class; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr', 'class']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Instanceof'; } } diff --git a/lib/PhpParser/Node/Expr/Isset_.php b/lib/PhpParser/Node/Expr/Isset_.php index 76b73875..e43a859f 100644 --- a/lib/PhpParser/Node/Expr/Isset_.php +++ b/lib/PhpParser/Node/Expr/Isset_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Isset_ extends Expr -{ +class Isset_ extends Expr { /** @var Expr[] Variables */ public $vars; @@ -20,11 +19,11 @@ class Isset_ extends Expr $this->vars = $vars; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['vars']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Isset'; } } diff --git a/lib/PhpParser/Node/Expr/List_.php b/lib/PhpParser/Node/Expr/List_.php index f899b4ce..4cc52a3f 100644 --- a/lib/PhpParser/Node/Expr/List_.php +++ b/lib/PhpParser/Node/Expr/List_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class List_ extends Expr -{ +class List_ extends Expr { // For use in "kind" attribute public const KIND_LIST = 1; // list() syntax public const KIND_ARRAY = 2; // [] syntax @@ -24,11 +23,11 @@ class List_ extends Expr $this->items = $items; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['items']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_List'; } } diff --git a/lib/PhpParser/Node/Expr/Match_.php b/lib/PhpParser/Node/Expr/Match_.php index 2455a302..3b5ce48e 100644 --- a/lib/PhpParser/Node/Expr/Match_.php +++ b/lib/PhpParser/Node/Expr/Match_.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node; use PhpParser\Node\MatchArm; -class Match_ extends Node\Expr -{ +class Match_ extends Node\Expr { /** @var Node\Expr */ public $cond; /** @var MatchArm[] */ @@ -21,11 +20,11 @@ class Match_ extends Node\Expr $this->arms = $arms; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'arms']; } - public function getType() : string { + public function getType(): string { return 'Expr_Match'; } } diff --git a/lib/PhpParser/Node/Expr/MethodCall.php b/lib/PhpParser/Node/Expr/MethodCall.php index 49ca4835..0e42ab7c 100644 --- a/lib/PhpParser/Node/Expr/MethodCall.php +++ b/lib/PhpParser/Node/Expr/MethodCall.php @@ -7,8 +7,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\VariadicPlaceholder; -class MethodCall extends CallLike -{ +class MethodCall extends CallLike { /** @var Expr Variable holding object */ public $var; /** @var Identifier|Expr Method name */ @@ -31,11 +30,11 @@ class MethodCall extends CallLike $this->args = $args; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'name', 'args']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_MethodCall'; } diff --git a/lib/PhpParser/Node/Expr/New_.php b/lib/PhpParser/Node/Expr/New_.php index e2bb6492..23561837 100644 --- a/lib/PhpParser/Node/Expr/New_.php +++ b/lib/PhpParser/Node/Expr/New_.php @@ -7,8 +7,7 @@ use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\VariadicPlaceholder; -class New_ extends CallLike -{ +class New_ extends CallLike { /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */ public $class; /** @var array Arguments */ @@ -27,11 +26,11 @@ class New_ extends CallLike $this->args = $args; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['class', 'args']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_New'; } diff --git a/lib/PhpParser/Node/Expr/NullsafeMethodCall.php b/lib/PhpParser/Node/Expr/NullsafeMethodCall.php index 07a571fd..6acd9795 100644 --- a/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +++ b/lib/PhpParser/Node/Expr/NullsafeMethodCall.php @@ -7,8 +7,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\VariadicPlaceholder; -class NullsafeMethodCall extends CallLike -{ +class NullsafeMethodCall extends CallLike { /** @var Expr Variable holding object */ public $var; /** @var Identifier|Expr Method name */ @@ -31,11 +30,11 @@ class NullsafeMethodCall extends CallLike $this->args = $args; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'name', 'args']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_NullsafeMethodCall'; } diff --git a/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php b/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php index 9317eb3b..9b4e8752 100644 --- a/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +++ b/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; -class NullsafePropertyFetch extends Expr -{ +class NullsafePropertyFetch extends Expr { /** @var Expr Variable holding object */ public $var; /** @var Identifier|Expr Property name */ @@ -25,11 +24,11 @@ class NullsafePropertyFetch extends Expr $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'name']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_NullsafePropertyFetch'; } } diff --git a/lib/PhpParser/Node/Expr/PostDec.php b/lib/PhpParser/Node/Expr/PostDec.php index 94d6c296..32540340 100644 --- a/lib/PhpParser/Node/Expr/PostDec.php +++ b/lib/PhpParser/Node/Expr/PostDec.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class PostDec extends Expr -{ +class PostDec extends Expr { /** @var Expr Variable */ public $var; @@ -20,11 +19,11 @@ class PostDec extends Expr $this->var = $var; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_PostDec'; } } diff --git a/lib/PhpParser/Node/Expr/PostInc.php b/lib/PhpParser/Node/Expr/PostInc.php index 005c443a..df07727a 100644 --- a/lib/PhpParser/Node/Expr/PostInc.php +++ b/lib/PhpParser/Node/Expr/PostInc.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class PostInc extends Expr -{ +class PostInc extends Expr { /** @var Expr Variable */ public $var; @@ -20,11 +19,11 @@ class PostInc extends Expr $this->var = $var; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_PostInc'; } } diff --git a/lib/PhpParser/Node/Expr/PreDec.php b/lib/PhpParser/Node/Expr/PreDec.php index a5ca685a..0aee17fc 100644 --- a/lib/PhpParser/Node/Expr/PreDec.php +++ b/lib/PhpParser/Node/Expr/PreDec.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class PreDec extends Expr -{ +class PreDec extends Expr { /** @var Expr Variable */ public $var; @@ -20,11 +19,11 @@ class PreDec extends Expr $this->var = $var; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var']; } - public function getType() : string { + public function getType(): string { return 'Expr_PreDec'; } } diff --git a/lib/PhpParser/Node/Expr/PreInc.php b/lib/PhpParser/Node/Expr/PreInc.php index 0986c447..f8958a8a 100644 --- a/lib/PhpParser/Node/Expr/PreInc.php +++ b/lib/PhpParser/Node/Expr/PreInc.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class PreInc extends Expr -{ +class PreInc extends Expr { /** @var Expr Variable */ public $var; @@ -20,11 +19,11 @@ class PreInc extends Expr $this->var = $var; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_PreInc'; } } diff --git a/lib/PhpParser/Node/Expr/Print_.php b/lib/PhpParser/Node/Expr/Print_.php index 2d43c2ac..e68568d6 100644 --- a/lib/PhpParser/Node/Expr/Print_.php +++ b/lib/PhpParser/Node/Expr/Print_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Print_ extends Expr -{ +class Print_ extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Print_ extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Print'; } } diff --git a/lib/PhpParser/Node/Expr/PropertyFetch.php b/lib/PhpParser/Node/Expr/PropertyFetch.php index 4281f31c..6cbe1762 100644 --- a/lib/PhpParser/Node/Expr/PropertyFetch.php +++ b/lib/PhpParser/Node/Expr/PropertyFetch.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; -class PropertyFetch extends Expr -{ +class PropertyFetch extends Expr { /** @var Expr Variable holding object */ public $var; /** @var Identifier|Expr Property name */ @@ -25,11 +24,11 @@ class PropertyFetch extends Expr $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'name']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_PropertyFetch'; } } diff --git a/lib/PhpParser/Node/Expr/ShellExec.php b/lib/PhpParser/Node/Expr/ShellExec.php index 537a7cc8..c9c5ade0 100644 --- a/lib/PhpParser/Node/Expr/ShellExec.php +++ b/lib/PhpParser/Node/Expr/ShellExec.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class ShellExec extends Expr -{ +class ShellExec extends Expr { /** @var array Encapsed string array */ public $parts; @@ -20,11 +19,11 @@ class ShellExec extends Expr $this->parts = $parts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['parts']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_ShellExec'; } } diff --git a/lib/PhpParser/Node/Expr/StaticCall.php b/lib/PhpParser/Node/Expr/StaticCall.php index d0d099c4..bb60013d 100644 --- a/lib/PhpParser/Node/Expr/StaticCall.php +++ b/lib/PhpParser/Node/Expr/StaticCall.php @@ -8,8 +8,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\VariadicPlaceholder; -class StaticCall extends CallLike -{ +class StaticCall extends CallLike { /** @var Node\Name|Expr Class name */ public $class; /** @var Identifier|Expr Method name */ @@ -32,11 +31,11 @@ class StaticCall extends CallLike $this->args = $args; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['class', 'name', 'args']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_StaticCall'; } diff --git a/lib/PhpParser/Node/Expr/StaticPropertyFetch.php b/lib/PhpParser/Node/Expr/StaticPropertyFetch.php index 1ee1a25e..dc1afa13 100644 --- a/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +++ b/lib/PhpParser/Node/Expr/StaticPropertyFetch.php @@ -6,8 +6,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Name; use PhpParser\Node\VarLikeIdentifier; -class StaticPropertyFetch extends Expr -{ +class StaticPropertyFetch extends Expr { /** @var Name|Expr Class name */ public $class; /** @var VarLikeIdentifier|Expr Property name */ @@ -26,11 +25,11 @@ class StaticPropertyFetch extends Expr $this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['class', 'name']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_StaticPropertyFetch'; } } diff --git a/lib/PhpParser/Node/Expr/Ternary.php b/lib/PhpParser/Node/Expr/Ternary.php index b3bec472..c72e9af7 100644 --- a/lib/PhpParser/Node/Expr/Ternary.php +++ b/lib/PhpParser/Node/Expr/Ternary.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Ternary extends Expr -{ +class Ternary extends Expr { /** @var Expr Condition */ public $cond; /** @var null|Expr Expression for true */ @@ -28,11 +27,11 @@ class Ternary extends Expr $this->else = $else; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'if', 'else']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Ternary'; } } diff --git a/lib/PhpParser/Node/Expr/Throw_.php b/lib/PhpParser/Node/Expr/Throw_.php index 5c97f0e2..120a0f5e 100644 --- a/lib/PhpParser/Node/Expr/Throw_.php +++ b/lib/PhpParser/Node/Expr/Throw_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node; -class Throw_ extends Node\Expr -{ +class Throw_ extends Node\Expr { /** @var Node\Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Throw_ extends Node\Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string { + public function getType(): string { return 'Expr_Throw'; } } diff --git a/lib/PhpParser/Node/Expr/UnaryMinus.php b/lib/PhpParser/Node/Expr/UnaryMinus.php index ce8808bc..38e57951 100644 --- a/lib/PhpParser/Node/Expr/UnaryMinus.php +++ b/lib/PhpParser/Node/Expr/UnaryMinus.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class UnaryMinus extends Expr -{ +class UnaryMinus extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class UnaryMinus extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_UnaryMinus'; } } diff --git a/lib/PhpParser/Node/Expr/UnaryPlus.php b/lib/PhpParser/Node/Expr/UnaryPlus.php index d23047e5..c6298fae 100644 --- a/lib/PhpParser/Node/Expr/UnaryPlus.php +++ b/lib/PhpParser/Node/Expr/UnaryPlus.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class UnaryPlus extends Expr -{ +class UnaryPlus extends Expr { /** @var Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class UnaryPlus extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_UnaryPlus'; } } diff --git a/lib/PhpParser/Node/Expr/Variable.php b/lib/PhpParser/Node/Expr/Variable.php index b47d38e9..8ae09a16 100644 --- a/lib/PhpParser/Node/Expr/Variable.php +++ b/lib/PhpParser/Node/Expr/Variable.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Variable extends Expr -{ +class Variable extends Expr { /** @var string|Expr Name */ public $name; @@ -20,11 +19,11 @@ class Variable extends Expr $this->name = $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Variable'; } } diff --git a/lib/PhpParser/Node/Expr/YieldFrom.php b/lib/PhpParser/Node/Expr/YieldFrom.php index a3efce61..a88fdeb3 100644 --- a/lib/PhpParser/Node/Expr/YieldFrom.php +++ b/lib/PhpParser/Node/Expr/YieldFrom.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class YieldFrom extends Expr -{ +class YieldFrom extends Expr { /** @var Expr Expression to yield from */ public $expr; @@ -20,11 +19,11 @@ class YieldFrom extends Expr $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_YieldFrom'; } } diff --git a/lib/PhpParser/Node/Expr/Yield_.php b/lib/PhpParser/Node/Expr/Yield_.php index f15336ed..cd214a8a 100644 --- a/lib/PhpParser/Node/Expr/Yield_.php +++ b/lib/PhpParser/Node/Expr/Yield_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; -class Yield_ extends Expr -{ +class Yield_ extends Expr { /** @var null|Expr Key expression */ public $key; /** @var null|Expr Value expression */ @@ -24,11 +23,11 @@ class Yield_ extends Expr $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['key', 'value']; } - - public function getType() : string { + + public function getType(): string { return 'Expr_Yield'; } } diff --git a/lib/PhpParser/Node/FunctionLike.php b/lib/PhpParser/Node/FunctionLike.php index f75ad3bd..0b211d11 100644 --- a/lib/PhpParser/Node/FunctionLike.php +++ b/lib/PhpParser/Node/FunctionLike.php @@ -4,21 +4,20 @@ namespace PhpParser\Node; use PhpParser\Node; -interface FunctionLike extends Node -{ +interface FunctionLike extends Node { /** * Whether to return by reference * * @return bool */ - public function returnsByRef() : bool; + public function returnsByRef(): bool; /** * List of parameters * * @return Param[] */ - public function getParams() : array; + public function getParams(): array; /** * Get the declared return type or null @@ -39,5 +38,5 @@ interface FunctionLike extends Node * * @return AttributeGroup[] */ - public function getAttrGroups() : array; + public function getAttrGroups(): array; } diff --git a/lib/PhpParser/Node/Identifier.php b/lib/PhpParser/Node/Identifier.php index 2f262db0..2695855d 100644 --- a/lib/PhpParser/Node/Identifier.php +++ b/lib/PhpParser/Node/Identifier.php @@ -7,8 +7,7 @@ use PhpParser\NodeAbstract; /** * Represents a non-namespaced name. Namespaced names are represented using Name nodes. */ -class Identifier extends NodeAbstract -{ +class Identifier extends NodeAbstract { /** @var string Identifier as string */ public $name; @@ -29,7 +28,7 @@ class Identifier extends NodeAbstract $this->name = $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name']; } @@ -38,7 +37,7 @@ class Identifier extends NodeAbstract * * @return string Identifier as string. */ - public function toString() : string { + public function toString(): string { return $this->name; } @@ -47,7 +46,7 @@ class Identifier extends NodeAbstract * * @return string Lowercased identifier as string */ - public function toLowerString() : string { + public function toLowerString(): string { return strtolower($this->name); } @@ -56,7 +55,7 @@ class Identifier extends NodeAbstract * * @return bool Whether identifier is a special class name */ - public function isSpecialClassName() : bool { + public function isSpecialClassName(): bool { return isset(self::$specialClassNames[strtolower($this->name)]); } @@ -65,11 +64,11 @@ class Identifier extends NodeAbstract * * @return string Identifier as string */ - public function __toString() : string { + public function __toString(): string { return $this->name; } - - public function getType() : string { + + public function getType(): string { return 'Identifier'; } } diff --git a/lib/PhpParser/Node/IntersectionType.php b/lib/PhpParser/Node/IntersectionType.php index da7a3a85..5b6198b7 100644 --- a/lib/PhpParser/Node/IntersectionType.php +++ b/lib/PhpParser/Node/IntersectionType.php @@ -2,9 +2,7 @@ namespace PhpParser\Node; - -class IntersectionType extends ComplexType -{ +class IntersectionType extends ComplexType { /** @var (Identifier|Name)[] Types */ public $types; @@ -19,11 +17,11 @@ class IntersectionType extends ComplexType $this->types = $types; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['types']; } - public function getType() : string { + public function getType(): string { return 'IntersectionType'; } } diff --git a/lib/PhpParser/Node/MatchArm.php b/lib/PhpParser/Node/MatchArm.php index b0d4bab6..55a7eace 100644 --- a/lib/PhpParser/Node/MatchArm.php +++ b/lib/PhpParser/Node/MatchArm.php @@ -5,8 +5,7 @@ namespace PhpParser\Node; use PhpParser\Node; use PhpParser\NodeAbstract; -class MatchArm extends NodeAbstract -{ +class MatchArm extends NodeAbstract { /** @var null|Node\Expr[] */ public $conds; /** @var Node\Expr */ @@ -21,11 +20,11 @@ class MatchArm extends NodeAbstract $this->attributes = $attributes; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['conds', 'body']; } - public function getType() : string { + public function getType(): string { return 'MatchArm'; } } diff --git a/lib/PhpParser/Node/Name.php b/lib/PhpParser/Node/Name.php index cec304eb..f50e9752 100644 --- a/lib/PhpParser/Node/Name.php +++ b/lib/PhpParser/Node/Name.php @@ -4,8 +4,7 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -class Name extends NodeAbstract -{ +class Name extends NodeAbstract { /** @var string[] Parts of the name */ public $parts; @@ -26,7 +25,7 @@ class Name extends NodeAbstract $this->parts = self::prepareName($name); } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['parts']; } @@ -35,7 +34,7 @@ class Name extends NodeAbstract * * @return string First part of the name */ - public function getFirst() : string { + public function getFirst(): string { return $this->parts[0]; } @@ -44,7 +43,7 @@ class Name extends NodeAbstract * * @return string Last part of the name */ - public function getLast() : string { + public function getLast(): string { return $this->parts[count($this->parts) - 1]; } @@ -53,7 +52,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is unqualified */ - public function isUnqualified() : bool { + public function isUnqualified(): bool { return 1 === count($this->parts); } @@ -62,7 +61,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is qualified */ - public function isQualified() : bool { + public function isQualified(): bool { return 1 < count($this->parts); } @@ -71,7 +70,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is fully qualified */ - public function isFullyQualified() : bool { + public function isFullyQualified(): bool { return false; } @@ -80,7 +79,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is relative */ - public function isRelative() : bool { + public function isRelative(): bool { return false; } @@ -90,7 +89,7 @@ class Name extends NodeAbstract * * @return string String representation */ - public function toString() : string { + public function toString(): string { return implode('\\', $this->parts); } @@ -100,7 +99,7 @@ class Name extends NodeAbstract * * @return string String representation */ - public function toCodeString() : string { + public function toCodeString(): string { return $this->toString(); } @@ -110,7 +109,7 @@ class Name extends NodeAbstract * * @return string Lowercased string representation */ - public function toLowerString() : string { + public function toLowerString(): string { return strtolower(implode('\\', $this->parts)); } @@ -119,7 +118,7 @@ class Name extends NodeAbstract * * @return bool Whether identifier is a special class name */ - public function isSpecialClassName() : bool { + public function isSpecialClassName(): bool { return count($this->parts) === 1 && isset(self::$specialClassNames[strtolower($this->parts[0])]); } @@ -130,7 +129,7 @@ class Name extends NodeAbstract * * @return string String representation */ - public function __toString() : string { + public function __toString(): string { return implode('\\', $this->parts); } @@ -216,7 +215,7 @@ class Name extends NodeAbstract * * @return string[] Prepared name */ - private static function prepareName($name) : array { + private static function prepareName($name): array { if (\is_string($name)) { if ('' === $name) { throw new \InvalidArgumentException('Name cannot be empty'); @@ -240,7 +239,7 @@ class Name extends NodeAbstract ); } - public function getType() : string { + public function getType(): string { return 'Name'; } } diff --git a/lib/PhpParser/Node/Name/FullyQualified.php b/lib/PhpParser/Node/Name/FullyQualified.php index 1df93a56..21183786 100644 --- a/lib/PhpParser/Node/Name/FullyQualified.php +++ b/lib/PhpParser/Node/Name/FullyQualified.php @@ -2,14 +2,13 @@ namespace PhpParser\Node\Name; -class FullyQualified extends \PhpParser\Node\Name -{ +class FullyQualified extends \PhpParser\Node\Name { /** * Checks whether the name is unqualified. (E.g. Name) * * @return bool Whether the name is unqualified */ - public function isUnqualified() : bool { + public function isUnqualified(): bool { return false; } @@ -18,7 +17,7 @@ class FullyQualified extends \PhpParser\Node\Name * * @return bool Whether the name is qualified */ - public function isQualified() : bool { + public function isQualified(): bool { return false; } @@ -27,7 +26,7 @@ class FullyQualified extends \PhpParser\Node\Name * * @return bool Whether the name is fully qualified */ - public function isFullyQualified() : bool { + public function isFullyQualified(): bool { return true; } @@ -36,15 +35,15 @@ class FullyQualified extends \PhpParser\Node\Name * * @return bool Whether the name is relative */ - public function isRelative() : bool { + public function isRelative(): bool { return false; } - public function toCodeString() : string { + public function toCodeString(): string { return '\\' . $this->toString(); } - - public function getType() : string { + + public function getType(): string { return 'Name_FullyQualified'; } } diff --git a/lib/PhpParser/Node/Name/Relative.php b/lib/PhpParser/Node/Name/Relative.php index 57bf7af2..0226a4e4 100644 --- a/lib/PhpParser/Node/Name/Relative.php +++ b/lib/PhpParser/Node/Name/Relative.php @@ -2,14 +2,13 @@ namespace PhpParser\Node\Name; -class Relative extends \PhpParser\Node\Name -{ +class Relative extends \PhpParser\Node\Name { /** * Checks whether the name is unqualified. (E.g. Name) * * @return bool Whether the name is unqualified */ - public function isUnqualified() : bool { + public function isUnqualified(): bool { return false; } @@ -18,7 +17,7 @@ class Relative extends \PhpParser\Node\Name * * @return bool Whether the name is qualified */ - public function isQualified() : bool { + public function isQualified(): bool { return false; } @@ -27,7 +26,7 @@ class Relative extends \PhpParser\Node\Name * * @return bool Whether the name is fully qualified */ - public function isFullyQualified() : bool { + public function isFullyQualified(): bool { return false; } @@ -36,15 +35,15 @@ class Relative extends \PhpParser\Node\Name * * @return bool Whether the name is relative */ - public function isRelative() : bool { + public function isRelative(): bool { return true; } - public function toCodeString() : string { + public function toCodeString(): string { return 'namespace\\' . $this->toString(); } - - public function getType() : string { + + public function getType(): string { return 'Name_Relative'; } } diff --git a/lib/PhpParser/Node/NullableType.php b/lib/PhpParser/Node/NullableType.php index d68e26a3..1b8f6bd3 100644 --- a/lib/PhpParser/Node/NullableType.php +++ b/lib/PhpParser/Node/NullableType.php @@ -2,8 +2,7 @@ namespace PhpParser\Node; -class NullableType extends ComplexType -{ +class NullableType extends ComplexType { /** @var Identifier|Name Type */ public $type; @@ -18,11 +17,11 @@ class NullableType extends ComplexType $this->type = \is_string($type) ? new Identifier($type) : $type; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['type']; } - - public function getType() : string { + + public function getType(): string { return 'NullableType'; } } diff --git a/lib/PhpParser/Node/Param.php b/lib/PhpParser/Node/Param.php index dfb77f62..fe4200a8 100644 --- a/lib/PhpParser/Node/Param.php +++ b/lib/PhpParser/Node/Param.php @@ -4,8 +4,7 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -class Param extends NodeAbstract -{ +class Param extends NodeAbstract { /** @var null|Identifier|Name|ComplexType Type declaration */ public $type; /** @var bool Whether parameter is passed by reference */ @@ -50,11 +49,11 @@ class Param extends NodeAbstract $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default']; } - public function getType() : string { + public function getType(): string { return 'Param'; } } diff --git a/lib/PhpParser/Node/Scalar.php b/lib/PhpParser/Node/Scalar.php index 8117909b..3df25721 100644 --- a/lib/PhpParser/Node/Scalar.php +++ b/lib/PhpParser/Node/Scalar.php @@ -2,6 +2,5 @@ namespace PhpParser\Node; -abstract class Scalar extends Expr -{ +abstract class Scalar extends Expr { } diff --git a/lib/PhpParser/Node/Scalar/DNumber.php b/lib/PhpParser/Node/Scalar/DNumber.php index d4796d65..6a524e56 100644 --- a/lib/PhpParser/Node/Scalar/DNumber.php +++ b/lib/PhpParser/Node/Scalar/DNumber.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Scalar; use PhpParser\Node\Scalar; -class DNumber extends Scalar -{ +class DNumber extends Scalar { /** @var float Number value */ public $value; @@ -20,15 +19,14 @@ class DNumber extends Scalar $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['value']; } /** * @param mixed[] $attributes */ - public static function fromString(string $str, array $attributes = []): DNumber - { + public static function fromString(string $str, array $attributes = []): DNumber { $attributes['rawValue'] = $str; $float = self::parse($str); @@ -44,7 +42,7 @@ class DNumber extends Scalar * * @return float The parsed number */ - public static function parse(string $str) : float { + public static function parse(string $str): float { $str = str_replace('_', '', $str); // if string contains any of .eE just cast it to float @@ -75,7 +73,7 @@ class DNumber extends Scalar return (float) $str; } - public function getType() : string { + public function getType(): string { return 'Scalar_DNumber'; } } diff --git a/lib/PhpParser/Node/Scalar/Encapsed.php b/lib/PhpParser/Node/Scalar/Encapsed.php index fa5d2e26..3ef656d2 100644 --- a/lib/PhpParser/Node/Scalar/Encapsed.php +++ b/lib/PhpParser/Node/Scalar/Encapsed.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Scalar; use PhpParser\Node\Expr; use PhpParser\Node\Scalar; -class Encapsed extends Scalar -{ +class Encapsed extends Scalar { /** @var Expr[] list of string parts */ public $parts; @@ -21,11 +20,11 @@ class Encapsed extends Scalar $this->parts = $parts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['parts']; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_Encapsed'; } } diff --git a/lib/PhpParser/Node/Scalar/EncapsedStringPart.php b/lib/PhpParser/Node/Scalar/EncapsedStringPart.php index bb3194c1..46530b06 100644 --- a/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +++ b/lib/PhpParser/Node/Scalar/EncapsedStringPart.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Scalar; use PhpParser\Node\Scalar; -class EncapsedStringPart extends Scalar -{ +class EncapsedStringPart extends Scalar { /** @var string String value */ public $value; @@ -20,11 +19,11 @@ class EncapsedStringPart extends Scalar $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['value']; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_EncapsedStringPart'; } } diff --git a/lib/PhpParser/Node/Scalar/LNumber.php b/lib/PhpParser/Node/Scalar/LNumber.php index db55ecf3..0991a536 100644 --- a/lib/PhpParser/Node/Scalar/LNumber.php +++ b/lib/PhpParser/Node/Scalar/LNumber.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Scalar; use PhpParser\Error; use PhpParser\Node\Scalar; -class LNumber extends Scalar -{ +class LNumber extends Scalar { /* For use in "kind" attribute */ public const KIND_BIN = 2; public const KIND_OCT = 8; @@ -27,7 +26,7 @@ class LNumber extends Scalar $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['value']; } @@ -40,7 +39,7 @@ class LNumber extends Scalar * * @return LNumber The constructed LNumber, including kind attribute */ - public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false) : LNumber { + public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false): LNumber { $attributes['rawValue'] = $str; $str = str_replace('_', '', $str); @@ -74,7 +73,7 @@ class LNumber extends Scalar return new LNumber(intval($str, 8), $attributes); } - public function getType() : string { + public function getType(): string { return 'Scalar_LNumber'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst.php b/lib/PhpParser/Node/Scalar/MagicConst.php index 941f0c76..c5394870 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst.php +++ b/lib/PhpParser/Node/Scalar/MagicConst.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Scalar; use PhpParser\Node\Scalar; -abstract class MagicConst extends Scalar -{ +abstract class MagicConst extends Scalar { /** * Constructs a magic constant node. * @@ -15,7 +14,7 @@ abstract class MagicConst extends Scalar $this->attributes = $attributes; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return []; } @@ -24,5 +23,5 @@ abstract class MagicConst extends Scalar * * @return string Name of magic constant */ - abstract public function getName() : string; + abstract public function getName(): string; } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Class_.php b/lib/PhpParser/Node/Scalar/MagicConst/Class_.php index 24432847..732ed140 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Class_.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Class_ extends MagicConst -{ - public function getName() : string { +class Class_ extends MagicConst { + public function getName(): string { return '__CLASS__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Class'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Dir.php b/lib/PhpParser/Node/Scalar/MagicConst/Dir.php index 2b618473..64daa713 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Dir.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Dir.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Dir extends MagicConst -{ - public function getName() : string { +class Dir extends MagicConst { + public function getName(): string { return '__DIR__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Dir'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/File.php b/lib/PhpParser/Node/Scalar/MagicConst/File.php index 3422db06..91041f0f 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/File.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/File.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class File extends MagicConst -{ - public function getName() : string { +class File extends MagicConst { + public function getName(): string { return '__FILE__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_File'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Function_.php b/lib/PhpParser/Node/Scalar/MagicConst/Function_.php index 1db65a15..c242d2d9 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Function_.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Function_.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Function_ extends MagicConst -{ - public function getName() : string { +class Function_ extends MagicConst { + public function getName(): string { return '__FUNCTION__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Function'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Line.php b/lib/PhpParser/Node/Scalar/MagicConst/Line.php index 25d3de57..58d8ce39 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Line.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Line.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Line extends MagicConst -{ - public function getName() : string { +class Line extends MagicConst { + public function getName(): string { return '__LINE__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Line'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Method.php b/lib/PhpParser/Node/Scalar/MagicConst/Method.php index d168d56f..47f341f1 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Method.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Method.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Method extends MagicConst -{ - public function getName() : string { +class Method extends MagicConst { + public function getName(): string { return '__METHOD__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Method'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php b/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php index 4fabb751..e9f8c0ea 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Namespace_ extends MagicConst -{ - public function getName() : string { +class Namespace_ extends MagicConst { + public function getName(): string { return '__NAMESPACE__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Namespace'; } } diff --git a/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php b/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php index 5ee7e40a..25f49731 100644 --- a/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php +++ b/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php @@ -4,13 +4,12 @@ namespace PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\MagicConst; -class Trait_ extends MagicConst -{ - public function getName() : string { +class Trait_ extends MagicConst { + public function getName(): string { return '__TRAIT__'; } - - public function getType() : string { + + public function getType(): string { return 'Scalar_MagicConst_Trait'; } } diff --git a/lib/PhpParser/Node/Scalar/String_.php b/lib/PhpParser/Node/Scalar/String_.php index 2c3b8823..d2509011 100644 --- a/lib/PhpParser/Node/Scalar/String_.php +++ b/lib/PhpParser/Node/Scalar/String_.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Scalar; use PhpParser\Error; use PhpParser\Node\Scalar; -class String_ extends Scalar -{ +class String_ extends Scalar { /* For use in "kind" attribute */ public const KIND_SINGLE_QUOTED = 1; public const KIND_DOUBLE_QUOTED = 2; @@ -38,15 +37,14 @@ class String_ extends Scalar $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['value']; } /** * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes */ - public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = true): self - { + public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = true): self { $attributes['kind'] = ($str[0] === "'" || ($str[1] === "'" && ($str[0] === 'b' || $str[0] === 'B'))) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED; @@ -68,7 +66,7 @@ class String_ extends Scalar * * @return string The parsed string */ - public static function parse(string $str, bool $parseUnicodeEscape = true) : string { + public static function parse(string $str, bool $parseUnicodeEscape = true): string { $bLength = 0; if ('b' === $str[0] || 'B' === $str[0]) { $bLength = 1; @@ -98,7 +96,7 @@ class String_ extends Scalar * * @return string String with escape sequences parsed */ - public static function parseEscapeSequences(string $str, ?string $quote, bool $parseUnicodeEscape = true) : string { + public static function parseEscapeSequences(string $str, ?string $quote, bool $parseUnicodeEscape = true): string { if (null !== $quote) { $str = str_replace('\\' . $quote, $quote, $str); } @@ -110,7 +108,7 @@ class String_ extends Scalar return preg_replace_callback( '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~', - function($matches) { + function ($matches) { $str = $matches[1]; if (isset(self::$replacements[$str])) { @@ -136,7 +134,7 @@ class String_ extends Scalar * * @return string UTF-8 representation of code point */ - private static function codePointToUtf8(int $num) : string { + private static function codePointToUtf8(int $num): string { if ($num <= 0x7F) { return chr($num); } @@ -153,7 +151,7 @@ class String_ extends Scalar throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); } - public function getType() : string { + public function getType(): string { return 'Scalar_String'; } } diff --git a/lib/PhpParser/Node/Stmt.php b/lib/PhpParser/Node/Stmt.php index 69d33e57..481d31a9 100644 --- a/lib/PhpParser/Node/Stmt.php +++ b/lib/PhpParser/Node/Stmt.php @@ -4,6 +4,5 @@ namespace PhpParser\Node; use PhpParser\NodeAbstract; -abstract class Stmt extends NodeAbstract -{ +abstract class Stmt extends NodeAbstract { } diff --git a/lib/PhpParser/Node/Stmt/Break_.php b/lib/PhpParser/Node/Stmt/Break_.php index d9464a1a..d76c7dd6 100644 --- a/lib/PhpParser/Node/Stmt/Break_.php +++ b/lib/PhpParser/Node/Stmt/Break_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Break_ extends Node\Stmt -{ +class Break_ extends Node\Stmt { /** @var null|Node\Expr Number of loops to break */ public $num; @@ -20,11 +19,11 @@ class Break_ extends Node\Stmt $this->num = $num; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['num']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Break'; } } diff --git a/lib/PhpParser/Node/Stmt/Case_.php b/lib/PhpParser/Node/Stmt/Case_.php index 8c1ea685..fe825e41 100644 --- a/lib/PhpParser/Node/Stmt/Case_.php +++ b/lib/PhpParser/Node/Stmt/Case_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Case_ extends Node\Stmt -{ +class Case_ extends Node\Stmt { /** @var null|Node\Expr Condition (null for default) */ public $cond; /** @var Node\Stmt[] Statements */ @@ -24,11 +23,11 @@ class Case_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Case'; } } diff --git a/lib/PhpParser/Node/Stmt/Catch_.php b/lib/PhpParser/Node/Stmt/Catch_.php index 5d7b5c01..bbd1f523 100644 --- a/lib/PhpParser/Node/Stmt/Catch_.php +++ b/lib/PhpParser/Node/Stmt/Catch_.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; use PhpParser\Node\Expr; -class Catch_ extends Node\Stmt -{ +class Catch_ extends Node\Stmt { /** @var Node\Name[] Types of exceptions to catch */ public $types; /** @var Expr\Variable|null Variable for exception */ @@ -31,11 +30,11 @@ class Catch_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['types', 'var', 'stmts']; } - public function getType() : string { + public function getType(): string { return 'Stmt_Catch'; } } diff --git a/lib/PhpParser/Node/Stmt/ClassConst.php b/lib/PhpParser/Node/Stmt/ClassConst.php index 308df731..c35f0724 100644 --- a/lib/PhpParser/Node/Stmt/ClassConst.php +++ b/lib/PhpParser/Node/Stmt/ClassConst.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Modifiers; use PhpParser\Node; -class ClassConst extends Node\Stmt -{ +class ClassConst extends Node\Stmt { /** @var int Modifiers */ public $flags; /** @var Node\Const_[] Constant declarations */ @@ -34,7 +33,7 @@ class ClassConst extends Node\Stmt $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'consts']; } @@ -43,7 +42,7 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isPublic() : bool { + public function isPublic(): bool { return ($this->flags & Modifiers::PUBLIC) !== 0 || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; } @@ -53,7 +52,7 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isProtected() : bool { + public function isProtected(): bool { return (bool) ($this->flags & Modifiers::PROTECTED); } @@ -62,7 +61,7 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isPrivate() : bool { + public function isPrivate(): bool { return (bool) ($this->flags & Modifiers::PRIVATE); } @@ -71,11 +70,11 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isFinal() : bool { + public function isFinal(): bool { return (bool) ($this->flags & Modifiers::FINAL); } - public function getType() : string { + public function getType(): string { return 'Stmt_ClassConst'; } } diff --git a/lib/PhpParser/Node/Stmt/ClassLike.php b/lib/PhpParser/Node/Stmt/ClassLike.php index 2a6e5b3f..75814705 100644 --- a/lib/PhpParser/Node/Stmt/ClassLike.php +++ b/lib/PhpParser/Node/Stmt/ClassLike.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -abstract class ClassLike extends Node\Stmt -{ +abstract class ClassLike extends Node\Stmt { /** @var Node\Identifier|null Name */ public $name; /** @var Node\Stmt[] Statements */ @@ -19,7 +18,7 @@ abstract class ClassLike extends Node\Stmt /** * @return TraitUse[] */ - public function getTraitUses() : array { + public function getTraitUses(): array { $traitUses = []; foreach ($this->stmts as $stmt) { if ($stmt instanceof TraitUse) { @@ -32,7 +31,7 @@ abstract class ClassLike extends Node\Stmt /** * @return ClassConst[] */ - public function getConstants() : array { + public function getConstants(): array { $constants = []; foreach ($this->stmts as $stmt) { if ($stmt instanceof ClassConst) { @@ -45,7 +44,7 @@ abstract class ClassLike extends Node\Stmt /** * @return Property[] */ - public function getProperties() : array { + public function getProperties(): array { $properties = []; foreach ($this->stmts as $stmt) { if ($stmt instanceof Property) { @@ -80,7 +79,7 @@ abstract class ClassLike extends Node\Stmt * * @return ClassMethod[] */ - public function getMethods() : array { + public function getMethods(): array { $methods = []; foreach ($this->stmts as $stmt) { if ($stmt instanceof ClassMethod) { diff --git a/lib/PhpParser/Node/Stmt/ClassMethod.php b/lib/PhpParser/Node/Stmt/ClassMethod.php index 69c2f31d..12e44615 100644 --- a/lib/PhpParser/Node/Stmt/ClassMethod.php +++ b/lib/PhpParser/Node/Stmt/ClassMethod.php @@ -6,8 +6,7 @@ use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\FunctionLike; -class ClassMethod extends Node\Stmt implements FunctionLike -{ +class ClassMethod extends Node\Stmt implements FunctionLike { /** @var int Flags */ public $flags; /** @var bool Whether to return by reference */ @@ -68,15 +67,15 @@ class ClassMethod extends Node\Stmt implements FunctionLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'byRef', 'name', 'params', 'returnType', 'stmts']; } - public function returnsByRef() : bool { + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array { + public function getParams(): array { return $this->params; } @@ -88,7 +87,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike return $this->stmts; } - public function getAttrGroups() : array { + public function getAttrGroups(): array { return $this->attrGroups; } @@ -97,7 +96,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isPublic() : bool { + public function isPublic(): bool { return ($this->flags & Modifiers::PUBLIC) !== 0 || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; } @@ -107,7 +106,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isProtected() : bool { + public function isProtected(): bool { return (bool) ($this->flags & Modifiers::PROTECTED); } @@ -116,7 +115,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isPrivate() : bool { + public function isPrivate(): bool { return (bool) ($this->flags & Modifiers::PRIVATE); } @@ -125,7 +124,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isAbstract() : bool { + public function isAbstract(): bool { return (bool) ($this->flags & Modifiers::ABSTRACT); } @@ -134,7 +133,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isFinal() : bool { + public function isFinal(): bool { return (bool) ($this->flags & Modifiers::FINAL); } @@ -143,7 +142,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isStatic() : bool { + public function isStatic(): bool { return (bool) ($this->flags & Modifiers::STATIC); } @@ -152,11 +151,11 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isMagic() : bool { + public function isMagic(): bool { return isset(self::$magicNames[$this->name->toLowerString()]); } - public function getType() : string { + public function getType(): string { return 'Stmt_ClassMethod'; } } diff --git a/lib/PhpParser/Node/Stmt/Class_.php b/lib/PhpParser/Node/Stmt/Class_.php index 0faf2d23..453cffe4 100644 --- a/lib/PhpParser/Node/Stmt/Class_.php +++ b/lib/PhpParser/Node/Stmt/Class_.php @@ -6,8 +6,7 @@ use PhpParser\Error; use PhpParser\Modifiers; use PhpParser\Node; -class Class_ extends ClassLike -{ +class Class_ extends ClassLike { /** @deprecated Use Modifiers::PUBLIC instead */ public const MODIFIER_PUBLIC = 1; /** @deprecated Use Modifiers::PROTECTED instead */ @@ -55,7 +54,7 @@ class Class_ extends ClassLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'name', 'extends', 'implements', 'stmts']; } @@ -64,7 +63,7 @@ class Class_ extends ClassLike * * @return bool */ - public function isAbstract() : bool { + public function isAbstract(): bool { return (bool) ($this->flags & Modifiers::ABSTRACT); } @@ -73,11 +72,11 @@ class Class_ extends ClassLike * * @return bool */ - public function isFinal() : bool { + public function isFinal(): bool { return (bool) ($this->flags & Modifiers::FINAL); } - public function isReadonly() : bool { + public function isReadonly(): bool { return (bool) ($this->flags & Modifiers::READONLY); } @@ -86,7 +85,7 @@ class Class_ extends ClassLike * * @return bool */ - public function isAnonymous() : bool { + public function isAnonymous(): bool { return null === $this->name; } @@ -140,7 +139,7 @@ class Class_ extends ClassLike } } - public function getType() : string { + public function getType(): string { return 'Stmt_Class'; } } diff --git a/lib/PhpParser/Node/Stmt/Const_.php b/lib/PhpParser/Node/Stmt/Const_.php index e6316345..1f97f327 100644 --- a/lib/PhpParser/Node/Stmt/Const_.php +++ b/lib/PhpParser/Node/Stmt/Const_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Const_ extends Node\Stmt -{ +class Const_ extends Node\Stmt { /** @var Node\Const_[] Constant declarations */ public $consts; @@ -20,11 +19,11 @@ class Const_ extends Node\Stmt $this->consts = $consts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['consts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Const'; } } diff --git a/lib/PhpParser/Node/Stmt/Continue_.php b/lib/PhpParser/Node/Stmt/Continue_.php index f2b30d79..4311fb1c 100644 --- a/lib/PhpParser/Node/Stmt/Continue_.php +++ b/lib/PhpParser/Node/Stmt/Continue_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Continue_ extends Node\Stmt -{ +class Continue_ extends Node\Stmt { /** @var null|Node\Expr Number of loops to continue */ public $num; @@ -20,11 +19,11 @@ class Continue_ extends Node\Stmt $this->num = $num; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['num']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Continue'; } } diff --git a/lib/PhpParser/Node/Stmt/DeclareDeclare.php b/lib/PhpParser/Node/Stmt/DeclareDeclare.php index ac07f30c..39df6dae 100644 --- a/lib/PhpParser/Node/Stmt/DeclareDeclare.php +++ b/lib/PhpParser/Node/Stmt/DeclareDeclare.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class DeclareDeclare extends Node\Stmt -{ +class DeclareDeclare extends Node\Stmt { /** @var Node\Identifier Key */ public $key; /** @var Node\Expr Value */ @@ -24,11 +23,11 @@ class DeclareDeclare extends Node\Stmt $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['key', 'value']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_DeclareDeclare'; } } diff --git a/lib/PhpParser/Node/Stmt/Declare_.php b/lib/PhpParser/Node/Stmt/Declare_.php index a3a5bfaa..5a209cf2 100644 --- a/lib/PhpParser/Node/Stmt/Declare_.php +++ b/lib/PhpParser/Node/Stmt/Declare_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Declare_ extends Node\Stmt -{ +class Declare_ extends Node\Stmt { /** @var DeclareDeclare[] List of declares */ public $declares; /** @var Node\Stmt[]|null Statements */ @@ -24,11 +23,11 @@ class Declare_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['declares', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Declare'; } } diff --git a/lib/PhpParser/Node/Stmt/Do_.php b/lib/PhpParser/Node/Stmt/Do_.php index 78e90da0..f8328101 100644 --- a/lib/PhpParser/Node/Stmt/Do_.php +++ b/lib/PhpParser/Node/Stmt/Do_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Do_ extends Node\Stmt -{ +class Do_ extends Node\Stmt { /** @var Node\Stmt[] Statements */ public $stmts; /** @var Node\Expr Condition */ @@ -24,11 +23,11 @@ class Do_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['stmts', 'cond']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Do'; } } diff --git a/lib/PhpParser/Node/Stmt/Echo_.php b/lib/PhpParser/Node/Stmt/Echo_.php index 7cc50d5d..040f398a 100644 --- a/lib/PhpParser/Node/Stmt/Echo_.php +++ b/lib/PhpParser/Node/Stmt/Echo_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Echo_ extends Node\Stmt -{ +class Echo_ extends Node\Stmt { /** @var Node\Expr[] Expressions */ public $exprs; @@ -20,11 +19,11 @@ class Echo_ extends Node\Stmt $this->exprs = $exprs; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['exprs']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Echo'; } } diff --git a/lib/PhpParser/Node/Stmt/ElseIf_.php b/lib/PhpParser/Node/Stmt/ElseIf_.php index eef1ece3..5d951695 100644 --- a/lib/PhpParser/Node/Stmt/ElseIf_.php +++ b/lib/PhpParser/Node/Stmt/ElseIf_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class ElseIf_ extends Node\Stmt -{ +class ElseIf_ extends Node\Stmt { /** @var Node\Expr Condition */ public $cond; /** @var Node\Stmt[] Statements */ @@ -24,11 +23,11 @@ class ElseIf_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_ElseIf'; } } diff --git a/lib/PhpParser/Node/Stmt/Else_.php b/lib/PhpParser/Node/Stmt/Else_.php index 0e61778e..03cf37a8 100644 --- a/lib/PhpParser/Node/Stmt/Else_.php +++ b/lib/PhpParser/Node/Stmt/Else_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Else_ extends Node\Stmt -{ +class Else_ extends Node\Stmt { /** @var Node\Stmt[] Statements */ public $stmts; @@ -20,11 +19,11 @@ class Else_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Else'; } } diff --git a/lib/PhpParser/Node/Stmt/EnumCase.php b/lib/PhpParser/Node/Stmt/EnumCase.php index 4b1079bc..e1fa9711 100644 --- a/lib/PhpParser/Node/Stmt/EnumCase.php +++ b/lib/PhpParser/Node/Stmt/EnumCase.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; use PhpParser\Node\AttributeGroup; -class EnumCase extends Node\Stmt -{ +class EnumCase extends Node\Stmt { /** @var Node\Identifier Enum case name */ public $name; /** @var Node\Expr|null Enum case expression */ @@ -27,11 +26,11 @@ class EnumCase extends Node\Stmt $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'expr']; } - public function getType() : string { + public function getType(): string { return 'Stmt_EnumCase'; } } diff --git a/lib/PhpParser/Node/Stmt/Enum_.php b/lib/PhpParser/Node/Stmt/Enum_.php index 3a50c225..640745bd 100644 --- a/lib/PhpParser/Node/Stmt/Enum_.php +++ b/lib/PhpParser/Node/Stmt/Enum_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Enum_ extends ClassLike -{ +class Enum_ extends ClassLike { /** @var null|Node\Identifier Scalar Type */ public $scalarType; /** @var Node\Name[] Names of implemented interfaces */ @@ -30,11 +29,11 @@ class Enum_ extends ClassLike parent::__construct($attributes); } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'scalarType', 'implements', 'stmts']; } - public function getType() : string { + public function getType(): string { return 'Stmt_Enum'; } } diff --git a/lib/PhpParser/Node/Stmt/Expression.php b/lib/PhpParser/Node/Stmt/Expression.php index 99d1687d..df9ad71f 100644 --- a/lib/PhpParser/Node/Stmt/Expression.php +++ b/lib/PhpParser/Node/Stmt/Expression.php @@ -7,8 +7,7 @@ use PhpParser\Node; /** * Represents statements of type "expr;" */ -class Expression extends Node\Stmt -{ +class Expression extends Node\Stmt { /** @var Node\Expr Expression */ public $expr; @@ -23,11 +22,11 @@ class Expression extends Node\Stmt $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Expression'; } } diff --git a/lib/PhpParser/Node/Stmt/Finally_.php b/lib/PhpParser/Node/Stmt/Finally_.php index d55b8b68..351550e7 100644 --- a/lib/PhpParser/Node/Stmt/Finally_.php +++ b/lib/PhpParser/Node/Stmt/Finally_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Finally_ extends Node\Stmt -{ +class Finally_ extends Node\Stmt { /** @var Node\Stmt[] Statements */ public $stmts; @@ -20,11 +19,11 @@ class Finally_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Finally'; } } diff --git a/lib/PhpParser/Node/Stmt/For_.php b/lib/PhpParser/Node/Stmt/For_.php index 1323d37c..7afd2e25 100644 --- a/lib/PhpParser/Node/Stmt/For_.php +++ b/lib/PhpParser/Node/Stmt/For_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class For_ extends Node\Stmt -{ +class For_ extends Node\Stmt { /** @var Node\Expr[] Init expressions */ public $init; /** @var Node\Expr[] Loop conditions */ @@ -33,11 +32,11 @@ class For_ extends Node\Stmt $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['init', 'cond', 'loop', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_For'; } } diff --git a/lib/PhpParser/Node/Stmt/Foreach_.php b/lib/PhpParser/Node/Stmt/Foreach_.php index 0556a7ce..b0230cfe 100644 --- a/lib/PhpParser/Node/Stmt/Foreach_.php +++ b/lib/PhpParser/Node/Stmt/Foreach_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Foreach_ extends Node\Stmt -{ +class Foreach_ extends Node\Stmt { /** @var Node\Expr Expression to iterate */ public $expr; /** @var null|Node\Expr Variable to assign key to */ @@ -37,11 +36,11 @@ class Foreach_ extends Node\Stmt $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr', 'keyVar', 'byRef', 'valueVar', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Foreach'; } } diff --git a/lib/PhpParser/Node/Stmt/Function_.php b/lib/PhpParser/Node/Stmt/Function_.php index c2ccae24..e47554a3 100644 --- a/lib/PhpParser/Node/Stmt/Function_.php +++ b/lib/PhpParser/Node/Stmt/Function_.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; use PhpParser\Node\FunctionLike; -class Function_ extends Node\Stmt implements FunctionLike -{ +class Function_ extends Node\Stmt implements FunctionLike { /** @var bool Whether function returns by reference */ public $byRef; /** @var Node\Identifier Name */ @@ -46,15 +45,15 @@ class Function_ extends Node\Stmt implements FunctionLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts']; } - public function returnsByRef() : bool { + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array { + public function getParams(): array { return $this->params; } @@ -62,16 +61,16 @@ class Function_ extends Node\Stmt implements FunctionLike return $this->returnType; } - public function getAttrGroups() : array { + public function getAttrGroups(): array { return $this->attrGroups; } /** @return Node\Stmt[] */ - public function getStmts() : array { + public function getStmts(): array { return $this->stmts; } - public function getType() : string { + public function getType(): string { return 'Stmt_Function'; } } diff --git a/lib/PhpParser/Node/Stmt/Global_.php b/lib/PhpParser/Node/Stmt/Global_.php index a0022ad9..e46b3a80 100644 --- a/lib/PhpParser/Node/Stmt/Global_.php +++ b/lib/PhpParser/Node/Stmt/Global_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Global_ extends Node\Stmt -{ +class Global_ extends Node\Stmt { /** @var Node\Expr[] Variables */ public $vars; @@ -20,11 +19,11 @@ class Global_ extends Node\Stmt $this->vars = $vars; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['vars']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Global'; } } diff --git a/lib/PhpParser/Node/Stmt/Goto_.php b/lib/PhpParser/Node/Stmt/Goto_.php index 24a57f78..b846faaa 100644 --- a/lib/PhpParser/Node/Stmt/Goto_.php +++ b/lib/PhpParser/Node/Stmt/Goto_.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; -class Goto_ extends Stmt -{ +class Goto_ extends Stmt { /** @var Identifier Name of label to jump to */ public $name; @@ -21,11 +20,11 @@ class Goto_ extends Stmt $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Goto'; } } diff --git a/lib/PhpParser/Node/Stmt/GroupUse.php b/lib/PhpParser/Node/Stmt/GroupUse.php index 24520d22..0a041395 100644 --- a/lib/PhpParser/Node/Stmt/GroupUse.php +++ b/lib/PhpParser/Node/Stmt/GroupUse.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Name; use PhpParser\Node\Stmt; -class GroupUse extends Stmt -{ +class GroupUse extends Stmt { /** @var int Type of group use */ public $type; /** @var Name Prefix for uses */ @@ -29,11 +28,11 @@ class GroupUse extends Stmt $this->uses = $uses; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['type', 'prefix', 'uses']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_GroupUse'; } } diff --git a/lib/PhpParser/Node/Stmt/HaltCompiler.php b/lib/PhpParser/Node/Stmt/HaltCompiler.php index 8e624e0f..43163750 100644 --- a/lib/PhpParser/Node/Stmt/HaltCompiler.php +++ b/lib/PhpParser/Node/Stmt/HaltCompiler.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Stmt; -class HaltCompiler extends Stmt -{ +class HaltCompiler extends Stmt { /** @var string Remaining text after halt compiler statement. */ public $remaining; @@ -20,11 +19,11 @@ class HaltCompiler extends Stmt $this->remaining = $remaining; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['remaining']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_HaltCompiler'; } } diff --git a/lib/PhpParser/Node/Stmt/If_.php b/lib/PhpParser/Node/Stmt/If_.php index a1bae4bf..57c9290e 100644 --- a/lib/PhpParser/Node/Stmt/If_.php +++ b/lib/PhpParser/Node/Stmt/If_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class If_ extends Node\Stmt -{ +class If_ extends Node\Stmt { /** @var Node\Expr Condition expression */ public $cond; /** @var Node\Stmt[] Statements */ @@ -33,11 +32,11 @@ class If_ extends Node\Stmt $this->else = $subNodes['else'] ?? null; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'stmts', 'elseifs', 'else']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_If'; } } diff --git a/lib/PhpParser/Node/Stmt/InlineHTML.php b/lib/PhpParser/Node/Stmt/InlineHTML.php index 0711d284..f27ce0fc 100644 --- a/lib/PhpParser/Node/Stmt/InlineHTML.php +++ b/lib/PhpParser/Node/Stmt/InlineHTML.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Stmt; -class InlineHTML extends Stmt -{ +class InlineHTML extends Stmt { /** @var string String */ public $value; @@ -20,11 +19,11 @@ class InlineHTML extends Stmt $this->value = $value; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['value']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_InlineHTML'; } } diff --git a/lib/PhpParser/Node/Stmt/Interface_.php b/lib/PhpParser/Node/Stmt/Interface_.php index 4d587dd4..175d2a51 100644 --- a/lib/PhpParser/Node/Stmt/Interface_.php +++ b/lib/PhpParser/Node/Stmt/Interface_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Interface_ extends ClassLike -{ +class Interface_ extends ClassLike { /** @var Node\Name[] Extended interfaces */ public $extends; @@ -27,11 +26,11 @@ class Interface_ extends ClassLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'extends', 'stmts']; } - public function getType() : string { + public function getType(): string { return 'Stmt_Interface'; } } diff --git a/lib/PhpParser/Node/Stmt/Label.php b/lib/PhpParser/Node/Stmt/Label.php index 3edcb3be..e4a103b0 100644 --- a/lib/PhpParser/Node/Stmt/Label.php +++ b/lib/PhpParser/Node/Stmt/Label.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; -class Label extends Stmt -{ +class Label extends Stmt { /** @var Identifier Name */ public $name; @@ -21,11 +20,11 @@ class Label extends Stmt $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Label'; } } diff --git a/lib/PhpParser/Node/Stmt/Namespace_.php b/lib/PhpParser/Node/Stmt/Namespace_.php index a7e9ee10..7ae38f4b 100644 --- a/lib/PhpParser/Node/Stmt/Namespace_.php +++ b/lib/PhpParser/Node/Stmt/Namespace_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Namespace_ extends Node\Stmt -{ +class Namespace_ extends Node\Stmt { /* For use in the "kind" attribute */ public const KIND_SEMICOLON = 1; public const KIND_BRACED = 2; @@ -28,11 +27,11 @@ class Namespace_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Namespace'; } } diff --git a/lib/PhpParser/Node/Stmt/Nop.php b/lib/PhpParser/Node/Stmt/Nop.php index f86f8df7..3acfa46f 100644 --- a/lib/PhpParser/Node/Stmt/Nop.php +++ b/lib/PhpParser/Node/Stmt/Nop.php @@ -5,13 +5,12 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; /** Nop/empty statement (;). */ -class Nop extends Node\Stmt -{ - public function getSubNodeNames() : array { +class Nop extends Node\Stmt { + public function getSubNodeNames(): array { return []; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Nop'; } } diff --git a/lib/PhpParser/Node/Stmt/Property.php b/lib/PhpParser/Node/Stmt/Property.php index fb8a38f5..304db47f 100644 --- a/lib/PhpParser/Node/Stmt/Property.php +++ b/lib/PhpParser/Node/Stmt/Property.php @@ -8,8 +8,7 @@ use PhpParser\Node\ComplexType; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -class Property extends Node\Stmt -{ +class Property extends Node\Stmt { /** @var int Modifiers */ public $flags; /** @var PropertyProperty[] Properties */ @@ -36,7 +35,7 @@ class Property extends Node\Stmt $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'type', 'props']; } @@ -45,7 +44,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isPublic() : bool { + public function isPublic(): bool { return ($this->flags & Modifiers::PUBLIC) !== 0 || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; } @@ -55,7 +54,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isProtected() : bool { + public function isProtected(): bool { return (bool) ($this->flags & Modifiers::PROTECTED); } @@ -64,7 +63,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isPrivate() : bool { + public function isPrivate(): bool { return (bool) ($this->flags & Modifiers::PRIVATE); } @@ -73,7 +72,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isStatic() : bool { + public function isStatic(): bool { return (bool) ($this->flags & Modifiers::STATIC); } @@ -82,11 +81,11 @@ class Property extends Node\Stmt * * @return bool */ - public function isReadonly() : bool { + public function isReadonly(): bool { return (bool) ($this->flags & Modifiers::READONLY); } - public function getType() : string { + public function getType(): string { return 'Stmt_Property'; } } diff --git a/lib/PhpParser/Node/Stmt/PropertyProperty.php b/lib/PhpParser/Node/Stmt/PropertyProperty.php index 286b4296..69fb3b99 100644 --- a/lib/PhpParser/Node/Stmt/PropertyProperty.php +++ b/lib/PhpParser/Node/Stmt/PropertyProperty.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class PropertyProperty extends Node\Stmt -{ +class PropertyProperty extends Node\Stmt { /** @var Node\VarLikeIdentifier Name */ public $name; /** @var null|Node\Expr Default */ @@ -24,11 +23,11 @@ class PropertyProperty extends Node\Stmt $this->default = $default; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['name', 'default']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_PropertyProperty'; } } diff --git a/lib/PhpParser/Node/Stmt/Return_.php b/lib/PhpParser/Node/Stmt/Return_.php index 53731254..726220ab 100644 --- a/lib/PhpParser/Node/Stmt/Return_.php +++ b/lib/PhpParser/Node/Stmt/Return_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Return_ extends Node\Stmt -{ +class Return_ extends Node\Stmt { /** @var null|Node\Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Return_ extends Node\Stmt $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Return'; } } diff --git a/lib/PhpParser/Node/Stmt/StaticVar.php b/lib/PhpParser/Node/Stmt/StaticVar.php index 0cc47b41..cb5f507d 100644 --- a/lib/PhpParser/Node/Stmt/StaticVar.php +++ b/lib/PhpParser/Node/Stmt/StaticVar.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; use PhpParser\Node\Expr; -class StaticVar extends Node\Stmt -{ +class StaticVar extends Node\Stmt { /** @var Expr\Variable Variable */ public $var; /** @var null|Node\Expr Default value */ @@ -27,11 +26,11 @@ class StaticVar extends Node\Stmt $this->default = $default; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['var', 'default']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_StaticVar'; } } diff --git a/lib/PhpParser/Node/Stmt/Static_.php b/lib/PhpParser/Node/Stmt/Static_.php index 464898ff..f53665fe 100644 --- a/lib/PhpParser/Node/Stmt/Static_.php +++ b/lib/PhpParser/Node/Stmt/Static_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Stmt; -class Static_ extends Stmt -{ +class Static_ extends Stmt { /** @var StaticVar[] Variable definitions */ public $vars; @@ -20,11 +19,11 @@ class Static_ extends Stmt $this->vars = $vars; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['vars']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Static'; } } diff --git a/lib/PhpParser/Node/Stmt/Switch_.php b/lib/PhpParser/Node/Stmt/Switch_.php index 2c8dae02..b5c560ec 100644 --- a/lib/PhpParser/Node/Stmt/Switch_.php +++ b/lib/PhpParser/Node/Stmt/Switch_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Switch_ extends Node\Stmt -{ +class Switch_ extends Node\Stmt { /** @var Node\Expr Condition */ public $cond; /** @var Case_[] Case list */ @@ -24,11 +23,11 @@ class Switch_ extends Node\Stmt $this->cases = $cases; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'cases']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Switch'; } } diff --git a/lib/PhpParser/Node/Stmt/Throw_.php b/lib/PhpParser/Node/Stmt/Throw_.php index a34e2b36..a22d4096 100644 --- a/lib/PhpParser/Node/Stmt/Throw_.php +++ b/lib/PhpParser/Node/Stmt/Throw_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Throw_ extends Node\Stmt -{ +class Throw_ extends Node\Stmt { /** @var Node\Expr Expression */ public $expr; @@ -20,11 +19,11 @@ class Throw_ extends Node\Stmt $this->expr = $expr; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['expr']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Throw'; } } diff --git a/lib/PhpParser/Node/Stmt/TraitUse.php b/lib/PhpParser/Node/Stmt/TraitUse.php index 9e97053b..7f6d3181 100644 --- a/lib/PhpParser/Node/Stmt/TraitUse.php +++ b/lib/PhpParser/Node/Stmt/TraitUse.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class TraitUse extends Node\Stmt -{ +class TraitUse extends Node\Stmt { /** @var Node\Name[] Traits */ public $traits; /** @var TraitUseAdaptation[] Adaptations */ @@ -24,11 +23,11 @@ class TraitUse extends Node\Stmt $this->adaptations = $adaptations; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['traits', 'adaptations']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_TraitUse'; } } diff --git a/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php b/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php index 8bdd2c04..601a2656 100644 --- a/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +++ b/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -abstract class TraitUseAdaptation extends Node\Stmt -{ +abstract class TraitUseAdaptation extends Node\Stmt { /** @var Node\Name|null Trait name */ public $trait; /** @var Node\Identifier Method name */ diff --git a/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php b/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php index f285640a..a4ef555c 100644 --- a/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +++ b/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt\TraitUseAdaptation; use PhpParser\Node; -class Alias extends Node\Stmt\TraitUseAdaptation -{ +class Alias extends Node\Stmt\TraitUseAdaptation { /** @var null|int New modifier */ public $newModifier; /** @var null|Node\Identifier New name */ @@ -28,11 +27,11 @@ class Alias extends Node\Stmt\TraitUseAdaptation $this->newName = \is_string($newName) ? new Node\Identifier($newName) : $newName; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['trait', 'method', 'newModifier', 'newName']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_TraitUseAdaptation_Alias'; } } diff --git a/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php b/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php index 80385f64..258386af 100644 --- a/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +++ b/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt\TraitUseAdaptation; use PhpParser\Node; -class Precedence extends Node\Stmt\TraitUseAdaptation -{ +class Precedence extends Node\Stmt\TraitUseAdaptation { /** @var Node\Name[] Overwritten traits */ public $insteadof; @@ -24,11 +23,11 @@ class Precedence extends Node\Stmt\TraitUseAdaptation $this->insteadof = $insteadof; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['trait', 'method', 'insteadof']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_TraitUseAdaptation_Precedence'; } } diff --git a/lib/PhpParser/Node/Stmt/Trait_.php b/lib/PhpParser/Node/Stmt/Trait_.php index 0cec203a..a1c208ca 100644 --- a/lib/PhpParser/Node/Stmt/Trait_.php +++ b/lib/PhpParser/Node/Stmt/Trait_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Trait_ extends ClassLike -{ +class Trait_ extends ClassLike { /** * Constructs a trait node. * @@ -22,11 +21,11 @@ class Trait_ extends ClassLike $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'stmts']; } - public function getType() : string { + public function getType(): string { return 'Stmt_Trait'; } } diff --git a/lib/PhpParser/Node/Stmt/TryCatch.php b/lib/PhpParser/Node/Stmt/TryCatch.php index 74e00438..3587d6ba 100644 --- a/lib/PhpParser/Node/Stmt/TryCatch.php +++ b/lib/PhpParser/Node/Stmt/TryCatch.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class TryCatch extends Node\Stmt -{ +class TryCatch extends Node\Stmt { /** @var Node\Stmt[] Statements */ public $stmts; /** @var Catch_[] Catches */ @@ -28,11 +27,11 @@ class TryCatch extends Node\Stmt $this->finally = $finally; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['stmts', 'catches', 'finally']; } - public function getType() : string { + public function getType(): string { return 'Stmt_TryCatch'; } } diff --git a/lib/PhpParser/Node/Stmt/Unset_.php b/lib/PhpParser/Node/Stmt/Unset_.php index 310e427a..74ae1664 100644 --- a/lib/PhpParser/Node/Stmt/Unset_.php +++ b/lib/PhpParser/Node/Stmt/Unset_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Unset_ extends Node\Stmt -{ +class Unset_ extends Node\Stmt { /** @var Node\Expr[] Variables to unset */ public $vars; @@ -20,11 +19,11 @@ class Unset_ extends Node\Stmt $this->vars = $vars; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['vars']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Unset'; } } diff --git a/lib/PhpParser/Node/Stmt/UseUse.php b/lib/PhpParser/Node/Stmt/UseUse.php index 32bd7847..b6a3bfdc 100644 --- a/lib/PhpParser/Node/Stmt/UseUse.php +++ b/lib/PhpParser/Node/Stmt/UseUse.php @@ -5,8 +5,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; use PhpParser\Node\Identifier; -class UseUse extends Node\Stmt -{ +class UseUse extends Node\Stmt { /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */ public $type; /** @var Node\Name Namespace, class, function or constant to alias */ @@ -29,7 +28,7 @@ class UseUse extends Node\Stmt $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['type', 'name', 'alias']; } @@ -38,15 +37,15 @@ class UseUse extends Node\Stmt * * @return Identifier */ - public function getAlias() : Identifier { + public function getAlias(): Identifier { if (null !== $this->alias) { return $this->alias; } return new Identifier($this->name->getLast()); } - - public function getType() : string { + + public function getType(): string { return 'Stmt_UseUse'; } } diff --git a/lib/PhpParser/Node/Stmt/Use_.php b/lib/PhpParser/Node/Stmt/Use_.php index 4b25be1a..150ee57e 100644 --- a/lib/PhpParser/Node/Stmt/Use_.php +++ b/lib/PhpParser/Node/Stmt/Use_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Stmt; -class Use_ extends Stmt -{ +class Use_ extends Stmt { /** * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the @@ -37,11 +36,11 @@ class Use_ extends Stmt $this->uses = $uses; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['type', 'uses']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_Use'; } } diff --git a/lib/PhpParser/Node/Stmt/While_.php b/lib/PhpParser/Node/Stmt/While_.php index f41034f8..f13b7e7a 100644 --- a/lib/PhpParser/Node/Stmt/While_.php +++ b/lib/PhpParser/Node/Stmt/While_.php @@ -4,8 +4,7 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node; -class While_ extends Node\Stmt -{ +class While_ extends Node\Stmt { /** @var Node\Expr Condition */ public $cond; /** @var Node\Stmt[] Statements */ @@ -24,11 +23,11 @@ class While_ extends Node\Stmt $this->stmts = $stmts; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['cond', 'stmts']; } - - public function getType() : string { + + public function getType(): string { return 'Stmt_While'; } } diff --git a/lib/PhpParser/Node/UnionType.php b/lib/PhpParser/Node/UnionType.php index 51ecec2a..24f45973 100644 --- a/lib/PhpParser/Node/UnionType.php +++ b/lib/PhpParser/Node/UnionType.php @@ -2,8 +2,7 @@ namespace PhpParser\Node; -class UnionType extends ComplexType -{ +class UnionType extends ComplexType { /** @var (Identifier|Name)[] Types */ public $types; @@ -18,11 +17,11 @@ class UnionType extends ComplexType $this->types = $types; } - public function getSubNodeNames() : array { + public function getSubNodeNames(): array { return ['types']; } - - public function getType() : string { + + public function getType(): string { return 'UnionType'; } } diff --git a/lib/PhpParser/Node/VarLikeIdentifier.php b/lib/PhpParser/Node/VarLikeIdentifier.php index a30807a6..9baa6fe0 100644 --- a/lib/PhpParser/Node/VarLikeIdentifier.php +++ b/lib/PhpParser/Node/VarLikeIdentifier.php @@ -9,9 +9,8 @@ namespace PhpParser\Node; * Examples: Names in property declarations are formatted as variables. Names in static property * lookups are also formatted as variables. */ -class VarLikeIdentifier extends Identifier -{ - public function getType() : string { +class VarLikeIdentifier extends Identifier { + public function getType(): string { return 'VarLikeIdentifier'; } } diff --git a/lib/PhpParser/NodeAbstract.php b/lib/PhpParser/NodeAbstract.php index 02ef56eb..358b62ec 100644 --- a/lib/PhpParser/NodeAbstract.php +++ b/lib/PhpParser/NodeAbstract.php @@ -2,8 +2,7 @@ namespace PhpParser; -abstract class NodeAbstract implements Node, \JsonSerializable -{ +abstract class NodeAbstract implements Node, \JsonSerializable { protected $attributes; /** @@ -20,7 +19,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Start line (or -1 if not available) */ - public function getLine() : int { + public function getLine(): int { return $this->attributes['startLine'] ?? -1; } @@ -31,7 +30,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Start line (or -1 if not available) */ - public function getStartLine() : int { + public function getStartLine(): int { return $this->attributes['startLine'] ?? -1; } @@ -42,7 +41,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int End line (or -1 if not available) */ - public function getEndLine() : int { + public function getEndLine(): int { return $this->attributes['endLine'] ?? -1; } @@ -55,7 +54,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Token start position (or -1 if not available) */ - public function getStartTokenPos() : int { + public function getStartTokenPos(): int { return $this->attributes['startTokenPos'] ?? -1; } @@ -68,7 +67,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Token end position (or -1 if not available) */ - public function getEndTokenPos() : int { + public function getEndTokenPos(): int { return $this->attributes['endTokenPos'] ?? -1; } @@ -79,7 +78,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int File start position (or -1 if not available) */ - public function getStartFilePos() : int { + public function getStartFilePos(): int { return $this->attributes['startFilePos'] ?? -1; } @@ -90,7 +89,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int File end position (or -1 if not available) */ - public function getEndFilePos() : int { + public function getEndFilePos(): int { return $this->attributes['endFilePos'] ?? -1; } @@ -101,7 +100,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return Comment[] */ - public function getComments() : array { + public function getComments(): array { return $this->attributes['comments'] ?? []; } @@ -149,7 +148,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable $this->attributes[$key] = $value; } - public function hasAttribute(string $key) : bool { + public function hasAttribute(string $key): bool { return array_key_exists($key, $this->attributes); } @@ -161,7 +160,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable return $default; } - public function getAttributes() : array { + public function getAttributes(): array { return $this->attributes; } @@ -172,7 +171,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable /** * @return array */ - public function jsonSerialize() : array { + public function jsonSerialize(): array { return ['nodeType' => $this->getType()] + get_object_vars($this); } } diff --git a/lib/PhpParser/NodeDumper.php b/lib/PhpParser/NodeDumper.php index ab834cbf..56a6ac82 100644 --- a/lib/PhpParser/NodeDumper.php +++ b/lib/PhpParser/NodeDumper.php @@ -8,8 +8,7 @@ use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; use PhpParser\Node\Stmt\UseUse; -class NodeDumper -{ +class NodeDumper { private $dumpComments; private $dumpPositions; private $code; @@ -39,7 +38,7 @@ class NodeDumper * * @return string Dumped value */ - public function dump($node, ?string $code = null) : string { + public function dump($node, ?string $code = null): string { $this->code = $code; return $this->dumpRecursive($node); } diff --git a/lib/PhpParser/NodeFinder.php b/lib/PhpParser/NodeFinder.php index fa0c0fa1..079c4c1c 100644 --- a/lib/PhpParser/NodeFinder.php +++ b/lib/PhpParser/NodeFinder.php @@ -5,8 +5,7 @@ namespace PhpParser; use PhpParser\NodeVisitor\FindingVisitor; use PhpParser\NodeVisitor\FirstFindingVisitor; -class NodeFinder -{ +class NodeFinder { /** * Find all nodes satisfying a filter callback. * @@ -15,14 +14,14 @@ class NodeFinder * * @return Node[] Found nodes satisfying the filter callback */ - public function find($nodes, callable $filter) : array { + public function find($nodes, callable $filter): array { if (!is_array($nodes)) { $nodes = [$nodes]; } $visitor = new FindingVisitor($filter); - $traverser = new NodeTraverser; + $traverser = new NodeTraverser(); $traverser->addVisitor($visitor); $traverser->traverse($nodes); @@ -39,7 +38,7 @@ class NodeFinder * * @return TNode[] Found nodes (all instances of $class) */ - public function findInstanceOf($nodes, string $class) : array { + public function findInstanceOf($nodes, string $class): array { return $this->find($nodes, function ($node) use ($class) { return $node instanceof $class; }); @@ -60,7 +59,7 @@ class NodeFinder $visitor = new FirstFindingVisitor($filter); - $traverser = new NodeTraverser; + $traverser = new NodeTraverser(); $traverser->addVisitor($visitor); $traverser->traverse($nodes); diff --git a/lib/PhpParser/NodeTraverser.php b/lib/PhpParser/NodeTraverser.php index 7f886f21..781caa58 100644 --- a/lib/PhpParser/NodeTraverser.php +++ b/lib/PhpParser/NodeTraverser.php @@ -2,8 +2,7 @@ namespace PhpParser; -class NodeTraverser implements NodeTraverserInterface -{ +class NodeTraverser implements NodeTraverserInterface { /** * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes * of the current node will not be traversed for any visitors. @@ -79,7 +78,7 @@ class NodeTraverser implements NodeTraverserInterface * * @return Node[] Traversed array of nodes */ - public function traverse(array $nodes) : array { + public function traverse(array $nodes): array { $this->stopTraversal = false; foreach ($this->visitors as $visitor) { @@ -106,7 +105,7 @@ class NodeTraverser implements NodeTraverserInterface * * @return Node Result of traversal (may be original node or new one) */ - protected function traverseNode(Node $node) : Node { + protected function traverseNode(Node $node): Node { foreach ($node->getSubNodeNames() as $name) { $subNode =& $node->$name; @@ -188,7 +187,7 @@ class NodeTraverser implements NodeTraverserInterface * * @return array Result of traversal (may be original array or changed one) */ - protected function traverseArray(array $nodes) : array { + protected function traverseArray(array $nodes): array { $doNodes = []; foreach ($nodes as $i => &$node) { diff --git a/lib/PhpParser/NodeTraverserInterface.php b/lib/PhpParser/NodeTraverserInterface.php index 77ff3d27..383103e3 100644 --- a/lib/PhpParser/NodeTraverserInterface.php +++ b/lib/PhpParser/NodeTraverserInterface.php @@ -2,8 +2,7 @@ namespace PhpParser; -interface NodeTraverserInterface -{ +interface NodeTraverserInterface { /** * Adds a visitor. * @@ -25,5 +24,5 @@ interface NodeTraverserInterface * * @return Node[] Traversed array of nodes */ - public function traverse(array $nodes) : array; + public function traverse(array $nodes): array; } diff --git a/lib/PhpParser/NodeVisitor.php b/lib/PhpParser/NodeVisitor.php index f1f7f3e3..5cd92341 100644 --- a/lib/PhpParser/NodeVisitor.php +++ b/lib/PhpParser/NodeVisitor.php @@ -2,8 +2,7 @@ namespace PhpParser; -interface NodeVisitor -{ +interface NodeVisitor { /** * Called once before traversal. * diff --git a/lib/PhpParser/NodeVisitor/CloningVisitor.php b/lib/PhpParser/NodeVisitor/CloningVisitor.php index a85fa493..cba92499 100644 --- a/lib/PhpParser/NodeVisitor/CloningVisitor.php +++ b/lib/PhpParser/NodeVisitor/CloningVisitor.php @@ -10,8 +10,7 @@ use PhpParser\NodeVisitorAbstract; * * This visitor is required to perform format-preserving pretty prints. */ -class CloningVisitor extends NodeVisitorAbstract -{ +class CloningVisitor extends NodeVisitorAbstract { public function enterNode(Node $origNode) { $node = clone $origNode; $node->setAttribute('origNode', $origNode); diff --git a/lib/PhpParser/NodeVisitor/FindingVisitor.php b/lib/PhpParser/NodeVisitor/FindingVisitor.php index 38abbdb7..db137f2f 100644 --- a/lib/PhpParser/NodeVisitor/FindingVisitor.php +++ b/lib/PhpParser/NodeVisitor/FindingVisitor.php @@ -9,8 +9,7 @@ use PhpParser\NodeVisitorAbstract; * This visitor can be used to find and collect all nodes satisfying some criterion determined by * a filter callback. */ -class FindingVisitor extends NodeVisitorAbstract -{ +class FindingVisitor extends NodeVisitorAbstract { /** @var callable Filter callback */ protected $filterCallback; /** @var Node[] Found nodes */ @@ -27,7 +26,7 @@ class FindingVisitor extends NodeVisitorAbstract * * @return Node[] Found nodes */ - public function getFoundNodes() : array { + public function getFoundNodes(): array { return $this->foundNodes; } diff --git a/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php b/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php index 19d6247a..2f7c101b 100644 --- a/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +++ b/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php @@ -10,8 +10,7 @@ use PhpParser\NodeVisitorAbstract; * This visitor can be used to find the first node satisfying some criterion determined by * a filter callback. */ -class FirstFindingVisitor extends NodeVisitorAbstract -{ +class FirstFindingVisitor extends NodeVisitorAbstract { /** @var callable Filter callback */ protected $filterCallback; /** @var null|Node Found node */ diff --git a/lib/PhpParser/NodeVisitor/NameResolver.php b/lib/PhpParser/NodeVisitor/NameResolver.php index 063f972b..eacbb05d 100644 --- a/lib/PhpParser/NodeVisitor/NameResolver.php +++ b/lib/PhpParser/NodeVisitor/NameResolver.php @@ -11,8 +11,7 @@ use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt; use PhpParser\NodeVisitorAbstract; -class NameResolver extends NodeVisitorAbstract -{ +class NameResolver extends NodeVisitorAbstract { /** @var NameContext Naming context */ protected $nameContext; @@ -36,7 +35,7 @@ class NameResolver extends NodeVisitorAbstract * @param array $options Options */ public function __construct(?ErrorHandler $errorHandler = null, array $options = []) { - $this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing); + $this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing()); $this->preserveOriginalNames = $options['preserveOriginalNames'] ?? false; $this->replaceNodes = $options['replaceNodes'] ?? true; } @@ -46,7 +45,7 @@ class NameResolver extends NodeVisitorAbstract * * @return NameContext */ - public function getNameContext() : NameContext { + public function getNameContext(): NameContext { return $this->nameContext; } @@ -86,7 +85,7 @@ class NameResolver extends NodeVisitorAbstract $this->resolveAttrGroups($node); $this->addNamespacedName($node); - } elseif ($node instanceof Stmt\Enum_) { + } elseif ($node instanceof Stmt\Enum_) { foreach ($node->implements as &$interface) { $interface = $this->resolveClassName($interface); } @@ -117,9 +116,9 @@ class NameResolver extends NodeVisitorAbstract foreach ($node->consts as $const) { $this->addNamespacedName($const); } - } else if ($node instanceof Stmt\ClassConst) { + } elseif ($node instanceof Stmt\ClassConst) { $this->resolveAttrGroups($node); - } else if ($node instanceof Stmt\EnumCase) { + } elseif ($node instanceof Stmt\EnumCase) { $this->resolveAttrGroups($node); } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch @@ -206,7 +205,7 @@ class NameResolver extends NodeVisitorAbstract * * @return Name Resolved name, or original name with attribute */ - protected function resolveName(Name $name, int $type) : Name { + protected function resolveName(Name $name, int $type): Name { if (!$this->replaceNodes) { $resolvedName = $this->nameContext->getResolvedName($name, $type); if (null !== $resolvedName) { @@ -246,8 +245,7 @@ class NameResolver extends NodeVisitorAbstract $this->nameContext->getNamespace(), (string) $node->name); } - protected function resolveAttrGroups(Node $node) - { + protected function resolveAttrGroups(Node $node) { foreach ($node->attrGroups as $attrGroup) { foreach ($attrGroup->attrs as $attr) { $attr->name = $this->resolveClassName($attr->name); diff --git a/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php b/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php index ea372e5b..6ccc9f08 100644 --- a/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +++ b/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php @@ -14,8 +14,7 @@ use PhpParser\NodeVisitorAbstract; * node can be accessed through $node->getAttribute('previous'), * and the next node can be accessed through $node->getAttribute('next'). */ -final class NodeConnectingVisitor extends NodeVisitorAbstract -{ +final class NodeConnectingVisitor extends NodeVisitorAbstract { /** * @var Node[] */ diff --git a/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php b/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php index b98d2bfa..c890094d 100644 --- a/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +++ b/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php @@ -2,31 +2,29 @@ namespace PhpParser\NodeVisitor; -use function array_pop; -use function count; use PhpParser\Node; use PhpParser\NodeVisitorAbstract; +use function array_pop; +use function count; + /** * Visitor that connects a child node to its parent node. * * On the child node, the parent node can be accessed through * $node->getAttribute('parent'). */ -final class ParentConnectingVisitor extends NodeVisitorAbstract -{ +final class ParentConnectingVisitor extends NodeVisitorAbstract { /** * @var Node[] */ private $stack = []; - public function beforeTraverse(array $nodes) - { + public function beforeTraverse(array $nodes) { $this->stack = []; } - public function enterNode(Node $node) - { + public function enterNode(Node $node) { if (!empty($this->stack)) { $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); } @@ -34,8 +32,7 @@ final class ParentConnectingVisitor extends NodeVisitorAbstract $this->stack[] = $node; } - public function leaveNode(Node $node) - { + public function leaveNode(Node $node) { array_pop($this->stack); } } diff --git a/lib/PhpParser/NodeVisitorAbstract.php b/lib/PhpParser/NodeVisitorAbstract.php index 0fc7f813..6fb15cca 100644 --- a/lib/PhpParser/NodeVisitorAbstract.php +++ b/lib/PhpParser/NodeVisitorAbstract.php @@ -5,8 +5,7 @@ namespace PhpParser; /** * @codeCoverageIgnore */ -abstract class NodeVisitorAbstract implements NodeVisitor -{ +abstract class NodeVisitorAbstract implements NodeVisitor { public function beforeTraverse(array $nodes) { return null; } diff --git a/lib/PhpParser/Parser.php b/lib/PhpParser/Parser.php index 31d99e96..3d6e1be6 100644 --- a/lib/PhpParser/Parser.php +++ b/lib/PhpParser/Parser.php @@ -2,8 +2,7 @@ namespace PhpParser; -interface Parser -{ +interface Parser { /** * Parses PHP code into a node tree. * diff --git a/lib/PhpParser/ParserAbstract.php b/lib/PhpParser/ParserAbstract.php index d5c01ac3..7ab23597 100644 --- a/lib/PhpParser/ParserAbstract.php +++ b/lib/PhpParser/ParserAbstract.php @@ -26,8 +26,7 @@ use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\TryCatch; use PhpParser\Node\Stmt\UseUse; -abstract class ParserAbstract implements Parser -{ +abstract class ParserAbstract implements Parser { private const SYMBOL_NONE = -1; /** @var Lexer Lexer that is used when parsing */ @@ -162,7 +161,7 @@ abstract class ParserAbstract implements Parser * the parser was unable to recover from an error). */ public function parse(string $code, ?ErrorHandler $errorHandler = null): ?array { - $this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing; + $this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing(); $this->lexer->startLexing($code, $this->errorHandler); $result = $this->doParse(); @@ -328,6 +327,7 @@ abstract class ParserAbstract implements Parser $msg = $this->getErrorMessage($symbol, $state); $this->emitError(new Error($msg, $startAttributes + $endAttributes)); // Break missing intentionally + // no break case 1: case 2: $this->errorState = 3; @@ -395,7 +395,7 @@ abstract class ParserAbstract implements Parser * * @return string Formatted error message */ - protected function getErrorMessage(int $symbol, int $state) : string { + protected function getErrorMessage(int $symbol, int $state): string { $expectedString = ''; if ($expected = $this->getExpectedTokens($state)) { $expectedString = ', expecting ' . implode(' or ', $expected); @@ -411,7 +411,7 @@ abstract class ParserAbstract implements Parser * * @return string[] Expected tokens. If too many, an empty array is returned. */ - protected function getExpectedTokens(int $state) : array { + protected function getExpectedTokens(int $state): array { $expected = []; $base = $this->actionBase[$state]; @@ -484,7 +484,7 @@ abstract class ParserAbstract implements Parser * @param Node\Stmt[] $stmts * @return Node\Stmt[] */ - protected function handleNamespaces(array $stmts) : array { + protected function handleNamespaces(array $stmts): array { $hasErrored = false; $style = $this->getNamespacingStyle($stmts); if (null === $style) { @@ -628,12 +628,11 @@ abstract class ParserAbstract implements Parser * * @return array Combined start and end attributes */ - protected function getAttributesAt(int $pos) : array { + protected function getAttributesAt(int $pos): array { return $this->startAttributeStack[$pos] + $this->endAttributeStack[$pos]; } - protected function getFloatCastKind(string $cast): int - { + protected function getFloatCastKind(string $cast): int { $cast = strtolower($cast); if (strpos($cast, 'float') !== false) { return Double::KIND_FLOAT; @@ -819,7 +818,7 @@ abstract class ParserAbstract implements Parser } protected function fixupArrayDestructuring(Array_ $node) { - return new Expr\List_(array_map(function(?Expr\ArrayItem $item) { + return new Expr\List_(array_map(function (?Expr\ArrayItem $item) { if ($item !== null && $item->value instanceof Array_) { return new Expr\ArrayItem( $this->fixupArrayDestructuring($item->value), @@ -1006,13 +1005,13 @@ abstract class ParserAbstract implements Parser if ($i < 256) { // Single-char tokens use an identity mapping. $tokenMap[$i] = $i; - } else if (\T_DOUBLE_COLON === $i) { + } elseif (\T_DOUBLE_COLON === $i) { // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM $tokenMap[$i] = static::T_PAAMAYIM_NEKUDOTAYIM; - } elseif(\T_OPEN_TAG_WITH_ECHO === $i) { + } elseif (\T_OPEN_TAG_WITH_ECHO === $i) { // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO $tokenMap[$i] = static::T_ECHO; - } elseif(\T_CLOSE_TAG === $i) { + } elseif (\T_CLOSE_TAG === $i) { // T_CLOSE_TAG is equivalent to ';' $tokenMap[$i] = ord(';'); } elseif ('UNKNOWN' !== $name = token_name($i)) { diff --git a/lib/PhpParser/ParserFactory.php b/lib/PhpParser/ParserFactory.php index d461eb4f..307981e1 100644 --- a/lib/PhpParser/ParserFactory.php +++ b/lib/PhpParser/ParserFactory.php @@ -5,8 +5,7 @@ namespace PhpParser; use PhpParser\Parser\Php7; use PhpParser\Parser\Php8; -class ParserFactory -{ +class ParserFactory { public const PREFER_PHP7 = 1; public const ONLY_PHP7 = 3; diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 6f5d296a..79c0b5b9 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -13,8 +13,7 @@ use PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Stmt; use PhpParser\PrettyPrinterAbstract; -class Standard extends PrettyPrinterAbstract -{ +class Standard extends PrettyPrinterAbstract { // Special nodes protected function pParam(Node\Param $node) { @@ -142,6 +141,7 @@ class Standard extends PrettyPrinterAbstract . $this->docStringEndToken; } /* break missing intentionally */ + // no break case Scalar\String_::KIND_SINGLE_QUOTED: return $this->pSingleQuotedString($node->value); case Scalar\String_::KIND_HEREDOC: @@ -155,7 +155,8 @@ class Standard extends PrettyPrinterAbstract return "<<<$label\n" . $escaped . "\n$label" . $this->docStringEndToken; } - /* break missing intentionally */ + /* break missing intentionally */ + // no break case Scalar\String_::KIND_DOUBLE_QUOTED: return '"' . $this->escapeString($node->value, '"') . '"'; } @@ -791,7 +792,7 @@ class Standard extends PrettyPrinterAbstract return (null !== $node->trait ? $this->p($node->trait) . '::' : '') . $node->method . ' as' . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') - . (null !== $node->newName ? ' ' . $node->newName : '') + . (null !== $node->newName ? ' ' . $node->newName : '') . ';'; } @@ -1046,7 +1047,8 @@ class Standard extends PrettyPrinterAbstract )/x'; return preg_replace_callback($regex, function ($matches) { assert(strlen($matches[0]) === 1); - $hex = dechex(ord($matches[0]));; + $hex = dechex(ord($matches[0])); + ; return '\\x' . str_pad($hex, 2, '0', \STR_PAD_LEFT); }, $escaped); } @@ -1074,7 +1076,7 @@ class Standard extends PrettyPrinterAbstract protected function pDereferenceLhs(Node $node) { if (!$this->dereferenceLhsRequiresParens($node)) { return $this->p($node); - } else { + } else { return '(' . $this->p($node) . ')'; } } @@ -1082,7 +1084,7 @@ class Standard extends PrettyPrinterAbstract protected function pCallLhs(Node $node) { if (!$this->callLhsRequiresParens($node)) { return $this->p($node); - } else { + } else { return '(' . $this->p($node) . ')'; } } diff --git a/lib/PhpParser/PrettyPrinterAbstract.php b/lib/PhpParser/PrettyPrinterAbstract.php index 791e6527..ae5da868 100644 --- a/lib/PhpParser/PrettyPrinterAbstract.php +++ b/lib/PhpParser/PrettyPrinterAbstract.php @@ -12,8 +12,7 @@ use PhpParser\Node\Expr\Cast; use PhpParser\Node\Scalar; use PhpParser\Node\Stmt; -abstract class PrettyPrinterAbstract -{ +abstract class PrettyPrinterAbstract { protected const FIXUP_PREC_LEFT = 0; // LHS operand affected by precedence protected const FIXUP_PREC_RIGHT = 1; // RHS operand affected by precedence protected const FIXUP_CALL_LHS = 2; // LHS of call @@ -200,7 +199,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - public function prettyPrint(array $stmts) : string { + public function prettyPrint(array $stmts): string { $this->resetState(); $this->preprocessNodes($stmts); @@ -214,7 +213,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed node */ - public function prettyPrintExpr(Expr $node) : string { + public function prettyPrintExpr(Expr $node): string { $this->resetState(); return $this->handleMagicTokens($this->p($node)); } @@ -226,7 +225,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - public function prettyPrintFile(array $stmts) : string { + public function prettyPrintFile(array $stmts): string { if (!$stmts) { return "indent(); } @@ -318,7 +317,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed infix operation */ - protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode) : string { + protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode): string { list($precedence, $associativity) = $this->precedenceMap[$class]; return $this->pPrec($leftNode, $precedence, $associativity, -1) @@ -335,7 +334,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed prefix operation */ - protected function pPrefixOp(string $class, string $operatorString, Node $node) : string { + protected function pPrefixOp(string $class, string $operatorString, Node $node): string { list($precedence, $associativity) = $this->precedenceMap[$class]; return $operatorString . $this->pPrec($node, $precedence, $associativity, 1); } @@ -352,7 +351,7 @@ abstract class PrettyPrinterAbstract * * @return string The pretty printed node */ - protected function pPrec(Node $node, int $parentPrecedence, int $parentAssociativity, int $childPosition) : string { + protected function pPrec(Node $node, int $parentPrecedence, int $parentAssociativity, int $childPosition): string { $class = \get_class($node); if (isset($this->precedenceMap[$class])) { $childPrecedence = $this->precedenceMap[$class][0]; @@ -374,7 +373,7 @@ abstract class PrettyPrinterAbstract * * @return string Imploded pretty printed nodes */ - protected function pImplode(array $nodes, string $glue = '') : string { + protected function pImplode(array $nodes, string $glue = ''): string { $pNodes = []; foreach ($nodes as $node) { if (null === $node) { @@ -394,7 +393,7 @@ abstract class PrettyPrinterAbstract * * @return string Comma separated pretty printed nodes */ - protected function pCommaSeparated(array $nodes) : string { + protected function pCommaSeparated(array $nodes): string { return $this->pImplode($nodes, ', '); } @@ -408,7 +407,7 @@ abstract class PrettyPrinterAbstract * * @return string Comma separated pretty printed nodes in multiline style */ - protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma) : string { + protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma): string { $this->indent(); $result = ''; @@ -440,7 +439,7 @@ abstract class PrettyPrinterAbstract * * @return string Reformatted text of comments */ - protected function pComments(array $comments) : string { + protected function pComments(array $comments): string { $formattedComments = []; foreach ($comments as $comment) { @@ -467,7 +466,7 @@ abstract class PrettyPrinterAbstract * * @return string */ - public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens) : string { + public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens): string { $this->initializeNodeListDiffer(); $this->initializeLabelCharMap(); $this->initializeFixupMap(); @@ -509,7 +508,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed node */ - protected function p(Node $node, bool $parentFormatPreserved = false) : string { + protected function p(Node $node, bool $parentFormatPreserved = false): string { // No orig tokens means this is a normal pretty print without preservation of formatting if (!$this->origTokens) { return $this->{'p' . $node->getType()}($node); @@ -942,7 +941,7 @@ abstract class PrettyPrinterAbstract * * @return string Result of fixed-up print of subnode */ - protected function pFixup(int $fixup, Node $subNode, ?string $parentClass, int $subStartPos, int $subEndPos) : string { + protected function pFixup(int $fixup, Node $subNode, ?string $parentClass, int $subStartPos, int $subEndPos): string { switch ($fixup) { case self::FIXUP_PREC_LEFT: case self::FIXUP_PREC_RIGHT: @@ -1024,7 +1023,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether parentheses are required */ - protected function callLhsRequiresParens(Node $node) : bool { + protected function callLhsRequiresParens(Node $node): bool { return !($node instanceof Node\Name || $node instanceof Expr\Variable || $node instanceof Expr\ArrayDimFetch @@ -1042,7 +1041,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether parentheses are required */ - protected function dereferenceLhsRequiresParens(Node $node) : bool { + protected function dereferenceLhsRequiresParens(Node $node): bool { return !($node instanceof Expr\Variable || $node instanceof Node\Name || $node instanceof Expr\ArrayDimFetch @@ -1067,13 +1066,13 @@ abstract class PrettyPrinterAbstract * @return string Printed modifiers */ protected function pModifiers(int $modifiers): string { - return ($modifiers & Modifiers::FINAL ? 'final ' : '') - . ($modifiers & Modifiers::ABSTRACT ? 'abstract ' : '') - . ($modifiers & Modifiers::PUBLIC ? 'public ' : '') + return ($modifiers & Modifiers::FINAL ? 'final ' : '') + . ($modifiers & Modifiers::ABSTRACT ? 'abstract ' : '') + . ($modifiers & Modifiers::PUBLIC ? 'public ' : '') . ($modifiers & Modifiers::PROTECTED ? 'protected ' : '') - . ($modifiers & Modifiers::PRIVATE ? 'private ' : '') - . ($modifiers & Modifiers::STATIC ? 'static ' : '') - . ($modifiers & Modifiers::READONLY ? 'readonly ' : ''); + . ($modifiers & Modifiers::PRIVATE ? 'private ' : '') + . ($modifiers & Modifiers::STATIC ? 'static ' : '') + . ($modifiers & Modifiers::READONLY ? 'readonly ' : ''); } /** @@ -1083,7 +1082,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether multiline formatting is used */ - protected function isMultiline(array $nodes) : bool { + protected function isMultiline(array $nodes): bool { if (\count($nodes) < 2) { return false; } @@ -1116,7 +1115,9 @@ abstract class PrettyPrinterAbstract * The label char map determines whether a certain character may occur in a label. */ protected function initializeLabelCharMap() { - if ($this->labelCharMap) return; + if ($this->labelCharMap) { + return; + } $this->labelCharMap = []; for ($i = 0; $i < 256; $i++) { @@ -1133,7 +1134,9 @@ abstract class PrettyPrinterAbstract * The node list differ is used to determine differences between two array subnodes. */ protected function initializeNodeListDiffer() { - if ($this->nodeListDiffer) return; + if ($this->nodeListDiffer) { + return; + } $this->nodeListDiffer = new Internal\Differ(function ($a, $b) { if ($a instanceof Node && $b instanceof Node) { @@ -1151,7 +1154,9 @@ abstract class PrettyPrinterAbstract * some kind of "fixup" operation, e.g. the addition of parenthesis or braces. */ protected function initializeFixupMap() { - if ($this->fixupMap) return; + if ($this->fixupMap) { + return; + } $this->fixupMap = [ Expr\Instanceof_::class => [ @@ -1233,7 +1238,9 @@ abstract class PrettyPrinterAbstract * certain node is replaced by null. */ protected function initializeRemovalMap() { - if ($this->removalMap) return; + if ($this->removalMap) { + return; + } $stripBoth = ['left' => \T_WHITESPACE, 'right' => \T_WHITESPACE]; $stripLeft = ['left' => \T_WHITESPACE]; @@ -1278,7 +1285,9 @@ abstract class PrettyPrinterAbstract } protected function initializeInsertionMap() { - if ($this->insertionMap) return; + if ($this->insertionMap) { + return; + } // TODO: "yield" where both key and value are inserted doesn't work // [$find, $beforeToken, $extraLeft, $extraRight] @@ -1320,7 +1329,9 @@ abstract class PrettyPrinterAbstract } protected function initializeListInsertionMap() { - if ($this->listInsertionMap) return; + if ($this->listInsertionMap) { + return; + } $this->listInsertionMap = [ // special @@ -1414,7 +1425,9 @@ abstract class PrettyPrinterAbstract } protected function initializeEmptyListInsertionMap() { - if ($this->emptyListInsertionMap) return; + if ($this->emptyListInsertionMap) { + return; + } // TODO Insertion into empty statement lists. @@ -1467,7 +1480,9 @@ abstract class PrettyPrinterAbstract } protected function initializeModifierChangeMap() { - if ($this->modifierChangeMap) return; + if ($this->modifierChangeMap) { + return; + } $this->modifierChangeMap = [ 'Stmt_ClassConst->flags' => \T_CONST,