@appthreat/atom 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/phpastgen.js +7 -1
- package/plugins/autoload.php +1 -1
- package/plugins/bin/atom +1 -1
- package/plugins/bin/atom.bat +1 -1
- package/plugins/composer/autoload_classmap.php +18 -18
- package/plugins/composer/autoload_real.php +4 -4
- package/plugins/composer/autoload_static.php +22 -22
- package/plugins/composer/installed.json +10 -12
- package/plugins/composer/installed.php +9 -9
- package/plugins/lib/io.appthreat.atom-1.8.2-classpath.jar +0 -0
- package/plugins/lib/{io.appthreat.atom-1.8.1.jar → io.appthreat.atom-1.8.2.jar} +0 -0
- package/plugins/lib/{io.appthreat.c2cpg_3-1.1.3.jar → io.appthreat.c2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.dataflowengineoss_3-1.1.3.jar → io.appthreat.dataflowengineoss_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.javasrc2cpg_3-1.1.3.jar → io.appthreat.javasrc2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.jimple2cpg_3-1.1.3.jar → io.appthreat.jimple2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.jssrc2cpg_3-1.1.3.jar → io.appthreat.jssrc2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.php2atom_3-1.1.3.jar → io.appthreat.php2atom_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.pysrc2cpg_3-1.1.3.jar → io.appthreat.pysrc2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.semanticcpg_3-1.1.3.jar → io.appthreat.semanticcpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.x2cpg_3-1.1.3.jar → io.appthreat.x2cpg_3-1.1.4.jar} +0 -0
- package/plugins/nikic/php-parser/README.md +12 -20
- package/plugins/nikic/php-parser/bin/php-parse +10 -11
- package/plugins/nikic/php-parser/composer.json +4 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php +15 -17
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Class_.php +30 -35
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +4 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +7 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Enum_.php +27 -26
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +7 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Function_.php +7 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +10 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Method.php +15 -16
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +5 -5
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Param.php +35 -16
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Property.php +19 -19
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php +5 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php +28 -25
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +11 -16
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Use_.php +8 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Builder.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/BuilderFactory.php +69 -45
- package/plugins/nikic/php-parser/lib/PhpParser/BuilderHelpers.php +19 -17
- package/plugins/nikic/php-parser/lib/PhpParser/Comment/Doc.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Comment.php +67 -35
- package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php +3 -3
- package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php +10 -15
- package/plugins/nikic/php-parser/lib/PhpParser/Error.php +33 -24
- package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php +9 -6
- package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php +7 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/Differ.php +22 -36
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +13 -20
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +70 -55
- package/plugins/nikic/php-parser/lib/PhpParser/JsonDecoder.php +10 -15
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +93 -68
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +18 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +47 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php +15 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php +11 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php +76 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +23 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php +25 -19
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +10 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +29 -22
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +105 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php +3 -3
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php +15 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php +5 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +5 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer.php +513 -69
- package/plugins/nikic/php-parser/lib/PhpParser/NameContext.php +24 -23
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Arg.php +15 -13
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Attribute.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php +7 -5
- package/plugins/nikic/php-parser/lib/PhpParser/Node/ComplexType.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Const_.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +11 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +39 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +11 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php +28 -33
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +11 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php +7 -3
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php +6 -5
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +6 -5
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +10 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +26 -33
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +32 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +6 -5
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +11 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +11 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +14 -13
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +11 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +8 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php +7 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +12 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +11 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +12 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +10 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +7 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +10 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +9 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +13 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +11 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +13 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php +7 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +7 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +11 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +8 -5
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Identifier.php +13 -13
- package/plugins/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php +9 -6
- package/plugins/nikic/php-parser/lib/PhpParser/Node/MatchArm.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Name.php +56 -71
- package/plugins/nikic/php-parser/lib/PhpParser/Node/NullableType.php +10 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Param.php +22 -46
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +75 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +29 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +28 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +78 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php +26 -30
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +11 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +12 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +32 -24
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +13 -13
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +54 -47
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +89 -46
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +32 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +12 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php +12 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php +13 -17
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +15 -19
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +17 -20
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +24 -28
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +14 -16
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +15 -18
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +10 -13
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +12 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php +37 -28
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +32 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +35 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +8 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +9 -8
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +13 -12
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +4 -3
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +8 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +12 -11
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +50 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +16 -16
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +10 -9
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Node/UnionType.php +8 -7
- package/plugins/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php +2 -2
- package/plugins/nikic/php-parser/lib/PhpParser/Node.php +29 -24
- package/plugins/nikic/php-parser/lib/PhpParser/NodeAbstract.php +20 -20
- package/plugins/nikic/php-parser/lib/PhpParser/NodeDumper.php +84 -168
- package/plugins/nikic/php-parser/lib/PhpParser/NodeFinder.php +19 -28
- package/plugins/nikic/php-parser/lib/PhpParser/NodeTraverser.php +84 -71
- package/plugins/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +7 -4
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +7 -6
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +28 -30
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +3 -2
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +11 -8
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor.php +7 -59
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +2 -1
- package/plugins/nikic/php-parser/lib/PhpParser/Parser/Multiple.php +55 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Parser/Php5.php +2682 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Parser/Php7.php +1522 -1323
- package/plugins/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +148 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Parser.php +3 -9
- package/plugins/nikic/php-parser/lib/PhpParser/ParserAbstract.php +252 -433
- package/plugins/nikic/php-parser/lib/PhpParser/ParserFactory.php +49 -15
- package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php +335 -386
- package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +438 -517
- package/plugins/lib/io.appthreat.atom-1.8.1-classpath.jar +0 -0
- package/plugins/nikic/php-parser/.php-cs-fixer.dist.php +0 -31
- package/plugins/nikic/php-parser/Makefile +0 -10
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php +0 -237
- package/plugins/nikic/php-parser/lib/PhpParser/Modifiers.php +0 -69
- package/plugins/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php +0 -43
- package/plugins/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php +0 -36
- package/plugins/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php +0 -37
- package/plugins/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php +0 -32
- package/plugins/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php +0 -37
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php +0 -78
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php +0 -82
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php +0 -34
- package/plugins/nikic/php-parser/lib/PhpParser/Node/StaticVar.php +0 -39
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php +0 -29
- package/plugins/nikic/php-parser/lib/PhpParser/Node/UseItem.php +0 -55
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php +0 -82
- package/plugins/nikic/php-parser/lib/PhpParser/Parser/Php8.php +0 -2717
- package/plugins/nikic/php-parser/lib/PhpParser/PhpVersion.php +0 -164
- package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinter.php +0 -51
- package/plugins/nikic/php-parser/lib/PhpParser/Token.php +0 -18
- package/plugins/nikic/php-parser/lib/PhpParser/compatibility_tokens.php +0 -56
- package/plugins/nikic/php-parser/phpstan-baseline.neon +0 -236
- package/plugins/nikic/php-parser/phpstan.neon.dist +0 -8
|
@@ -2,40 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PhpParser;
|
|
4
4
|
|
|
5
|
-
class NodeTraverser implements NodeTraverserInterface
|
|
5
|
+
class NodeTraverser implements NodeTraverserInterface
|
|
6
|
+
{
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes
|
|
9
|
+
* of the current node will not be traversed for any visitors.
|
|
10
|
+
*
|
|
11
|
+
* For subsequent visitors enterNode() will still be called on the current
|
|
12
|
+
* node and leaveNode() will also be invoked for the current node.
|
|
8
13
|
*/
|
|
9
|
-
|
|
14
|
+
const DONT_TRAVERSE_CHILDREN = 1;
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
|
-
*
|
|
17
|
+
* If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns
|
|
18
|
+
* STOP_TRAVERSAL, traversal is aborted.
|
|
19
|
+
*
|
|
20
|
+
* The afterTraverse() method will still be invoked.
|
|
13
21
|
*/
|
|
14
|
-
|
|
22
|
+
const STOP_TRAVERSAL = 2;
|
|
15
23
|
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
25
|
+
* If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs
|
|
26
|
+
* in an array, it will be removed from the array.
|
|
27
|
+
*
|
|
28
|
+
* For subsequent visitors leaveNode() will still be invoked for the
|
|
29
|
+
* removed node.
|
|
18
30
|
*/
|
|
19
|
-
|
|
31
|
+
const REMOVE_NODE = 3;
|
|
20
32
|
|
|
21
33
|
/**
|
|
22
|
-
*
|
|
34
|
+
* If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes
|
|
35
|
+
* of the current node will not be traversed for any visitors.
|
|
36
|
+
*
|
|
37
|
+
* For subsequent visitors enterNode() will not be called as well.
|
|
38
|
+
* leaveNode() will be invoked for visitors that has enterNode() method invoked.
|
|
23
39
|
*/
|
|
24
|
-
|
|
40
|
+
const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4;
|
|
25
41
|
|
|
26
|
-
/** @var
|
|
27
|
-
protected
|
|
42
|
+
/** @var NodeVisitor[] Visitors */
|
|
43
|
+
protected $visitors = [];
|
|
28
44
|
|
|
29
45
|
/** @var bool Whether traversal should be stopped */
|
|
30
|
-
protected
|
|
46
|
+
protected $stopTraversal;
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* @param NodeVisitor ...$visitors Node visitors
|
|
36
|
-
*/
|
|
37
|
-
public function __construct(NodeVisitor ...$visitors) {
|
|
38
|
-
$this->visitors = $visitors;
|
|
48
|
+
public function __construct() {
|
|
49
|
+
// for BC
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
/**
|
|
@@ -43,17 +54,21 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
43
54
|
*
|
|
44
55
|
* @param NodeVisitor $visitor Visitor to add
|
|
45
56
|
*/
|
|
46
|
-
public function addVisitor(NodeVisitor $visitor)
|
|
57
|
+
public function addVisitor(NodeVisitor $visitor) {
|
|
47
58
|
$this->visitors[] = $visitor;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
/**
|
|
51
62
|
* Removes an added visitor.
|
|
63
|
+
*
|
|
64
|
+
* @param NodeVisitor $visitor
|
|
52
65
|
*/
|
|
53
|
-
public function removeVisitor(NodeVisitor $visitor)
|
|
54
|
-
$
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
public function removeVisitor(NodeVisitor $visitor) {
|
|
67
|
+
foreach ($this->visitors as $index => $storedVisitor) {
|
|
68
|
+
if ($storedVisitor === $visitor) {
|
|
69
|
+
unset($this->visitors[$index]);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
57
72
|
}
|
|
58
73
|
}
|
|
59
74
|
|
|
@@ -64,7 +79,7 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
64
79
|
*
|
|
65
80
|
* @return Node[] Traversed array of nodes
|
|
66
81
|
*/
|
|
67
|
-
public function traverse(array $nodes): array {
|
|
82
|
+
public function traverse(array $nodes) : array {
|
|
68
83
|
$this->stopTraversal = false;
|
|
69
84
|
|
|
70
85
|
foreach ($this->visitors as $visitor) {
|
|
@@ -75,8 +90,7 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
75
90
|
|
|
76
91
|
$nodes = $this->traverseArray($nodes);
|
|
77
92
|
|
|
78
|
-
|
|
79
|
-
$visitor = $this->visitors[$i];
|
|
93
|
+
foreach ($this->visitors as $visitor) {
|
|
80
94
|
if (null !== $return = $visitor->afterTraverse($nodes)) {
|
|
81
95
|
$nodes = $return;
|
|
82
96
|
}
|
|
@@ -89,37 +103,37 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
89
103
|
* Recursively traverse a node.
|
|
90
104
|
*
|
|
91
105
|
* @param Node $node Node to traverse.
|
|
106
|
+
*
|
|
107
|
+
* @return Node Result of traversal (may be original node or new one)
|
|
92
108
|
*/
|
|
93
|
-
protected function traverseNode(Node $node):
|
|
109
|
+
protected function traverseNode(Node $node) : Node {
|
|
94
110
|
foreach ($node->getSubNodeNames() as $name) {
|
|
95
|
-
$subNode
|
|
111
|
+
$subNode =& $node->$name;
|
|
96
112
|
|
|
97
113
|
if (\is_array($subNode)) {
|
|
98
|
-
$
|
|
114
|
+
$subNode = $this->traverseArray($subNode);
|
|
99
115
|
if ($this->stopTraversal) {
|
|
100
116
|
break;
|
|
101
117
|
}
|
|
102
118
|
} elseif ($subNode instanceof Node) {
|
|
103
119
|
$traverseChildren = true;
|
|
104
|
-
$
|
|
120
|
+
$breakVisitorIndex = null;
|
|
105
121
|
|
|
106
122
|
foreach ($this->visitors as $visitorIndex => $visitor) {
|
|
107
123
|
$return = $visitor->enterNode($subNode);
|
|
108
124
|
if (null !== $return) {
|
|
109
125
|
if ($return instanceof Node) {
|
|
110
126
|
$this->ensureReplacementReasonable($subNode, $return);
|
|
111
|
-
$subNode = $
|
|
112
|
-
} elseif (
|
|
127
|
+
$subNode = $return;
|
|
128
|
+
} elseif (self::DONT_TRAVERSE_CHILDREN === $return) {
|
|
113
129
|
$traverseChildren = false;
|
|
114
|
-
} elseif (
|
|
130
|
+
} elseif (self::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) {
|
|
115
131
|
$traverseChildren = false;
|
|
132
|
+
$breakVisitorIndex = $visitorIndex;
|
|
116
133
|
break;
|
|
117
|
-
} elseif (
|
|
134
|
+
} elseif (self::STOP_TRAVERSAL === $return) {
|
|
118
135
|
$this->stopTraversal = true;
|
|
119
136
|
break 2;
|
|
120
|
-
} elseif (NodeVisitor::REPLACE_WITH_NULL === $return) {
|
|
121
|
-
$node->$name = null;
|
|
122
|
-
continue 2;
|
|
123
137
|
} else {
|
|
124
138
|
throw new \LogicException(
|
|
125
139
|
'enterNode() returned invalid value of type ' . gettype($return)
|
|
@@ -129,26 +143,22 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
129
143
|
}
|
|
130
144
|
|
|
131
145
|
if ($traverseChildren) {
|
|
132
|
-
$this->traverseNode($subNode);
|
|
146
|
+
$subNode = $this->traverseNode($subNode);
|
|
133
147
|
if ($this->stopTraversal) {
|
|
134
148
|
break;
|
|
135
149
|
}
|
|
136
150
|
}
|
|
137
151
|
|
|
138
|
-
|
|
139
|
-
$visitor = $this->visitors[$visitorIndex];
|
|
152
|
+
foreach ($this->visitors as $visitorIndex => $visitor) {
|
|
140
153
|
$return = $visitor->leaveNode($subNode);
|
|
141
154
|
|
|
142
155
|
if (null !== $return) {
|
|
143
156
|
if ($return instanceof Node) {
|
|
144
157
|
$this->ensureReplacementReasonable($subNode, $return);
|
|
145
|
-
$subNode = $
|
|
146
|
-
} elseif (
|
|
158
|
+
$subNode = $return;
|
|
159
|
+
} elseif (self::STOP_TRAVERSAL === $return) {
|
|
147
160
|
$this->stopTraversal = true;
|
|
148
161
|
break 2;
|
|
149
|
-
} elseif (NodeVisitor::REPLACE_WITH_NULL === $return) {
|
|
150
|
-
$node->$name = null;
|
|
151
|
-
break;
|
|
152
162
|
} elseif (\is_array($return)) {
|
|
153
163
|
throw new \LogicException(
|
|
154
164
|
'leaveNode() may only return an array ' .
|
|
@@ -160,9 +170,15 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
160
170
|
);
|
|
161
171
|
}
|
|
162
172
|
}
|
|
173
|
+
|
|
174
|
+
if ($breakVisitorIndex === $visitorIndex) {
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
163
177
|
}
|
|
164
178
|
}
|
|
165
179
|
}
|
|
180
|
+
|
|
181
|
+
return $node;
|
|
166
182
|
}
|
|
167
183
|
|
|
168
184
|
/**
|
|
@@ -172,37 +188,29 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
172
188
|
*
|
|
173
189
|
* @return array Result of traversal (may be original array or changed one)
|
|
174
190
|
*/
|
|
175
|
-
protected function traverseArray(array $nodes): array {
|
|
191
|
+
protected function traverseArray(array $nodes) : array {
|
|
176
192
|
$doNodes = [];
|
|
177
193
|
|
|
178
|
-
foreach ($nodes as $i =>
|
|
194
|
+
foreach ($nodes as $i => &$node) {
|
|
179
195
|
if ($node instanceof Node) {
|
|
180
196
|
$traverseChildren = true;
|
|
181
|
-
$
|
|
197
|
+
$breakVisitorIndex = null;
|
|
182
198
|
|
|
183
199
|
foreach ($this->visitors as $visitorIndex => $visitor) {
|
|
184
200
|
$return = $visitor->enterNode($node);
|
|
185
201
|
if (null !== $return) {
|
|
186
202
|
if ($return instanceof Node) {
|
|
187
203
|
$this->ensureReplacementReasonable($node, $return);
|
|
188
|
-
$
|
|
189
|
-
} elseif (
|
|
190
|
-
$doNodes[] = [$i, $return];
|
|
191
|
-
continue 2;
|
|
192
|
-
} elseif (NodeVisitor::REMOVE_NODE === $return) {
|
|
193
|
-
$doNodes[] = [$i, []];
|
|
194
|
-
continue 2;
|
|
195
|
-
} elseif (NodeVisitor::DONT_TRAVERSE_CHILDREN === $return) {
|
|
204
|
+
$node = $return;
|
|
205
|
+
} elseif (self::DONT_TRAVERSE_CHILDREN === $return) {
|
|
196
206
|
$traverseChildren = false;
|
|
197
|
-
} elseif (
|
|
207
|
+
} elseif (self::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) {
|
|
198
208
|
$traverseChildren = false;
|
|
209
|
+
$breakVisitorIndex = $visitorIndex;
|
|
199
210
|
break;
|
|
200
|
-
} elseif (
|
|
211
|
+
} elseif (self::STOP_TRAVERSAL === $return) {
|
|
201
212
|
$this->stopTraversal = true;
|
|
202
213
|
break 2;
|
|
203
|
-
} elseif (NodeVisitor::REPLACE_WITH_NULL === $return) {
|
|
204
|
-
throw new \LogicException(
|
|
205
|
-
'REPLACE_WITH_NULL can not be used if the parent structure is an array');
|
|
206
214
|
} else {
|
|
207
215
|
throw new \LogicException(
|
|
208
216
|
'enterNode() returned invalid value of type ' . gettype($return)
|
|
@@ -212,38 +220,43 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
212
220
|
}
|
|
213
221
|
|
|
214
222
|
if ($traverseChildren) {
|
|
215
|
-
$this->traverseNode($node);
|
|
223
|
+
$node = $this->traverseNode($node);
|
|
216
224
|
if ($this->stopTraversal) {
|
|
217
225
|
break;
|
|
218
226
|
}
|
|
219
227
|
}
|
|
220
228
|
|
|
221
|
-
|
|
222
|
-
$visitor = $this->visitors[$visitorIndex];
|
|
229
|
+
foreach ($this->visitors as $visitorIndex => $visitor) {
|
|
223
230
|
$return = $visitor->leaveNode($node);
|
|
224
231
|
|
|
225
232
|
if (null !== $return) {
|
|
226
233
|
if ($return instanceof Node) {
|
|
227
234
|
$this->ensureReplacementReasonable($node, $return);
|
|
228
|
-
$
|
|
235
|
+
$node = $return;
|
|
229
236
|
} elseif (\is_array($return)) {
|
|
230
237
|
$doNodes[] = [$i, $return];
|
|
231
238
|
break;
|
|
232
|
-
} elseif (
|
|
239
|
+
} elseif (self::REMOVE_NODE === $return) {
|
|
233
240
|
$doNodes[] = [$i, []];
|
|
234
241
|
break;
|
|
235
|
-
} elseif (
|
|
242
|
+
} elseif (self::STOP_TRAVERSAL === $return) {
|
|
236
243
|
$this->stopTraversal = true;
|
|
237
244
|
break 2;
|
|
238
|
-
} elseif (
|
|
245
|
+
} elseif (false === $return) {
|
|
239
246
|
throw new \LogicException(
|
|
240
|
-
'
|
|
247
|
+
'bool(false) return from leaveNode() no longer supported. ' .
|
|
248
|
+
'Return NodeTraverser::REMOVE_NODE instead'
|
|
249
|
+
);
|
|
241
250
|
} else {
|
|
242
251
|
throw new \LogicException(
|
|
243
252
|
'leaveNode() returned invalid value of type ' . gettype($return)
|
|
244
253
|
);
|
|
245
254
|
}
|
|
246
255
|
}
|
|
256
|
+
|
|
257
|
+
if ($breakVisitorIndex === $visitorIndex) {
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
247
260
|
}
|
|
248
261
|
} elseif (\is_array($node)) {
|
|
249
262
|
throw new \LogicException('Invalid node structure: Contains nested arrays');
|
|
@@ -259,7 +272,7 @@ class NodeTraverser implements NodeTraverserInterface {
|
|
|
259
272
|
return $nodes;
|
|
260
273
|
}
|
|
261
274
|
|
|
262
|
-
private function ensureReplacementReasonable(
|
|
275
|
+
private function ensureReplacementReasonable($old, $new) {
|
|
263
276
|
if ($old instanceof Node\Stmt && $new instanceof Node\Expr) {
|
|
264
277
|
throw new \LogicException(
|
|
265
278
|
"Trying to replace statement ({$old->getType()}) " .
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PhpParser;
|
|
4
4
|
|
|
5
|
-
interface NodeTraverserInterface
|
|
5
|
+
interface NodeTraverserInterface
|
|
6
|
+
{
|
|
6
7
|
/**
|
|
7
8
|
* Adds a visitor.
|
|
8
9
|
*
|
|
9
10
|
* @param NodeVisitor $visitor Visitor to add
|
|
10
11
|
*/
|
|
11
|
-
public function addVisitor(NodeVisitor $visitor)
|
|
12
|
+
public function addVisitor(NodeVisitor $visitor);
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Removes an added visitor.
|
|
16
|
+
*
|
|
17
|
+
* @param NodeVisitor $visitor
|
|
15
18
|
*/
|
|
16
|
-
public function removeVisitor(NodeVisitor $visitor)
|
|
19
|
+
public function removeVisitor(NodeVisitor $visitor);
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Traverses an array of nodes using the registered visitors.
|
|
@@ -22,5 +25,5 @@ interface NodeTraverserInterface {
|
|
|
22
25
|
*
|
|
23
26
|
* @return Node[] Traversed array of nodes
|
|
24
27
|
*/
|
|
25
|
-
public function traverse(array $nodes): array;
|
|
28
|
+
public function traverse(array $nodes) : array;
|
|
26
29
|
}
|
|
@@ -10,7 +10,8 @@ use PhpParser\NodeVisitorAbstract;
|
|
|
10
10
|
*
|
|
11
11
|
* This visitor is required to perform format-preserving pretty prints.
|
|
12
12
|
*/
|
|
13
|
-
class CloningVisitor extends NodeVisitorAbstract
|
|
13
|
+
class CloningVisitor extends NodeVisitorAbstract
|
|
14
|
+
{
|
|
14
15
|
public function enterNode(Node $origNode) {
|
|
15
16
|
$node = clone $origNode;
|
|
16
17
|
$node->setAttribute('origNode', $origNode);
|
|
@@ -9,11 +9,12 @@ use PhpParser\NodeVisitorAbstract;
|
|
|
9
9
|
* This visitor can be used to find and collect all nodes satisfying some criterion determined by
|
|
10
10
|
* a filter callback.
|
|
11
11
|
*/
|
|
12
|
-
class FindingVisitor extends NodeVisitorAbstract
|
|
12
|
+
class FindingVisitor extends NodeVisitorAbstract
|
|
13
|
+
{
|
|
13
14
|
/** @var callable Filter callback */
|
|
14
15
|
protected $filterCallback;
|
|
15
16
|
/** @var Node[] Found nodes */
|
|
16
|
-
protected
|
|
17
|
+
protected $foundNodes;
|
|
17
18
|
|
|
18
19
|
public function __construct(callable $filterCallback) {
|
|
19
20
|
$this->filterCallback = $filterCallback;
|
|
@@ -26,11 +27,11 @@ class FindingVisitor extends NodeVisitorAbstract {
|
|
|
26
27
|
*
|
|
27
28
|
* @return Node[] Found nodes
|
|
28
29
|
*/
|
|
29
|
-
public function getFoundNodes(): array {
|
|
30
|
+
public function getFoundNodes() : array {
|
|
30
31
|
return $this->foundNodes;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
public function beforeTraverse(array $nodes)
|
|
34
|
+
public function beforeTraverse(array $nodes) {
|
|
34
35
|
$this->foundNodes = [];
|
|
35
36
|
|
|
36
37
|
return null;
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
namespace PhpParser\NodeVisitor;
|
|
4
4
|
|
|
5
5
|
use PhpParser\Node;
|
|
6
|
-
use PhpParser\
|
|
6
|
+
use PhpParser\NodeTraverser;
|
|
7
7
|
use PhpParser\NodeVisitorAbstract;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* This visitor can be used to find the first node satisfying some criterion determined by
|
|
11
11
|
* a filter callback.
|
|
12
12
|
*/
|
|
13
|
-
class FirstFindingVisitor extends NodeVisitorAbstract
|
|
13
|
+
class FirstFindingVisitor extends NodeVisitorAbstract
|
|
14
|
+
{
|
|
14
15
|
/** @var callable Filter callback */
|
|
15
16
|
protected $filterCallback;
|
|
16
17
|
/** @var null|Node Found node */
|
|
17
|
-
protected
|
|
18
|
+
protected $foundNode;
|
|
18
19
|
|
|
19
20
|
public function __construct(callable $filterCallback) {
|
|
20
21
|
$this->filterCallback = $filterCallback;
|
|
@@ -27,11 +28,11 @@ class FirstFindingVisitor extends NodeVisitorAbstract {
|
|
|
27
28
|
*
|
|
28
29
|
* @return null|Node Found node (or null if not found)
|
|
29
30
|
*/
|
|
30
|
-
public function getFoundNode()
|
|
31
|
+
public function getFoundNode() {
|
|
31
32
|
return $this->foundNode;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
public function beforeTraverse(array $nodes)
|
|
35
|
+
public function beforeTraverse(array $nodes) {
|
|
35
36
|
$this->foundNode = null;
|
|
36
37
|
|
|
37
38
|
return null;
|
|
@@ -41,7 +42,7 @@ class FirstFindingVisitor extends NodeVisitorAbstract {
|
|
|
41
42
|
$filterCallback = $this->filterCallback;
|
|
42
43
|
if ($filterCallback($node)) {
|
|
43
44
|
$this->foundNode = $node;
|
|
44
|
-
return
|
|
45
|
+
return NodeTraverser::STOP_TRAVERSAL;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
return null;
|
|
@@ -11,15 +11,16 @@ use PhpParser\Node\Name\FullyQualified;
|
|
|
11
11
|
use PhpParser\Node\Stmt;
|
|
12
12
|
use PhpParser\NodeVisitorAbstract;
|
|
13
13
|
|
|
14
|
-
class NameResolver extends NodeVisitorAbstract
|
|
14
|
+
class NameResolver extends NodeVisitorAbstract
|
|
15
|
+
{
|
|
15
16
|
/** @var NameContext Naming context */
|
|
16
|
-
protected
|
|
17
|
+
protected $nameContext;
|
|
17
18
|
|
|
18
19
|
/** @var bool Whether to preserve original names */
|
|
19
|
-
protected
|
|
20
|
+
protected $preserveOriginalNames;
|
|
20
21
|
|
|
21
22
|
/** @var bool Whether to replace resolved nodes in place, or to add resolvedNode attributes */
|
|
22
|
-
protected
|
|
23
|
+
protected $replaceNodes;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Constructs a name resolution visitor.
|
|
@@ -32,22 +33,24 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
32
33
|
* namespacedName attribute, as usual.)
|
|
33
34
|
*
|
|
34
35
|
* @param ErrorHandler|null $errorHandler Error handler
|
|
35
|
-
* @param array
|
|
36
|
+
* @param array $options Options
|
|
36
37
|
*/
|
|
37
|
-
public function __construct(
|
|
38
|
-
$this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing
|
|
38
|
+
public function __construct(ErrorHandler $errorHandler = null, array $options = []) {
|
|
39
|
+
$this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing);
|
|
39
40
|
$this->preserveOriginalNames = $options['preserveOriginalNames'] ?? false;
|
|
40
41
|
$this->replaceNodes = $options['replaceNodes'] ?? true;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Get name resolution context.
|
|
46
|
+
*
|
|
47
|
+
* @return NameContext
|
|
45
48
|
*/
|
|
46
|
-
public function getNameContext(): NameContext {
|
|
49
|
+
public function getNameContext() : NameContext {
|
|
47
50
|
return $this->nameContext;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
public function beforeTraverse(array $nodes)
|
|
53
|
+
public function beforeTraverse(array $nodes) {
|
|
51
54
|
$this->nameContext->startNamespace();
|
|
52
55
|
return null;
|
|
53
56
|
}
|
|
@@ -75,8 +78,6 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
75
78
|
$this->resolveAttrGroups($node);
|
|
76
79
|
if (null !== $node->name) {
|
|
77
80
|
$this->addNamespacedName($node);
|
|
78
|
-
} else {
|
|
79
|
-
$node->namespacedName = null;
|
|
80
81
|
}
|
|
81
82
|
} elseif ($node instanceof Stmt\Interface_) {
|
|
82
83
|
foreach ($node->extends as &$interface) {
|
|
@@ -85,13 +86,15 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
85
86
|
|
|
86
87
|
$this->resolveAttrGroups($node);
|
|
87
88
|
$this->addNamespacedName($node);
|
|
88
|
-
|
|
89
|
+
} elseif ($node instanceof Stmt\Enum_) {
|
|
89
90
|
foreach ($node->implements as &$interface) {
|
|
90
91
|
$interface = $this->resolveClassName($interface);
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
$this->resolveAttrGroups($node);
|
|
94
|
-
|
|
95
|
+
if (null !== $node->name) {
|
|
96
|
+
$this->addNamespacedName($node);
|
|
97
|
+
}
|
|
95
98
|
} elseif ($node instanceof Stmt\Trait_) {
|
|
96
99
|
$this->resolveAttrGroups($node);
|
|
97
100
|
$this->addNamespacedName($node);
|
|
@@ -114,12 +117,12 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
114
117
|
foreach ($node->consts as $const) {
|
|
115
118
|
$this->addNamespacedName($const);
|
|
116
119
|
}
|
|
117
|
-
}
|
|
120
|
+
} else if ($node instanceof Stmt\ClassConst) {
|
|
118
121
|
if (null !== $node->type) {
|
|
119
122
|
$node->type = $this->resolveType($node->type);
|
|
120
123
|
}
|
|
121
124
|
$this->resolveAttrGroups($node);
|
|
122
|
-
}
|
|
125
|
+
} else if ($node instanceof Stmt\EnumCase) {
|
|
123
126
|
$this->resolveAttrGroups($node);
|
|
124
127
|
} elseif ($node instanceof Expr\StaticCall
|
|
125
128
|
|| $node instanceof Expr\StaticPropertyFetch
|
|
@@ -161,8 +164,7 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
161
164
|
return null;
|
|
162
165
|
}
|
|
163
166
|
|
|
164
|
-
|
|
165
|
-
private function addAlias(Node\UseItem $use, int $type, ?Name $prefix = null): void {
|
|
167
|
+
private function addAlias(Stmt\UseUse $use, int $type, Name $prefix = null) {
|
|
166
168
|
// Add prefix for group uses
|
|
167
169
|
$name = $prefix ? Name::concat($prefix, $use->name) : $use->name;
|
|
168
170
|
// Type is determined either by individual element or whole use declaration
|
|
@@ -173,8 +175,8 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
173
175
|
);
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
/** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure
|
|
177
|
-
private function resolveSignature($node)
|
|
178
|
+
/** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure $node */
|
|
179
|
+
private function resolveSignature($node) {
|
|
178
180
|
foreach ($node->params as $param) {
|
|
179
181
|
$param->type = $this->resolveType($param->type);
|
|
180
182
|
$this->resolveAttrGroups($param);
|
|
@@ -182,12 +184,7 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
182
184
|
$node->returnType = $this->resolveType($node->returnType);
|
|
183
185
|
}
|
|
184
186
|
|
|
185
|
-
|
|
186
|
-
* @template T of Node\Identifier|Name|Node\ComplexType|null
|
|
187
|
-
* @param T $node
|
|
188
|
-
* @return T
|
|
189
|
-
*/
|
|
190
|
-
private function resolveType(?Node $node): ?Node {
|
|
187
|
+
private function resolveType($node) {
|
|
191
188
|
if ($node instanceof Name) {
|
|
192
189
|
return $this->resolveClassName($node);
|
|
193
190
|
}
|
|
@@ -208,11 +205,11 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
208
205
|
* Resolve name, according to name resolver options.
|
|
209
206
|
*
|
|
210
207
|
* @param Name $name Function or constant name to resolve
|
|
211
|
-
* @param
|
|
208
|
+
* @param int $type One of Stmt\Use_::TYPE_*
|
|
212
209
|
*
|
|
213
210
|
* @return Name Resolved name, or original name with attribute
|
|
214
211
|
*/
|
|
215
|
-
protected function resolveName(Name $name, int $type): Name {
|
|
212
|
+
protected function resolveName(Name $name, int $type) : Name {
|
|
216
213
|
if (!$this->replaceNodes) {
|
|
217
214
|
$resolvedName = $this->nameContext->getResolvedName($name, $type);
|
|
218
215
|
if (null !== $resolvedName) {
|
|
@@ -243,16 +240,17 @@ class NameResolver extends NodeVisitorAbstract {
|
|
|
243
240
|
return $name;
|
|
244
241
|
}
|
|
245
242
|
|
|
246
|
-
protected function resolveClassName(Name $name)
|
|
243
|
+
protected function resolveClassName(Name $name) {
|
|
247
244
|
return $this->resolveName($name, Stmt\Use_::TYPE_NORMAL);
|
|
248
245
|
}
|
|
249
246
|
|
|
250
|
-
protected function addNamespacedName(Node $node)
|
|
247
|
+
protected function addNamespacedName(Node $node) {
|
|
251
248
|
$node->namespacedName = Name::concat(
|
|
252
249
|
$this->nameContext->getNamespace(), (string) $node->name);
|
|
253
250
|
}
|
|
254
251
|
|
|
255
|
-
protected function resolveAttrGroups(Node $node)
|
|
252
|
+
protected function resolveAttrGroups(Node $node)
|
|
253
|
+
{
|
|
256
254
|
foreach ($node->attrGroups as $attrGroup) {
|
|
257
255
|
foreach ($attrGroup->attrs as $attr) {
|
|
258
256
|
$attr->name = $this->resolveClassName($attr->name);
|
|
@@ -14,11 +14,12 @@ use PhpParser\NodeVisitorAbstract;
|
|
|
14
14
|
* node can be accessed through <code>$node->getAttribute('previous')</code>,
|
|
15
15
|
* and the next node can be accessed through <code>$node->getAttribute('next')</code>.
|
|
16
16
|
*/
|
|
17
|
-
final class NodeConnectingVisitor extends NodeVisitorAbstract
|
|
17
|
+
final class NodeConnectingVisitor extends NodeVisitorAbstract
|
|
18
|
+
{
|
|
18
19
|
/**
|
|
19
20
|
* @var Node[]
|
|
20
21
|
*/
|
|
21
|
-
private
|
|
22
|
+
private $stack = [];
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @var ?Node
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PhpParser\NodeVisitor;
|
|
4
4
|
|
|
5
|
-
use PhpParser\Node;
|
|
6
|
-
use PhpParser\NodeVisitorAbstract;
|
|
7
|
-
|
|
8
5
|
use function array_pop;
|
|
9
6
|
use function count;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
use PhpParser\NodeVisitorAbstract;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Visitor that connects a child node to its parent node.
|
|
@@ -14,17 +13,20 @@ use function count;
|
|
|
14
13
|
* On the child node, the parent node can be accessed through
|
|
15
14
|
* <code>$node->getAttribute('parent')</code>.
|
|
16
15
|
*/
|
|
17
|
-
final class ParentConnectingVisitor extends NodeVisitorAbstract
|
|
16
|
+
final class ParentConnectingVisitor extends NodeVisitorAbstract
|
|
17
|
+
{
|
|
18
18
|
/**
|
|
19
19
|
* @var Node[]
|
|
20
20
|
*/
|
|
21
|
-
private
|
|
21
|
+
private $stack = [];
|
|
22
22
|
|
|
23
|
-
public function beforeTraverse(array $nodes)
|
|
23
|
+
public function beforeTraverse(array $nodes)
|
|
24
|
+
{
|
|
24
25
|
$this->stack = [];
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
public function enterNode(Node $node)
|
|
28
|
+
public function enterNode(Node $node)
|
|
29
|
+
{
|
|
28
30
|
if (!empty($this->stack)) {
|
|
29
31
|
$node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
|
|
30
32
|
}
|
|
@@ -32,7 +34,8 @@ final class ParentConnectingVisitor extends NodeVisitorAbstract {
|
|
|
32
34
|
$this->stack[] = $node;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
public function leaveNode(Node $node)
|
|
37
|
+
public function leaveNode(Node $node)
|
|
38
|
+
{
|
|
36
39
|
array_pop($this->stack);
|
|
37
40
|
}
|
|
38
41
|
}
|