@appthreat/atom 1.8.1 → 1.8.3
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.3-classpath.jar +0 -0
- package/plugins/lib/{io.appthreat.atom-1.8.1.jar → io.appthreat.atom-1.8.3.jar} +0 -0
- package/plugins/lib/{io.appthreat.c2cpg_3-1.1.3.jar → io.appthreat.c2cpg_3-1.1.5.jar} +0 -0
- package/plugins/lib/{io.appthreat.dataflowengineoss_3-1.1.3.jar → io.appthreat.dataflowengineoss_3-1.1.5.jar} +0 -0
- package/plugins/lib/{io.appthreat.javasrc2cpg_3-1.1.3.jar → io.appthreat.javasrc2cpg_3-1.1.5.jar} +0 -0
- package/plugins/lib/{io.appthreat.jimple2cpg_3-1.1.3.jar → io.appthreat.jimple2cpg_3-1.1.5.jar} +0 -0
- package/plugins/lib/{io.appthreat.jssrc2cpg_3-1.1.3.jar → io.appthreat.jssrc2cpg_3-1.1.5.jar} +0 -0
- package/plugins/lib/io.appthreat.php2atom_3-1.1.5.jar +0 -0
- package/plugins/lib/{io.appthreat.pysrc2cpg_3-1.1.3.jar → io.appthreat.pysrc2cpg_3-1.1.5.jar} +0 -0
- package/plugins/lib/{io.appthreat.semanticcpg_3-1.1.3.jar → io.appthreat.semanticcpg_3-1.1.5.jar} +0 -0
- package/plugins/lib/{io.appthreat.x2cpg_3-1.1.3.jar → io.appthreat.x2cpg_3-1.1.5.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/lib/io.appthreat.php2atom_3-1.1.3.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
|
@@ -10,14 +10,17 @@ use PhpParser\Node\Name;
|
|
|
10
10
|
use PhpParser\Node\Scalar\String_;
|
|
11
11
|
use PhpParser\Node\Stmt\Use_;
|
|
12
12
|
|
|
13
|
-
class BuilderFactory
|
|
13
|
+
class BuilderFactory
|
|
14
|
+
{
|
|
14
15
|
/**
|
|
15
16
|
* Creates an attribute node.
|
|
16
17
|
*
|
|
17
18
|
* @param string|Name $name Name of the attribute
|
|
18
|
-
* @param array
|
|
19
|
+
* @param array $args Attribute named arguments
|
|
20
|
+
*
|
|
21
|
+
* @return Node\Attribute
|
|
19
22
|
*/
|
|
20
|
-
public function attribute($name, array $args = []): Node\Attribute {
|
|
23
|
+
public function attribute($name, array $args = []) : Node\Attribute {
|
|
21
24
|
return new Node\Attribute(
|
|
22
25
|
BuilderHelpers::normalizeName($name),
|
|
23
26
|
$this->args($args)
|
|
@@ -31,7 +34,7 @@ class BuilderFactory {
|
|
|
31
34
|
*
|
|
32
35
|
* @return Builder\Namespace_ The created namespace builder
|
|
33
36
|
*/
|
|
34
|
-
public function namespace($name): Builder\Namespace_ {
|
|
37
|
+
public function namespace($name) : Builder\Namespace_ {
|
|
35
38
|
return new Builder\Namespace_($name);
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -42,7 +45,7 @@ class BuilderFactory {
|
|
|
42
45
|
*
|
|
43
46
|
* @return Builder\Class_ The created class builder
|
|
44
47
|
*/
|
|
45
|
-
public function class(string $name): Builder\Class_ {
|
|
48
|
+
public function class(string $name) : Builder\Class_ {
|
|
46
49
|
return new Builder\Class_($name);
|
|
47
50
|
}
|
|
48
51
|
|
|
@@ -53,7 +56,7 @@ class BuilderFactory {
|
|
|
53
56
|
*
|
|
54
57
|
* @return Builder\Interface_ The created interface builder
|
|
55
58
|
*/
|
|
56
|
-
public function interface(string $name): Builder\Interface_ {
|
|
59
|
+
public function interface(string $name) : Builder\Interface_ {
|
|
57
60
|
return new Builder\Interface_($name);
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -64,7 +67,7 @@ class BuilderFactory {
|
|
|
64
67
|
*
|
|
65
68
|
* @return Builder\Trait_ The created trait builder
|
|
66
69
|
*/
|
|
67
|
-
public function trait(string $name): Builder\Trait_ {
|
|
70
|
+
public function trait(string $name) : Builder\Trait_ {
|
|
68
71
|
return new Builder\Trait_($name);
|
|
69
72
|
}
|
|
70
73
|
|
|
@@ -75,7 +78,7 @@ class BuilderFactory {
|
|
|
75
78
|
*
|
|
76
79
|
* @return Builder\Enum_ The created enum builder
|
|
77
80
|
*/
|
|
78
|
-
public function enum(string $name): Builder\Enum_ {
|
|
81
|
+
public function enum(string $name) : Builder\Enum_ {
|
|
79
82
|
return new Builder\Enum_($name);
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -84,21 +87,21 @@ class BuilderFactory {
|
|
|
84
87
|
*
|
|
85
88
|
* @param Node\Name|string ...$traits Trait names
|
|
86
89
|
*
|
|
87
|
-
* @return Builder\TraitUse The
|
|
90
|
+
* @return Builder\TraitUse The create trait use builder
|
|
88
91
|
*/
|
|
89
|
-
public function useTrait(...$traits): Builder\TraitUse {
|
|
92
|
+
public function useTrait(...$traits) : Builder\TraitUse {
|
|
90
93
|
return new Builder\TraitUse(...$traits);
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
/**
|
|
94
97
|
* Creates a trait use adaptation builder.
|
|
95
98
|
*
|
|
96
|
-
* @param Node\Name|string|null
|
|
99
|
+
* @param Node\Name|string|null $trait Trait name
|
|
97
100
|
* @param Node\Identifier|string $method Method name
|
|
98
101
|
*
|
|
99
|
-
* @return Builder\TraitUseAdaptation The
|
|
102
|
+
* @return Builder\TraitUseAdaptation The create trait use adaptation builder
|
|
100
103
|
*/
|
|
101
|
-
public function traitUseAdaptation($trait, $method = null): Builder\TraitUseAdaptation {
|
|
104
|
+
public function traitUseAdaptation($trait, $method = null) : Builder\TraitUseAdaptation {
|
|
102
105
|
if ($method === null) {
|
|
103
106
|
$method = $trait;
|
|
104
107
|
$trait = null;
|
|
@@ -114,7 +117,7 @@ class BuilderFactory {
|
|
|
114
117
|
*
|
|
115
118
|
* @return Builder\Method The created method builder
|
|
116
119
|
*/
|
|
117
|
-
public function method(string $name): Builder\Method {
|
|
120
|
+
public function method(string $name) : Builder\Method {
|
|
118
121
|
return new Builder\Method($name);
|
|
119
122
|
}
|
|
120
123
|
|
|
@@ -125,7 +128,7 @@ class BuilderFactory {
|
|
|
125
128
|
*
|
|
126
129
|
* @return Builder\Param The created parameter builder
|
|
127
130
|
*/
|
|
128
|
-
public function param(string $name): Builder\Param {
|
|
131
|
+
public function param(string $name) : Builder\Param {
|
|
129
132
|
return new Builder\Param($name);
|
|
130
133
|
}
|
|
131
134
|
|
|
@@ -136,7 +139,7 @@ class BuilderFactory {
|
|
|
136
139
|
*
|
|
137
140
|
* @return Builder\Property The created property builder
|
|
138
141
|
*/
|
|
139
|
-
public function property(string $name): Builder\Property {
|
|
142
|
+
public function property(string $name) : Builder\Property {
|
|
140
143
|
return new Builder\Property($name);
|
|
141
144
|
}
|
|
142
145
|
|
|
@@ -147,7 +150,7 @@ class BuilderFactory {
|
|
|
147
150
|
*
|
|
148
151
|
* @return Builder\Function_ The created function builder
|
|
149
152
|
*/
|
|
150
|
-
public function function(string $name): Builder\Function_ {
|
|
153
|
+
public function function(string $name) : Builder\Function_ {
|
|
151
154
|
return new Builder\Function_($name);
|
|
152
155
|
}
|
|
153
156
|
|
|
@@ -158,7 +161,7 @@ class BuilderFactory {
|
|
|
158
161
|
*
|
|
159
162
|
* @return Builder\Use_ The created use builder
|
|
160
163
|
*/
|
|
161
|
-
public function use($name): Builder\Use_ {
|
|
164
|
+
public function use($name) : Builder\Use_ {
|
|
162
165
|
return new Builder\Use_($name, Use_::TYPE_NORMAL);
|
|
163
166
|
}
|
|
164
167
|
|
|
@@ -169,7 +172,7 @@ class BuilderFactory {
|
|
|
169
172
|
*
|
|
170
173
|
* @return Builder\Use_ The created use function builder
|
|
171
174
|
*/
|
|
172
|
-
public function useFunction($name): Builder\Use_ {
|
|
175
|
+
public function useFunction($name) : Builder\Use_ {
|
|
173
176
|
return new Builder\Use_($name, Use_::TYPE_FUNCTION);
|
|
174
177
|
}
|
|
175
178
|
|
|
@@ -180,30 +183,30 @@ class BuilderFactory {
|
|
|
180
183
|
*
|
|
181
184
|
* @return Builder\Use_ The created use const builder
|
|
182
185
|
*/
|
|
183
|
-
public function useConst($name): Builder\Use_ {
|
|
186
|
+
public function useConst($name) : Builder\Use_ {
|
|
184
187
|
return new Builder\Use_($name, Use_::TYPE_CONSTANT);
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
/**
|
|
188
191
|
* Creates a class constant builder.
|
|
189
192
|
*
|
|
190
|
-
* @param string|Identifier
|
|
193
|
+
* @param string|Identifier $name Name
|
|
191
194
|
* @param Node\Expr|bool|null|int|float|string|array $value Value
|
|
192
195
|
*
|
|
193
196
|
* @return Builder\ClassConst The created use const builder
|
|
194
197
|
*/
|
|
195
|
-
public function classConst($name, $value): Builder\ClassConst {
|
|
198
|
+
public function classConst($name, $value) : Builder\ClassConst {
|
|
196
199
|
return new Builder\ClassConst($name, $value);
|
|
197
200
|
}
|
|
198
201
|
|
|
199
202
|
/**
|
|
200
203
|
* Creates an enum case builder.
|
|
201
204
|
*
|
|
202
|
-
* @param string|Identifier $name
|
|
205
|
+
* @param string|Identifier $name Name
|
|
203
206
|
*
|
|
204
207
|
* @return Builder\EnumCase The created use const builder
|
|
205
208
|
*/
|
|
206
|
-
public function enumCase($name): Builder\EnumCase {
|
|
209
|
+
public function enumCase($name) : Builder\EnumCase {
|
|
207
210
|
return new Builder\EnumCase($name);
|
|
208
211
|
}
|
|
209
212
|
|
|
@@ -211,8 +214,10 @@ class BuilderFactory {
|
|
|
211
214
|
* Creates node a for a literal value.
|
|
212
215
|
*
|
|
213
216
|
* @param Expr|bool|null|int|float|string|array $value $value
|
|
217
|
+
*
|
|
218
|
+
* @return Expr
|
|
214
219
|
*/
|
|
215
|
-
public function val($value): Expr {
|
|
220
|
+
public function val($value) : Expr {
|
|
216
221
|
return BuilderHelpers::normalizeValue($value);
|
|
217
222
|
}
|
|
218
223
|
|
|
@@ -220,8 +225,10 @@ class BuilderFactory {
|
|
|
220
225
|
* Creates variable node.
|
|
221
226
|
*
|
|
222
227
|
* @param string|Expr $name Name
|
|
228
|
+
*
|
|
229
|
+
* @return Expr\Variable
|
|
223
230
|
*/
|
|
224
|
-
public function var($name): Expr\Variable {
|
|
231
|
+
public function var($name) : Expr\Variable {
|
|
225
232
|
if (!\is_string($name) && !$name instanceof Expr) {
|
|
226
233
|
throw new \LogicException('Variable name must be string or Expr');
|
|
227
234
|
}
|
|
@@ -236,9 +243,9 @@ class BuilderFactory {
|
|
|
236
243
|
*
|
|
237
244
|
* @param array $args List of arguments to normalize
|
|
238
245
|
*
|
|
239
|
-
* @return
|
|
246
|
+
* @return Arg[]
|
|
240
247
|
*/
|
|
241
|
-
public function args(array $args): array {
|
|
248
|
+
public function args(array $args) : array {
|
|
242
249
|
$normalizedArgs = [];
|
|
243
250
|
foreach ($args as $key => $arg) {
|
|
244
251
|
if (!($arg instanceof Arg)) {
|
|
@@ -256,9 +263,11 @@ class BuilderFactory {
|
|
|
256
263
|
* Creates a function call node.
|
|
257
264
|
*
|
|
258
265
|
* @param string|Name|Expr $name Function name
|
|
259
|
-
* @param array
|
|
266
|
+
* @param array $args Function arguments
|
|
267
|
+
*
|
|
268
|
+
* @return Expr\FuncCall
|
|
260
269
|
*/
|
|
261
|
-
public function funcCall($name, array $args = []): Expr\FuncCall {
|
|
270
|
+
public function funcCall($name, array $args = []) : Expr\FuncCall {
|
|
262
271
|
return new Expr\FuncCall(
|
|
263
272
|
BuilderHelpers::normalizeNameOrExpr($name),
|
|
264
273
|
$this->args($args)
|
|
@@ -268,11 +277,13 @@ class BuilderFactory {
|
|
|
268
277
|
/**
|
|
269
278
|
* Creates a method call node.
|
|
270
279
|
*
|
|
271
|
-
* @param Expr
|
|
280
|
+
* @param Expr $var Variable the method is called on
|
|
272
281
|
* @param string|Identifier|Expr $name Method name
|
|
273
|
-
* @param array
|
|
282
|
+
* @param array $args Method arguments
|
|
283
|
+
*
|
|
284
|
+
* @return Expr\MethodCall
|
|
274
285
|
*/
|
|
275
|
-
public function methodCall(Expr $var, $name, array $args = []): Expr\MethodCall {
|
|
286
|
+
public function methodCall(Expr $var, $name, array $args = []) : Expr\MethodCall {
|
|
276
287
|
return new Expr\MethodCall(
|
|
277
288
|
$var,
|
|
278
289
|
BuilderHelpers::normalizeIdentifierOrExpr($name),
|
|
@@ -283,11 +294,13 @@ class BuilderFactory {
|
|
|
283
294
|
/**
|
|
284
295
|
* Creates a static method call node.
|
|
285
296
|
*
|
|
286
|
-
* @param string|Name|Expr
|
|
287
|
-
* @param string|Identifier|Expr $name
|
|
288
|
-
* @param array
|
|
297
|
+
* @param string|Name|Expr $class Class name
|
|
298
|
+
* @param string|Identifier|Expr $name Method name
|
|
299
|
+
* @param array $args Method arguments
|
|
300
|
+
*
|
|
301
|
+
* @return Expr\StaticCall
|
|
289
302
|
*/
|
|
290
|
-
public function staticCall($class, $name, array $args = []): Expr\StaticCall {
|
|
303
|
+
public function staticCall($class, $name, array $args = []) : Expr\StaticCall {
|
|
291
304
|
return new Expr\StaticCall(
|
|
292
305
|
BuilderHelpers::normalizeNameOrExpr($class),
|
|
293
306
|
BuilderHelpers::normalizeIdentifierOrExpr($name),
|
|
@@ -299,9 +312,11 @@ class BuilderFactory {
|
|
|
299
312
|
* Creates an object creation node.
|
|
300
313
|
*
|
|
301
314
|
* @param string|Name|Expr $class Class name
|
|
302
|
-
* @param array
|
|
315
|
+
* @param array $args Constructor arguments
|
|
316
|
+
*
|
|
317
|
+
* @return Expr\New_
|
|
303
318
|
*/
|
|
304
|
-
public function new($class, array $args = []): Expr\New_ {
|
|
319
|
+
public function new($class, array $args = []) : Expr\New_ {
|
|
305
320
|
return new Expr\New_(
|
|
306
321
|
BuilderHelpers::normalizeNameOrExpr($class),
|
|
307
322
|
$this->args($args)
|
|
@@ -312,18 +327,22 @@ class BuilderFactory {
|
|
|
312
327
|
* Creates a constant fetch node.
|
|
313
328
|
*
|
|
314
329
|
* @param string|Name $name Constant name
|
|
330
|
+
*
|
|
331
|
+
* @return Expr\ConstFetch
|
|
315
332
|
*/
|
|
316
|
-
public function constFetch($name): Expr\ConstFetch {
|
|
333
|
+
public function constFetch($name) : Expr\ConstFetch {
|
|
317
334
|
return new Expr\ConstFetch(BuilderHelpers::normalizeName($name));
|
|
318
335
|
}
|
|
319
336
|
|
|
320
337
|
/**
|
|
321
338
|
* Creates a property fetch node.
|
|
322
339
|
*
|
|
323
|
-
* @param Expr
|
|
340
|
+
* @param Expr $var Variable holding object
|
|
324
341
|
* @param string|Identifier|Expr $name Property name
|
|
342
|
+
*
|
|
343
|
+
* @return Expr\PropertyFetch
|
|
325
344
|
*/
|
|
326
|
-
public function propertyFetch(Expr $var, $name): Expr\PropertyFetch {
|
|
345
|
+
public function propertyFetch(Expr $var, $name) : Expr\PropertyFetch {
|
|
327
346
|
return new Expr\PropertyFetch($var, BuilderHelpers::normalizeIdentifierOrExpr($name));
|
|
328
347
|
}
|
|
329
348
|
|
|
@@ -331,7 +350,9 @@ class BuilderFactory {
|
|
|
331
350
|
* Creates a class constant fetch node.
|
|
332
351
|
*
|
|
333
352
|
* @param string|Name|Expr $class Class name
|
|
334
|
-
* @param string|Identifier|Expr $name
|
|
353
|
+
* @param string|Identifier|Expr $name Constant name
|
|
354
|
+
*
|
|
355
|
+
* @return Expr\ClassConstFetch
|
|
335
356
|
*/
|
|
336
357
|
public function classConstFetch($class, $name): Expr\ClassConstFetch {
|
|
337
358
|
return new Expr\ClassConstFetch(
|
|
@@ -344,8 +365,10 @@ class BuilderFactory {
|
|
|
344
365
|
* Creates nested Concat nodes from a list of expressions.
|
|
345
366
|
*
|
|
346
367
|
* @param Expr|string ...$exprs Expressions or literal strings
|
|
368
|
+
*
|
|
369
|
+
* @return Concat
|
|
347
370
|
*/
|
|
348
|
-
public function concat(...$exprs): Concat {
|
|
371
|
+
public function concat(...$exprs) : Concat {
|
|
349
372
|
$numExprs = count($exprs);
|
|
350
373
|
if ($numExprs < 2) {
|
|
351
374
|
throw new \LogicException('Expected at least two expressions');
|
|
@@ -360,8 +383,9 @@ class BuilderFactory {
|
|
|
360
383
|
|
|
361
384
|
/**
|
|
362
385
|
* @param string|Expr $expr
|
|
386
|
+
* @return Expr
|
|
363
387
|
*/
|
|
364
|
-
private function normalizeStringExpr($expr): Expr {
|
|
388
|
+
private function normalizeStringExpr($expr) : Expr {
|
|
365
389
|
if ($expr instanceof Expr) {
|
|
366
390
|
return $expr;
|
|
367
391
|
}
|
|
@@ -15,7 +15,8 @@ use PhpParser\Node\Stmt;
|
|
|
15
15
|
*
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
|
-
final class BuilderHelpers
|
|
18
|
+
final class BuilderHelpers
|
|
19
|
+
{
|
|
19
20
|
/**
|
|
20
21
|
* Normalizes a node: Converts builder objects to nodes.
|
|
21
22
|
*
|
|
@@ -23,7 +24,7 @@ final class BuilderHelpers {
|
|
|
23
24
|
*
|
|
24
25
|
* @return Node The normalized node
|
|
25
26
|
*/
|
|
26
|
-
public static function normalizeNode($node): Node {
|
|
27
|
+
public static function normalizeNode($node) : Node {
|
|
27
28
|
if ($node instanceof Builder) {
|
|
28
29
|
return $node->getNode();
|
|
29
30
|
}
|
|
@@ -44,7 +45,7 @@ final class BuilderHelpers {
|
|
|
44
45
|
*
|
|
45
46
|
* @return Stmt The normalized statement node
|
|
46
47
|
*/
|
|
47
|
-
public static function normalizeStmt($node): Stmt {
|
|
48
|
+
public static function normalizeStmt($node) : Stmt {
|
|
48
49
|
$node = self::normalizeNode($node);
|
|
49
50
|
if ($node instanceof Stmt) {
|
|
50
51
|
return $node;
|
|
@@ -64,7 +65,7 @@ final class BuilderHelpers {
|
|
|
64
65
|
*
|
|
65
66
|
* @return Identifier The normalized identifier
|
|
66
67
|
*/
|
|
67
|
-
public static function normalizeIdentifier($name): Identifier {
|
|
68
|
+
public static function normalizeIdentifier($name) : Identifier {
|
|
68
69
|
if ($name instanceof Identifier) {
|
|
69
70
|
return $name;
|
|
70
71
|
}
|
|
@@ -102,7 +103,7 @@ final class BuilderHelpers {
|
|
|
102
103
|
*
|
|
103
104
|
* @return Name The normalized name
|
|
104
105
|
*/
|
|
105
|
-
public static function normalizeName($name): Name {
|
|
106
|
+
public static function normalizeName($name) : Name {
|
|
106
107
|
if ($name instanceof Name) {
|
|
107
108
|
return $name;
|
|
108
109
|
}
|
|
@@ -218,7 +219,7 @@ final class BuilderHelpers {
|
|
|
218
219
|
*
|
|
219
220
|
* @return Expr The normalized value
|
|
220
221
|
*/
|
|
221
|
-
public static function normalizeValue($value): Expr {
|
|
222
|
+
public static function normalizeValue($value) : Expr {
|
|
222
223
|
if ($value instanceof Node\Expr) {
|
|
223
224
|
return $value;
|
|
224
225
|
}
|
|
@@ -236,11 +237,11 @@ final class BuilderHelpers {
|
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
if (is_int($value)) {
|
|
239
|
-
return new Scalar\
|
|
240
|
+
return new Scalar\LNumber($value);
|
|
240
241
|
}
|
|
241
242
|
|
|
242
243
|
if (is_float($value)) {
|
|
243
|
-
return new Scalar\
|
|
244
|
+
return new Scalar\DNumber($value);
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
if (is_string($value)) {
|
|
@@ -253,12 +254,12 @@ final class BuilderHelpers {
|
|
|
253
254
|
foreach ($value as $itemKey => $itemValue) {
|
|
254
255
|
// for consecutive, numeric keys don't generate keys
|
|
255
256
|
if (null !== $lastKey && ++$lastKey === $itemKey) {
|
|
256
|
-
$items[] = new
|
|
257
|
+
$items[] = new Expr\ArrayItem(
|
|
257
258
|
self::normalizeValue($itemValue)
|
|
258
259
|
);
|
|
259
260
|
} else {
|
|
260
261
|
$lastKey = null;
|
|
261
|
-
$items[] = new
|
|
262
|
+
$items[] = new Expr\ArrayItem(
|
|
262
263
|
self::normalizeValue($itemValue),
|
|
263
264
|
self::normalizeValue($itemKey)
|
|
264
265
|
);
|
|
@@ -278,7 +279,7 @@ final class BuilderHelpers {
|
|
|
278
279
|
*
|
|
279
280
|
* @return Comment\Doc The normalized doc comment
|
|
280
281
|
*/
|
|
281
|
-
public static function normalizeDocComment($docComment): Comment\Doc {
|
|
282
|
+
public static function normalizeDocComment($docComment) : Comment\Doc {
|
|
282
283
|
if ($docComment instanceof Comment\Doc) {
|
|
283
284
|
return $docComment;
|
|
284
285
|
}
|
|
@@ -297,7 +298,8 @@ final class BuilderHelpers {
|
|
|
297
298
|
*
|
|
298
299
|
* @return Node\AttributeGroup The Attribute Group
|
|
299
300
|
*/
|
|
300
|
-
public static function normalizeAttribute($attribute): Node\AttributeGroup
|
|
301
|
+
public static function normalizeAttribute($attribute) : Node\AttributeGroup
|
|
302
|
+
{
|
|
301
303
|
if ($attribute instanceof Node\AttributeGroup) {
|
|
302
304
|
return $attribute;
|
|
303
305
|
}
|
|
@@ -313,12 +315,12 @@ final class BuilderHelpers {
|
|
|
313
315
|
* Adds a modifier and returns new modifier bitmask.
|
|
314
316
|
*
|
|
315
317
|
* @param int $modifiers Existing modifiers
|
|
316
|
-
* @param int $modifier
|
|
318
|
+
* @param int $modifier Modifier to set
|
|
317
319
|
*
|
|
318
320
|
* @return int New modifiers
|
|
319
321
|
*/
|
|
320
|
-
public static function addModifier(int $modifiers, int $modifier): int {
|
|
321
|
-
|
|
322
|
+
public static function addModifier(int $modifiers, int $modifier) : int {
|
|
323
|
+
Stmt\Class_::verifyModifier($modifiers, $modifier);
|
|
322
324
|
return $modifiers | $modifier;
|
|
323
325
|
}
|
|
324
326
|
|
|
@@ -326,8 +328,8 @@ final class BuilderHelpers {
|
|
|
326
328
|
* Adds a modifier and returns new modifier bitmask.
|
|
327
329
|
* @return int New modifiers
|
|
328
330
|
*/
|
|
329
|
-
public static function addClassModifier(int $existingModifiers, int $modifierToSet): int {
|
|
330
|
-
|
|
331
|
+
public static function addClassModifier(int $existingModifiers, int $modifierToSet) : int {
|
|
332
|
+
Stmt\Class_::verifyClassModifier($existingModifiers, $modifierToSet);
|
|
331
333
|
return $existingModifiers | $modifierToSet;
|
|
332
334
|
}
|
|
333
335
|
}
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PhpParser;
|
|
4
4
|
|
|
5
|
-
class Comment implements \JsonSerializable
|
|
6
|
-
|
|
7
|
-
protected
|
|
8
|
-
protected
|
|
9
|
-
protected
|
|
10
|
-
protected
|
|
11
|
-
protected
|
|
12
|
-
protected
|
|
5
|
+
class Comment implements \JsonSerializable
|
|
6
|
+
{
|
|
7
|
+
protected $text;
|
|
8
|
+
protected $startLine;
|
|
9
|
+
protected $startFilePos;
|
|
10
|
+
protected $startTokenPos;
|
|
11
|
+
protected $endLine;
|
|
12
|
+
protected $endFilePos;
|
|
13
|
+
protected $endTokenPos;
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Constructs a comment node.
|
|
16
17
|
*
|
|
17
|
-
* @param string $text
|
|
18
|
-
* @param int
|
|
19
|
-
* @param int
|
|
20
|
-
* @param int
|
|
18
|
+
* @param string $text Comment text (including comment delimiters like /*)
|
|
19
|
+
* @param int $startLine Line number the comment started on
|
|
20
|
+
* @param int $startFilePos File offset the comment started on
|
|
21
|
+
* @param int $startTokenPos Token offset the comment started on
|
|
21
22
|
*/
|
|
22
23
|
public function __construct(
|
|
23
24
|
string $text,
|
|
@@ -38,7 +39,7 @@ class Comment implements \JsonSerializable {
|
|
|
38
39
|
*
|
|
39
40
|
* @return string The comment text (including comment delimiters like /*)
|
|
40
41
|
*/
|
|
41
|
-
public function getText(): string {
|
|
42
|
+
public function getText() : string {
|
|
42
43
|
return $this->text;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -47,7 +48,7 @@ class Comment implements \JsonSerializable {
|
|
|
47
48
|
*
|
|
48
49
|
* @return int Line number (or -1 if not available)
|
|
49
50
|
*/
|
|
50
|
-
public function getStartLine(): int {
|
|
51
|
+
public function getStartLine() : int {
|
|
51
52
|
return $this->startLine;
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -56,7 +57,7 @@ class Comment implements \JsonSerializable {
|
|
|
56
57
|
*
|
|
57
58
|
* @return int File offset (or -1 if not available)
|
|
58
59
|
*/
|
|
59
|
-
public function getStartFilePos(): int {
|
|
60
|
+
public function getStartFilePos() : int {
|
|
60
61
|
return $this->startFilePos;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -65,7 +66,7 @@ class Comment implements \JsonSerializable {
|
|
|
65
66
|
*
|
|
66
67
|
* @return int Token offset (or -1 if not available)
|
|
67
68
|
*/
|
|
68
|
-
public function getStartTokenPos(): int {
|
|
69
|
+
public function getStartTokenPos() : int {
|
|
69
70
|
return $this->startTokenPos;
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -74,7 +75,7 @@ class Comment implements \JsonSerializable {
|
|
|
74
75
|
*
|
|
75
76
|
* @return int Line number (or -1 if not available)
|
|
76
77
|
*/
|
|
77
|
-
public function getEndLine(): int {
|
|
78
|
+
public function getEndLine() : int {
|
|
78
79
|
return $this->endLine;
|
|
79
80
|
}
|
|
80
81
|
|
|
@@ -83,7 +84,7 @@ class Comment implements \JsonSerializable {
|
|
|
83
84
|
*
|
|
84
85
|
* @return int File offset (or -1 if not available)
|
|
85
86
|
*/
|
|
86
|
-
public function getEndFilePos(): int {
|
|
87
|
+
public function getEndFilePos() : int {
|
|
87
88
|
return $this->endFilePos;
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -92,16 +93,49 @@ class Comment implements \JsonSerializable {
|
|
|
92
93
|
*
|
|
93
94
|
* @return int Token offset (or -1 if not available)
|
|
94
95
|
*/
|
|
95
|
-
public function getEndTokenPos(): int {
|
|
96
|
+
public function getEndTokenPos() : int {
|
|
96
97
|
return $this->endTokenPos;
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Gets the line number the comment started on.
|
|
102
|
+
*
|
|
103
|
+
* @deprecated Use getStartLine() instead
|
|
104
|
+
*
|
|
105
|
+
* @return int Line number
|
|
106
|
+
*/
|
|
107
|
+
public function getLine() : int {
|
|
108
|
+
return $this->startLine;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Gets the file offset the comment started on.
|
|
113
|
+
*
|
|
114
|
+
* @deprecated Use getStartFilePos() instead
|
|
115
|
+
*
|
|
116
|
+
* @return int File offset
|
|
117
|
+
*/
|
|
118
|
+
public function getFilePos() : int {
|
|
119
|
+
return $this->startFilePos;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Gets the token offset the comment started on.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated Use getStartTokenPos() instead
|
|
126
|
+
*
|
|
127
|
+
* @return int Token offset
|
|
128
|
+
*/
|
|
129
|
+
public function getTokenPos() : int {
|
|
130
|
+
return $this->startTokenPos;
|
|
131
|
+
}
|
|
132
|
+
|
|
99
133
|
/**
|
|
100
134
|
* Gets the comment text.
|
|
101
135
|
*
|
|
102
136
|
* @return string The comment text (including comment delimiters like /*)
|
|
103
137
|
*/
|
|
104
|
-
public function __toString(): string {
|
|
138
|
+
public function __toString() : string {
|
|
105
139
|
return $this->text;
|
|
106
140
|
}
|
|
107
141
|
|
|
@@ -110,19 +144,18 @@ class Comment implements \JsonSerializable {
|
|
|
110
144
|
*
|
|
111
145
|
* "Reformatted" here means that we try to clean up the whitespace at the
|
|
112
146
|
* starts of the lines. This is necessary because we receive the comments
|
|
113
|
-
* without
|
|
147
|
+
* without trailing whitespace on the first line, but with trailing whitespace
|
|
114
148
|
* on all subsequent lines.
|
|
115
149
|
*
|
|
116
|
-
*
|
|
150
|
+
* @return mixed|string
|
|
117
151
|
*/
|
|
118
|
-
public function getReformattedText()
|
|
119
|
-
$text =
|
|
152
|
+
public function getReformattedText() {
|
|
153
|
+
$text = trim($this->text);
|
|
120
154
|
$newlinePos = strpos($text, "\n");
|
|
121
155
|
if (false === $newlinePos) {
|
|
122
156
|
// Single line comments don't need further processing
|
|
123
157
|
return $text;
|
|
124
|
-
}
|
|
125
|
-
if (preg_match('(^.*(?:\n\s+\*.*)+$)', $text)) {
|
|
158
|
+
} elseif (preg_match('((*BSR_ANYCRLF)(*ANYCRLF)^.*(?:\R\s+\*.*)+$)', $text)) {
|
|
126
159
|
// Multi line comment of the type
|
|
127
160
|
//
|
|
128
161
|
// /*
|
|
@@ -131,9 +164,8 @@ class Comment implements \JsonSerializable {
|
|
|
131
164
|
// */
|
|
132
165
|
//
|
|
133
166
|
// is handled by replacing the whitespace sequences before the * by a single space
|
|
134
|
-
return preg_replace('(^\s+\*)m', ' *', $text);
|
|
135
|
-
}
|
|
136
|
-
if (preg_match('(^/\*\*?\s*\n)', $text) && preg_match('(\n(\s*)\*/$)', $text, $matches)) {
|
|
167
|
+
return preg_replace('(^\s+\*)m', ' *', $this->text);
|
|
168
|
+
} elseif (preg_match('(^/\*\*?\s*[\r\n])', $text) && preg_match('(\n(\s*)\*/$)', $text, $matches)) {
|
|
137
169
|
// Multi line comment of the type
|
|
138
170
|
//
|
|
139
171
|
// /*
|
|
@@ -145,8 +177,7 @@ class Comment implements \JsonSerializable {
|
|
|
145
177
|
// */ on all lines. So if the last line is " */", then " " is removed at the
|
|
146
178
|
// start of all lines.
|
|
147
179
|
return preg_replace('(^' . preg_quote($matches[1]) . ')m', '', $text);
|
|
148
|
-
}
|
|
149
|
-
if (preg_match('(^/\*\*?\s*(?!\s))', $text, $matches)) {
|
|
180
|
+
} elseif (preg_match('(^/\*\*?\s*(?!\s))', $text, $matches)) {
|
|
150
181
|
// Multi line comment of the type
|
|
151
182
|
//
|
|
152
183
|
// /* Some text.
|
|
@@ -173,9 +204,9 @@ class Comment implements \JsonSerializable {
|
|
|
173
204
|
* @param string $str String to check
|
|
174
205
|
* @return int Length in characters. Tabs count as single characters.
|
|
175
206
|
*/
|
|
176
|
-
private function getShortestWhitespacePrefixLen(string $str): int {
|
|
207
|
+
private function getShortestWhitespacePrefixLen(string $str) : int {
|
|
177
208
|
$lines = explode("\n", $str);
|
|
178
|
-
$shortestPrefixLen = \
|
|
209
|
+
$shortestPrefixLen = \INF;
|
|
179
210
|
foreach ($lines as $line) {
|
|
180
211
|
preg_match('(^\s*)', $line, $matches);
|
|
181
212
|
$prefixLen = strlen($matches[0]);
|
|
@@ -187,9 +218,10 @@ class Comment implements \JsonSerializable {
|
|
|
187
218
|
}
|
|
188
219
|
|
|
189
220
|
/**
|
|
190
|
-
* @return
|
|
221
|
+
* @return array
|
|
222
|
+
* @psalm-return array{nodeType:string, text:mixed, line:mixed, filePos:mixed}
|
|
191
223
|
*/
|
|
192
|
-
public function jsonSerialize(): array {
|
|
224
|
+
public function jsonSerialize() : array {
|
|
193
225
|
// Technically not a node, but we make it look like one anyway
|
|
194
226
|
$type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment';
|
|
195
227
|
return [
|