@appthreat/atom 1.8.0 → 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/astgen.js +6 -2
- package/index.js +3 -1
- package/package.json +3 -2
- package/phpastgen.js +37 -0
- package/plugins/autoload.php +25 -0
- package/plugins/bin/atom +1 -1
- package/plugins/bin/atom.bat +1 -1
- package/plugins/bin/php-parse +119 -0
- package/plugins/composer/ClassLoader.php +579 -0
- package/plugins/composer/InstalledVersions.php +359 -0
- package/plugins/composer/LICENSE +21 -0
- package/plugins/composer/autoload_classmap.php +260 -0
- package/plugins/composer/autoload_namespaces.php +9 -0
- package/plugins/composer/autoload_psr4.php +10 -0
- package/plugins/composer/autoload_real.php +36 -0
- package/plugins/composer/autoload_static.php +286 -0
- package/plugins/composer/installed.json +65 -0
- package/plugins/composer/installed.php +32 -0
- package/plugins/lib/io.appthreat.atom-1.8.2-classpath.jar +0 -0
- package/plugins/lib/{io.appthreat.atom-1.8.0.jar → io.appthreat.atom-1.8.2.jar} +0 -0
- package/plugins/lib/{io.appthreat.c2cpg_3-1.1.1.jar → io.appthreat.c2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.dataflowengineoss_3-1.1.1.jar → io.appthreat.dataflowengineoss_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.javasrc2cpg_3-1.1.1.jar → io.appthreat.javasrc2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.jimple2cpg_3-1.1.1.jar → io.appthreat.jimple2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.jssrc2cpg_3-1.1.1.jar → io.appthreat.jssrc2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/io.appthreat.php2atom_3-1.1.4.jar +0 -0
- package/plugins/lib/{io.appthreat.pysrc2cpg_3-1.1.1.jar → io.appthreat.pysrc2cpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.semanticcpg_3-1.1.1.jar → io.appthreat.semanticcpg_3-1.1.4.jar} +0 -0
- package/plugins/lib/{io.appthreat.x2cpg_3-1.1.1.jar → io.appthreat.x2cpg_3-1.1.4.jar} +0 -0
- package/plugins/nikic/php-parser/LICENSE +29 -0
- package/plugins/nikic/php-parser/README.md +225 -0
- package/plugins/nikic/php-parser/bin/php-parse +205 -0
- package/plugins/nikic/php-parser/composer.json +41 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php +148 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Class_.php +146 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +43 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +85 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Enum_.php +117 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +73 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Function_.php +67 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +93 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Method.php +146 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +45 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Param.php +168 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Property.php +161 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php +64 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php +148 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +78 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder/Use_.php +49 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Builder.php +13 -0
- package/plugins/nikic/php-parser/lib/PhpParser/BuilderFactory.php +399 -0
- package/plugins/nikic/php-parser/lib/PhpParser/BuilderHelpers.php +335 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Comment/Doc.php +7 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Comment.php +239 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php +6 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php +229 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Error.php +180 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php +46 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +18 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler.php +13 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php +27 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/Differ.php +164 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +64 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +286 -0
- package/plugins/nikic/php-parser/lib/PhpParser/JsonDecoder.php +103 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +251 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +56 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +47 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php +44 -0
- 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 +62 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +23 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +67 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +105 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php +36 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php +36 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +25 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer.php +560 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NameContext.php +285 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Arg.php +46 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Attribute.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php +29 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/ComplexType.php +14 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Const_.php +37 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +41 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php +79 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +40 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php +39 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php +17 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php +12 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +26 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +36 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +79 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +39 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +39 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +35 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +45 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +41 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +45 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +35 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +35 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +46 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +36 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +38 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr.php +9 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +43 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Identifier.php +75 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/MatchArm.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php +50 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php +50 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Name.php +254 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/NullableType.php +28 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Param.php +60 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +77 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +80 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php +16 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +28 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php +157 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar.php +7 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +41 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +85 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +109 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +161 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +137 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php +37 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php +40 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php +33 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +43 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +47 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +77 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +39 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +43 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +37 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +31 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +38 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php +17 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php +91 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +37 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +38 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +13 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +32 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +38 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +30 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +52 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +47 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +34 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt.php +9 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/UnionType.php +28 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php +17 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php +27 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Node.php +151 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeAbstract.php +178 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeDumper.php +206 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeFinder.php +81 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeTraverser.php +291 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +29 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php +20 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php +48 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +50 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +260 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +52 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +41 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor.php +72 -0
- package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +25 -0
- 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 +2898 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +148 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Parser.php +18 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ParserAbstract.php +1060 -0
- package/plugins/nikic/php-parser/lib/PhpParser/ParserFactory.php +76 -0
- package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php +1126 -0
- package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +1576 -0
- package/utils.mjs +10 -0
- package/plugins/lib/io.appthreat.atom-1.8.0-classpath.jar +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
use PhpParser\Node\Name;
|
|
9
|
+
use PhpParser\Node\Stmt;
|
|
10
|
+
|
|
11
|
+
class Class_ extends Declaration
|
|
12
|
+
{
|
|
13
|
+
protected $name;
|
|
14
|
+
|
|
15
|
+
protected $extends = null;
|
|
16
|
+
protected $implements = [];
|
|
17
|
+
protected $flags = 0;
|
|
18
|
+
|
|
19
|
+
protected $uses = [];
|
|
20
|
+
protected $constants = [];
|
|
21
|
+
protected $properties = [];
|
|
22
|
+
protected $methods = [];
|
|
23
|
+
|
|
24
|
+
/** @var Node\AttributeGroup[] */
|
|
25
|
+
protected $attributeGroups = [];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a class builder.
|
|
29
|
+
*
|
|
30
|
+
* @param string $name Name of the class
|
|
31
|
+
*/
|
|
32
|
+
public function __construct(string $name) {
|
|
33
|
+
$this->name = $name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Extends a class.
|
|
38
|
+
*
|
|
39
|
+
* @param Name|string $class Name of class to extend
|
|
40
|
+
*
|
|
41
|
+
* @return $this The builder instance (for fluid interface)
|
|
42
|
+
*/
|
|
43
|
+
public function extend($class) {
|
|
44
|
+
$this->extends = BuilderHelpers::normalizeName($class);
|
|
45
|
+
|
|
46
|
+
return $this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Implements one or more interfaces.
|
|
51
|
+
*
|
|
52
|
+
* @param Name|string ...$interfaces Names of interfaces to implement
|
|
53
|
+
*
|
|
54
|
+
* @return $this The builder instance (for fluid interface)
|
|
55
|
+
*/
|
|
56
|
+
public function implement(...$interfaces) {
|
|
57
|
+
foreach ($interfaces as $interface) {
|
|
58
|
+
$this->implements[] = BuilderHelpers::normalizeName($interface);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return $this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Makes the class abstract.
|
|
66
|
+
*
|
|
67
|
+
* @return $this The builder instance (for fluid interface)
|
|
68
|
+
*/
|
|
69
|
+
public function makeAbstract() {
|
|
70
|
+
$this->flags = BuilderHelpers::addClassModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT);
|
|
71
|
+
|
|
72
|
+
return $this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Makes the class final.
|
|
77
|
+
*
|
|
78
|
+
* @return $this The builder instance (for fluid interface)
|
|
79
|
+
*/
|
|
80
|
+
public function makeFinal() {
|
|
81
|
+
$this->flags = BuilderHelpers::addClassModifier($this->flags, Stmt\Class_::MODIFIER_FINAL);
|
|
82
|
+
|
|
83
|
+
return $this;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public function makeReadonly() {
|
|
87
|
+
$this->flags = BuilderHelpers::addClassModifier($this->flags, Stmt\Class_::MODIFIER_READONLY);
|
|
88
|
+
|
|
89
|
+
return $this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Adds a statement.
|
|
94
|
+
*
|
|
95
|
+
* @param Stmt|PhpParser\Builder $stmt The statement to add
|
|
96
|
+
*
|
|
97
|
+
* @return $this The builder instance (for fluid interface)
|
|
98
|
+
*/
|
|
99
|
+
public function addStmt($stmt) {
|
|
100
|
+
$stmt = BuilderHelpers::normalizeNode($stmt);
|
|
101
|
+
|
|
102
|
+
$targets = [
|
|
103
|
+
Stmt\TraitUse::class => &$this->uses,
|
|
104
|
+
Stmt\ClassConst::class => &$this->constants,
|
|
105
|
+
Stmt\Property::class => &$this->properties,
|
|
106
|
+
Stmt\ClassMethod::class => &$this->methods,
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
$class = \get_class($stmt);
|
|
110
|
+
if (!isset($targets[$class])) {
|
|
111
|
+
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
$targets[$class][] = $stmt;
|
|
115
|
+
|
|
116
|
+
return $this;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Adds an attribute group.
|
|
121
|
+
*
|
|
122
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
123
|
+
*
|
|
124
|
+
* @return $this The builder instance (for fluid interface)
|
|
125
|
+
*/
|
|
126
|
+
public function addAttribute($attribute) {
|
|
127
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
128
|
+
|
|
129
|
+
return $this;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Returns the built class node.
|
|
134
|
+
*
|
|
135
|
+
* @return Stmt\Class_ The built class node
|
|
136
|
+
*/
|
|
137
|
+
public function getNode() : PhpParser\Node {
|
|
138
|
+
return new Stmt\Class_($this->name, [
|
|
139
|
+
'flags' => $this->flags,
|
|
140
|
+
'extends' => $this->extends,
|
|
141
|
+
'implements' => $this->implements,
|
|
142
|
+
'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods),
|
|
143
|
+
'attrGroups' => $this->attributeGroups,
|
|
144
|
+
], $this->attributes);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
|
|
8
|
+
abstract class Declaration implements PhpParser\Builder
|
|
9
|
+
{
|
|
10
|
+
protected $attributes = [];
|
|
11
|
+
|
|
12
|
+
abstract public function addStmt($stmt);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Adds multiple statements.
|
|
16
|
+
*
|
|
17
|
+
* @param array $stmts The statements to add
|
|
18
|
+
*
|
|
19
|
+
* @return $this The builder instance (for fluid interface)
|
|
20
|
+
*/
|
|
21
|
+
public function addStmts(array $stmts) {
|
|
22
|
+
foreach ($stmts as $stmt) {
|
|
23
|
+
$this->addStmt($stmt);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return $this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Sets doc comment for the declaration.
|
|
31
|
+
*
|
|
32
|
+
* @param PhpParser\Comment\Doc|string $docComment Doc comment to set
|
|
33
|
+
*
|
|
34
|
+
* @return $this The builder instance (for fluid interface)
|
|
35
|
+
*/
|
|
36
|
+
public function setDocComment($docComment) {
|
|
37
|
+
$this->attributes['comments'] = [
|
|
38
|
+
BuilderHelpers::normalizeDocComment($docComment)
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
return $this;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace PhpParser\Builder;
|
|
6
|
+
|
|
7
|
+
use PhpParser;
|
|
8
|
+
use PhpParser\BuilderHelpers;
|
|
9
|
+
use PhpParser\Node;
|
|
10
|
+
use PhpParser\Node\Identifier;
|
|
11
|
+
use PhpParser\Node\Stmt;
|
|
12
|
+
|
|
13
|
+
class EnumCase implements PhpParser\Builder
|
|
14
|
+
{
|
|
15
|
+
protected $name;
|
|
16
|
+
protected $value = null;
|
|
17
|
+
protected $attributes = [];
|
|
18
|
+
|
|
19
|
+
/** @var Node\AttributeGroup[] */
|
|
20
|
+
protected $attributeGroups = [];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates an enum case builder.
|
|
24
|
+
*
|
|
25
|
+
* @param string|Identifier $name Name
|
|
26
|
+
*/
|
|
27
|
+
public function __construct($name) {
|
|
28
|
+
$this->name = $name;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Sets the value.
|
|
33
|
+
*
|
|
34
|
+
* @param Node\Expr|string|int $value
|
|
35
|
+
*
|
|
36
|
+
* @return $this
|
|
37
|
+
*/
|
|
38
|
+
public function setValue($value) {
|
|
39
|
+
$this->value = BuilderHelpers::normalizeValue($value);
|
|
40
|
+
|
|
41
|
+
return $this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sets doc comment for the constant.
|
|
46
|
+
*
|
|
47
|
+
* @param PhpParser\Comment\Doc|string $docComment Doc comment to set
|
|
48
|
+
*
|
|
49
|
+
* @return $this The builder instance (for fluid interface)
|
|
50
|
+
*/
|
|
51
|
+
public function setDocComment($docComment) {
|
|
52
|
+
$this->attributes = [
|
|
53
|
+
'comments' => [BuilderHelpers::normalizeDocComment($docComment)]
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
return $this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Adds an attribute group.
|
|
61
|
+
*
|
|
62
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
63
|
+
*
|
|
64
|
+
* @return $this The builder instance (for fluid interface)
|
|
65
|
+
*/
|
|
66
|
+
public function addAttribute($attribute) {
|
|
67
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
68
|
+
|
|
69
|
+
return $this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns the built enum case node.
|
|
74
|
+
*
|
|
75
|
+
* @return Stmt\EnumCase The built constant node
|
|
76
|
+
*/
|
|
77
|
+
public function getNode(): PhpParser\Node {
|
|
78
|
+
return new Stmt\EnumCase(
|
|
79
|
+
$this->name,
|
|
80
|
+
$this->value,
|
|
81
|
+
$this->attributeGroups,
|
|
82
|
+
$this->attributes
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
use PhpParser\Node\Identifier;
|
|
9
|
+
use PhpParser\Node\Name;
|
|
10
|
+
use PhpParser\Node\Stmt;
|
|
11
|
+
|
|
12
|
+
class Enum_ extends Declaration
|
|
13
|
+
{
|
|
14
|
+
protected $name;
|
|
15
|
+
protected $scalarType = null;
|
|
16
|
+
|
|
17
|
+
protected $implements = [];
|
|
18
|
+
|
|
19
|
+
protected $uses = [];
|
|
20
|
+
protected $enumCases = [];
|
|
21
|
+
protected $constants = [];
|
|
22
|
+
protected $methods = [];
|
|
23
|
+
|
|
24
|
+
/** @var Node\AttributeGroup[] */
|
|
25
|
+
protected $attributeGroups = [];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates an enum builder.
|
|
29
|
+
*
|
|
30
|
+
* @param string $name Name of the enum
|
|
31
|
+
*/
|
|
32
|
+
public function __construct(string $name) {
|
|
33
|
+
$this->name = $name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Sets the scalar type.
|
|
38
|
+
*
|
|
39
|
+
* @param string|Identifier $type
|
|
40
|
+
*
|
|
41
|
+
* @return $this
|
|
42
|
+
*/
|
|
43
|
+
public function setScalarType($scalarType) {
|
|
44
|
+
$this->scalarType = BuilderHelpers::normalizeType($scalarType);
|
|
45
|
+
|
|
46
|
+
return $this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Implements one or more interfaces.
|
|
51
|
+
*
|
|
52
|
+
* @param Name|string ...$interfaces Names of interfaces to implement
|
|
53
|
+
*
|
|
54
|
+
* @return $this The builder instance (for fluid interface)
|
|
55
|
+
*/
|
|
56
|
+
public function implement(...$interfaces) {
|
|
57
|
+
foreach ($interfaces as $interface) {
|
|
58
|
+
$this->implements[] = BuilderHelpers::normalizeName($interface);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return $this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Adds a statement.
|
|
66
|
+
*
|
|
67
|
+
* @param Stmt|PhpParser\Builder $stmt The statement to add
|
|
68
|
+
*
|
|
69
|
+
* @return $this The builder instance (for fluid interface)
|
|
70
|
+
*/
|
|
71
|
+
public function addStmt($stmt) {
|
|
72
|
+
$stmt = BuilderHelpers::normalizeNode($stmt);
|
|
73
|
+
|
|
74
|
+
$targets = [
|
|
75
|
+
Stmt\TraitUse::class => &$this->uses,
|
|
76
|
+
Stmt\EnumCase::class => &$this->enumCases,
|
|
77
|
+
Stmt\ClassConst::class => &$this->constants,
|
|
78
|
+
Stmt\ClassMethod::class => &$this->methods,
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
$class = \get_class($stmt);
|
|
82
|
+
if (!isset($targets[$class])) {
|
|
83
|
+
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
$targets[$class][] = $stmt;
|
|
87
|
+
|
|
88
|
+
return $this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Adds an attribute group.
|
|
93
|
+
*
|
|
94
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
95
|
+
*
|
|
96
|
+
* @return $this The builder instance (for fluid interface)
|
|
97
|
+
*/
|
|
98
|
+
public function addAttribute($attribute) {
|
|
99
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
100
|
+
|
|
101
|
+
return $this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Returns the built class node.
|
|
106
|
+
*
|
|
107
|
+
* @return Stmt\Enum_ The built enum node
|
|
108
|
+
*/
|
|
109
|
+
public function getNode() : PhpParser\Node {
|
|
110
|
+
return new Stmt\Enum_($this->name, [
|
|
111
|
+
'scalarType' => $this->scalarType,
|
|
112
|
+
'implements' => $this->implements,
|
|
113
|
+
'stmts' => array_merge($this->uses, $this->enumCases, $this->constants, $this->methods),
|
|
114
|
+
'attrGroups' => $this->attributeGroups,
|
|
115
|
+
], $this->attributes);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser\BuilderHelpers;
|
|
6
|
+
use PhpParser\Node;
|
|
7
|
+
|
|
8
|
+
abstract class FunctionLike extends Declaration
|
|
9
|
+
{
|
|
10
|
+
protected $returnByRef = false;
|
|
11
|
+
protected $params = [];
|
|
12
|
+
|
|
13
|
+
/** @var string|Node\Name|Node\NullableType|null */
|
|
14
|
+
protected $returnType = null;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Make the function return by reference.
|
|
18
|
+
*
|
|
19
|
+
* @return $this The builder instance (for fluid interface)
|
|
20
|
+
*/
|
|
21
|
+
public function makeReturnByRef() {
|
|
22
|
+
$this->returnByRef = true;
|
|
23
|
+
|
|
24
|
+
return $this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Adds a parameter.
|
|
29
|
+
*
|
|
30
|
+
* @param Node\Param|Param $param The parameter to add
|
|
31
|
+
*
|
|
32
|
+
* @return $this The builder instance (for fluid interface)
|
|
33
|
+
*/
|
|
34
|
+
public function addParam($param) {
|
|
35
|
+
$param = BuilderHelpers::normalizeNode($param);
|
|
36
|
+
|
|
37
|
+
if (!$param instanceof Node\Param) {
|
|
38
|
+
throw new \LogicException(sprintf('Expected parameter node, got "%s"', $param->getType()));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
$this->params[] = $param;
|
|
42
|
+
|
|
43
|
+
return $this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Adds multiple parameters.
|
|
48
|
+
*
|
|
49
|
+
* @param array $params The parameters to add
|
|
50
|
+
*
|
|
51
|
+
* @return $this The builder instance (for fluid interface)
|
|
52
|
+
*/
|
|
53
|
+
public function addParams(array $params) {
|
|
54
|
+
foreach ($params as $param) {
|
|
55
|
+
$this->addParam($param);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return $this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sets the return type for PHP 7.
|
|
63
|
+
*
|
|
64
|
+
* @param string|Node\Name|Node\Identifier|Node\ComplexType $type
|
|
65
|
+
*
|
|
66
|
+
* @return $this The builder instance (for fluid interface)
|
|
67
|
+
*/
|
|
68
|
+
public function setReturnType($type) {
|
|
69
|
+
$this->returnType = BuilderHelpers::normalizeType($type);
|
|
70
|
+
|
|
71
|
+
return $this;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
use PhpParser\Node\Stmt;
|
|
9
|
+
|
|
10
|
+
class Function_ extends FunctionLike
|
|
11
|
+
{
|
|
12
|
+
protected $name;
|
|
13
|
+
protected $stmts = [];
|
|
14
|
+
|
|
15
|
+
/** @var Node\AttributeGroup[] */
|
|
16
|
+
protected $attributeGroups = [];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a function builder.
|
|
20
|
+
*
|
|
21
|
+
* @param string $name Name of the function
|
|
22
|
+
*/
|
|
23
|
+
public function __construct(string $name) {
|
|
24
|
+
$this->name = $name;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Adds a statement.
|
|
29
|
+
*
|
|
30
|
+
* @param Node|PhpParser\Builder $stmt The statement to add
|
|
31
|
+
*
|
|
32
|
+
* @return $this The builder instance (for fluid interface)
|
|
33
|
+
*/
|
|
34
|
+
public function addStmt($stmt) {
|
|
35
|
+
$this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
|
|
36
|
+
|
|
37
|
+
return $this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Adds an attribute group.
|
|
42
|
+
*
|
|
43
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
44
|
+
*
|
|
45
|
+
* @return $this The builder instance (for fluid interface)
|
|
46
|
+
*/
|
|
47
|
+
public function addAttribute($attribute) {
|
|
48
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
49
|
+
|
|
50
|
+
return $this;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns the built function node.
|
|
55
|
+
*
|
|
56
|
+
* @return Stmt\Function_ The built function node
|
|
57
|
+
*/
|
|
58
|
+
public function getNode() : Node {
|
|
59
|
+
return new Stmt\Function_($this->name, [
|
|
60
|
+
'byRef' => $this->returnByRef,
|
|
61
|
+
'params' => $this->params,
|
|
62
|
+
'returnType' => $this->returnType,
|
|
63
|
+
'stmts' => $this->stmts,
|
|
64
|
+
'attrGroups' => $this->attributeGroups,
|
|
65
|
+
], $this->attributes);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
use PhpParser\Node\Name;
|
|
9
|
+
use PhpParser\Node\Stmt;
|
|
10
|
+
|
|
11
|
+
class Interface_ extends Declaration
|
|
12
|
+
{
|
|
13
|
+
protected $name;
|
|
14
|
+
protected $extends = [];
|
|
15
|
+
protected $constants = [];
|
|
16
|
+
protected $methods = [];
|
|
17
|
+
|
|
18
|
+
/** @var Node\AttributeGroup[] */
|
|
19
|
+
protected $attributeGroups = [];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates an interface builder.
|
|
23
|
+
*
|
|
24
|
+
* @param string $name Name of the interface
|
|
25
|
+
*/
|
|
26
|
+
public function __construct(string $name) {
|
|
27
|
+
$this->name = $name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Extends one or more interfaces.
|
|
32
|
+
*
|
|
33
|
+
* @param Name|string ...$interfaces Names of interfaces to extend
|
|
34
|
+
*
|
|
35
|
+
* @return $this The builder instance (for fluid interface)
|
|
36
|
+
*/
|
|
37
|
+
public function extend(...$interfaces) {
|
|
38
|
+
foreach ($interfaces as $interface) {
|
|
39
|
+
$this->extends[] = BuilderHelpers::normalizeName($interface);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return $this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Adds a statement.
|
|
47
|
+
*
|
|
48
|
+
* @param Stmt|PhpParser\Builder $stmt The statement to add
|
|
49
|
+
*
|
|
50
|
+
* @return $this The builder instance (for fluid interface)
|
|
51
|
+
*/
|
|
52
|
+
public function addStmt($stmt) {
|
|
53
|
+
$stmt = BuilderHelpers::normalizeNode($stmt);
|
|
54
|
+
|
|
55
|
+
if ($stmt instanceof Stmt\ClassConst) {
|
|
56
|
+
$this->constants[] = $stmt;
|
|
57
|
+
} elseif ($stmt instanceof Stmt\ClassMethod) {
|
|
58
|
+
// we erase all statements in the body of an interface method
|
|
59
|
+
$stmt->stmts = null;
|
|
60
|
+
$this->methods[] = $stmt;
|
|
61
|
+
} else {
|
|
62
|
+
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return $this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Adds an attribute group.
|
|
70
|
+
*
|
|
71
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
72
|
+
*
|
|
73
|
+
* @return $this The builder instance (for fluid interface)
|
|
74
|
+
*/
|
|
75
|
+
public function addAttribute($attribute) {
|
|
76
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
77
|
+
|
|
78
|
+
return $this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns the built interface node.
|
|
83
|
+
*
|
|
84
|
+
* @return Stmt\Interface_ The built interface node
|
|
85
|
+
*/
|
|
86
|
+
public function getNode() : PhpParser\Node {
|
|
87
|
+
return new Stmt\Interface_($this->name, [
|
|
88
|
+
'extends' => $this->extends,
|
|
89
|
+
'stmts' => array_merge($this->constants, $this->methods),
|
|
90
|
+
'attrGroups' => $this->attributeGroups,
|
|
91
|
+
], $this->attributes);
|
|
92
|
+
}
|
|
93
|
+
}
|