@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\Stmt;
|
|
9
|
+
|
|
10
|
+
class Method extends FunctionLike
|
|
11
|
+
{
|
|
12
|
+
protected $name;
|
|
13
|
+
protected $flags = 0;
|
|
14
|
+
|
|
15
|
+
/** @var array|null */
|
|
16
|
+
protected $stmts = [];
|
|
17
|
+
|
|
18
|
+
/** @var Node\AttributeGroup[] */
|
|
19
|
+
protected $attributeGroups = [];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a method builder.
|
|
23
|
+
*
|
|
24
|
+
* @param string $name Name of the method
|
|
25
|
+
*/
|
|
26
|
+
public function __construct(string $name) {
|
|
27
|
+
$this->name = $name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Makes the method public.
|
|
32
|
+
*
|
|
33
|
+
* @return $this The builder instance (for fluid interface)
|
|
34
|
+
*/
|
|
35
|
+
public function makePublic() {
|
|
36
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC);
|
|
37
|
+
|
|
38
|
+
return $this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Makes the method protected.
|
|
43
|
+
*
|
|
44
|
+
* @return $this The builder instance (for fluid interface)
|
|
45
|
+
*/
|
|
46
|
+
public function makeProtected() {
|
|
47
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED);
|
|
48
|
+
|
|
49
|
+
return $this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Makes the method private.
|
|
54
|
+
*
|
|
55
|
+
* @return $this The builder instance (for fluid interface)
|
|
56
|
+
*/
|
|
57
|
+
public function makePrivate() {
|
|
58
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE);
|
|
59
|
+
|
|
60
|
+
return $this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Makes the method static.
|
|
65
|
+
*
|
|
66
|
+
* @return $this The builder instance (for fluid interface)
|
|
67
|
+
*/
|
|
68
|
+
public function makeStatic() {
|
|
69
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC);
|
|
70
|
+
|
|
71
|
+
return $this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Makes the method abstract.
|
|
76
|
+
*
|
|
77
|
+
* @return $this The builder instance (for fluid interface)
|
|
78
|
+
*/
|
|
79
|
+
public function makeAbstract() {
|
|
80
|
+
if (!empty($this->stmts)) {
|
|
81
|
+
throw new \LogicException('Cannot make method with statements abstract');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT);
|
|
85
|
+
$this->stmts = null; // abstract methods don't have statements
|
|
86
|
+
|
|
87
|
+
return $this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Makes the method final.
|
|
92
|
+
*
|
|
93
|
+
* @return $this The builder instance (for fluid interface)
|
|
94
|
+
*/
|
|
95
|
+
public function makeFinal() {
|
|
96
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL);
|
|
97
|
+
|
|
98
|
+
return $this;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Adds a statement.
|
|
103
|
+
*
|
|
104
|
+
* @param Node|PhpParser\Builder $stmt The statement to add
|
|
105
|
+
*
|
|
106
|
+
* @return $this The builder instance (for fluid interface)
|
|
107
|
+
*/
|
|
108
|
+
public function addStmt($stmt) {
|
|
109
|
+
if (null === $this->stmts) {
|
|
110
|
+
throw new \LogicException('Cannot add statements to an abstract method');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
$this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
|
|
114
|
+
|
|
115
|
+
return $this;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Adds an attribute group.
|
|
120
|
+
*
|
|
121
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
122
|
+
*
|
|
123
|
+
* @return $this The builder instance (for fluid interface)
|
|
124
|
+
*/
|
|
125
|
+
public function addAttribute($attribute) {
|
|
126
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
127
|
+
|
|
128
|
+
return $this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Returns the built method node.
|
|
133
|
+
*
|
|
134
|
+
* @return Stmt\ClassMethod The built method node
|
|
135
|
+
*/
|
|
136
|
+
public function getNode() : Node {
|
|
137
|
+
return new Stmt\ClassMethod($this->name, [
|
|
138
|
+
'flags' => $this->flags,
|
|
139
|
+
'byRef' => $this->returnByRef,
|
|
140
|
+
'params' => $this->params,
|
|
141
|
+
'returnType' => $this->returnType,
|
|
142
|
+
'stmts' => $this->stmts,
|
|
143
|
+
'attrGroups' => $this->attributeGroups,
|
|
144
|
+
], $this->attributes);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 Namespace_ extends Declaration
|
|
11
|
+
{
|
|
12
|
+
private $name;
|
|
13
|
+
private $stmts = [];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates a namespace builder.
|
|
17
|
+
*
|
|
18
|
+
* @param Node\Name|string|null $name Name of the namespace
|
|
19
|
+
*/
|
|
20
|
+
public function __construct($name) {
|
|
21
|
+
$this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Adds a statement.
|
|
26
|
+
*
|
|
27
|
+
* @param Node|PhpParser\Builder $stmt The statement to add
|
|
28
|
+
*
|
|
29
|
+
* @return $this The builder instance (for fluid interface)
|
|
30
|
+
*/
|
|
31
|
+
public function addStmt($stmt) {
|
|
32
|
+
$this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
|
|
33
|
+
|
|
34
|
+
return $this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns the built node.
|
|
39
|
+
*
|
|
40
|
+
* @return Stmt\Namespace_ The built node
|
|
41
|
+
*/
|
|
42
|
+
public function getNode() : Node {
|
|
43
|
+
return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
|
|
9
|
+
class Param implements PhpParser\Builder
|
|
10
|
+
{
|
|
11
|
+
protected $name;
|
|
12
|
+
|
|
13
|
+
protected $default = null;
|
|
14
|
+
|
|
15
|
+
/** @var Node\Identifier|Node\Name|Node\NullableType|null */
|
|
16
|
+
protected $type = null;
|
|
17
|
+
|
|
18
|
+
protected $byRef = false;
|
|
19
|
+
|
|
20
|
+
protected $variadic = false;
|
|
21
|
+
|
|
22
|
+
protected $flags = 0;
|
|
23
|
+
|
|
24
|
+
/** @var Node\AttributeGroup[] */
|
|
25
|
+
protected $attributeGroups = [];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a parameter builder.
|
|
29
|
+
*
|
|
30
|
+
* @param string $name Name of the parameter
|
|
31
|
+
*/
|
|
32
|
+
public function __construct(string $name) {
|
|
33
|
+
$this->name = $name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Sets default value for the parameter.
|
|
38
|
+
*
|
|
39
|
+
* @param mixed $value Default value to use
|
|
40
|
+
*
|
|
41
|
+
* @return $this The builder instance (for fluid interface)
|
|
42
|
+
*/
|
|
43
|
+
public function setDefault($value) {
|
|
44
|
+
$this->default = BuilderHelpers::normalizeValue($value);
|
|
45
|
+
|
|
46
|
+
return $this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets type for the parameter.
|
|
51
|
+
*
|
|
52
|
+
* @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type
|
|
53
|
+
*
|
|
54
|
+
* @return $this The builder instance (for fluid interface)
|
|
55
|
+
*/
|
|
56
|
+
public function setType($type) {
|
|
57
|
+
$this->type = BuilderHelpers::normalizeType($type);
|
|
58
|
+
if ($this->type == 'void') {
|
|
59
|
+
throw new \LogicException('Parameter type cannot be void');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return $this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Sets type for the parameter.
|
|
67
|
+
*
|
|
68
|
+
* @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type
|
|
69
|
+
*
|
|
70
|
+
* @return $this The builder instance (for fluid interface)
|
|
71
|
+
*
|
|
72
|
+
* @deprecated Use setType() instead
|
|
73
|
+
*/
|
|
74
|
+
public function setTypeHint($type) {
|
|
75
|
+
return $this->setType($type);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Make the parameter accept the value by reference.
|
|
80
|
+
*
|
|
81
|
+
* @return $this The builder instance (for fluid interface)
|
|
82
|
+
*/
|
|
83
|
+
public function makeByRef() {
|
|
84
|
+
$this->byRef = true;
|
|
85
|
+
|
|
86
|
+
return $this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Make the parameter variadic
|
|
91
|
+
*
|
|
92
|
+
* @return $this The builder instance (for fluid interface)
|
|
93
|
+
*/
|
|
94
|
+
public function makeVariadic() {
|
|
95
|
+
$this->variadic = true;
|
|
96
|
+
|
|
97
|
+
return $this;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Makes the (promoted) parameter public.
|
|
102
|
+
*
|
|
103
|
+
* @return $this The builder instance (for fluid interface)
|
|
104
|
+
*/
|
|
105
|
+
public function makePublic() {
|
|
106
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_PUBLIC);
|
|
107
|
+
|
|
108
|
+
return $this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Makes the (promoted) parameter protected.
|
|
113
|
+
*
|
|
114
|
+
* @return $this The builder instance (for fluid interface)
|
|
115
|
+
*/
|
|
116
|
+
public function makeProtected() {
|
|
117
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_PROTECTED);
|
|
118
|
+
|
|
119
|
+
return $this;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Makes the (promoted) parameter private.
|
|
124
|
+
*
|
|
125
|
+
* @return $this The builder instance (for fluid interface)
|
|
126
|
+
*/
|
|
127
|
+
public function makePrivate() {
|
|
128
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_PRIVATE);
|
|
129
|
+
|
|
130
|
+
return $this;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Makes the (promoted) parameter readonly.
|
|
135
|
+
*
|
|
136
|
+
* @return $this The builder instance (for fluid interface)
|
|
137
|
+
*/
|
|
138
|
+
public function makeReadonly() {
|
|
139
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_READONLY);
|
|
140
|
+
|
|
141
|
+
return $this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Adds an attribute group.
|
|
146
|
+
*
|
|
147
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
148
|
+
*
|
|
149
|
+
* @return $this The builder instance (for fluid interface)
|
|
150
|
+
*/
|
|
151
|
+
public function addAttribute($attribute) {
|
|
152
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
153
|
+
|
|
154
|
+
return $this;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Returns the built parameter node.
|
|
159
|
+
*
|
|
160
|
+
* @return Node\Param The built parameter node
|
|
161
|
+
*/
|
|
162
|
+
public function getNode() : Node {
|
|
163
|
+
return new Node\Param(
|
|
164
|
+
new Node\Expr\Variable($this->name),
|
|
165
|
+
$this->default, $this->type, $this->byRef, $this->variadic, [], $this->flags, $this->attributeGroups
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
use PhpParser\Node\ComplexType;
|
|
12
|
+
|
|
13
|
+
class Property implements PhpParser\Builder
|
|
14
|
+
{
|
|
15
|
+
protected $name;
|
|
16
|
+
|
|
17
|
+
protected $flags = 0;
|
|
18
|
+
protected $default = null;
|
|
19
|
+
protected $attributes = [];
|
|
20
|
+
|
|
21
|
+
/** @var null|Identifier|Name|NullableType */
|
|
22
|
+
protected $type;
|
|
23
|
+
|
|
24
|
+
/** @var Node\AttributeGroup[] */
|
|
25
|
+
protected $attributeGroups = [];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a property builder.
|
|
29
|
+
*
|
|
30
|
+
* @param string $name Name of the property
|
|
31
|
+
*/
|
|
32
|
+
public function __construct(string $name) {
|
|
33
|
+
$this->name = $name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Makes the property public.
|
|
38
|
+
*
|
|
39
|
+
* @return $this The builder instance (for fluid interface)
|
|
40
|
+
*/
|
|
41
|
+
public function makePublic() {
|
|
42
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC);
|
|
43
|
+
|
|
44
|
+
return $this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Makes the property protected.
|
|
49
|
+
*
|
|
50
|
+
* @return $this The builder instance (for fluid interface)
|
|
51
|
+
*/
|
|
52
|
+
public function makeProtected() {
|
|
53
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED);
|
|
54
|
+
|
|
55
|
+
return $this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Makes the property private.
|
|
60
|
+
*
|
|
61
|
+
* @return $this The builder instance (for fluid interface)
|
|
62
|
+
*/
|
|
63
|
+
public function makePrivate() {
|
|
64
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE);
|
|
65
|
+
|
|
66
|
+
return $this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Makes the property static.
|
|
71
|
+
*
|
|
72
|
+
* @return $this The builder instance (for fluid interface)
|
|
73
|
+
*/
|
|
74
|
+
public function makeStatic() {
|
|
75
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC);
|
|
76
|
+
|
|
77
|
+
return $this;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Makes the property readonly.
|
|
82
|
+
*
|
|
83
|
+
* @return $this The builder instance (for fluid interface)
|
|
84
|
+
*/
|
|
85
|
+
public function makeReadonly() {
|
|
86
|
+
$this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_READONLY);
|
|
87
|
+
|
|
88
|
+
return $this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Sets default value for the property.
|
|
93
|
+
*
|
|
94
|
+
* @param mixed $value Default value to use
|
|
95
|
+
*
|
|
96
|
+
* @return $this The builder instance (for fluid interface)
|
|
97
|
+
*/
|
|
98
|
+
public function setDefault($value) {
|
|
99
|
+
$this->default = BuilderHelpers::normalizeValue($value);
|
|
100
|
+
|
|
101
|
+
return $this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Sets doc comment for the property.
|
|
106
|
+
*
|
|
107
|
+
* @param PhpParser\Comment\Doc|string $docComment Doc comment to set
|
|
108
|
+
*
|
|
109
|
+
* @return $this The builder instance (for fluid interface)
|
|
110
|
+
*/
|
|
111
|
+
public function setDocComment($docComment) {
|
|
112
|
+
$this->attributes = [
|
|
113
|
+
'comments' => [BuilderHelpers::normalizeDocComment($docComment)]
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
return $this;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Sets the property type for PHP 7.4+.
|
|
121
|
+
*
|
|
122
|
+
* @param string|Name|Identifier|ComplexType $type
|
|
123
|
+
*
|
|
124
|
+
* @return $this
|
|
125
|
+
*/
|
|
126
|
+
public function setType($type) {
|
|
127
|
+
$this->type = BuilderHelpers::normalizeType($type);
|
|
128
|
+
|
|
129
|
+
return $this;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Adds an attribute group.
|
|
134
|
+
*
|
|
135
|
+
* @param Node\Attribute|Node\AttributeGroup $attribute
|
|
136
|
+
*
|
|
137
|
+
* @return $this The builder instance (for fluid interface)
|
|
138
|
+
*/
|
|
139
|
+
public function addAttribute($attribute) {
|
|
140
|
+
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
|
|
141
|
+
|
|
142
|
+
return $this;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Returns the built class node.
|
|
147
|
+
*
|
|
148
|
+
* @return Stmt\Property The built property node
|
|
149
|
+
*/
|
|
150
|
+
public function getNode() : PhpParser\Node {
|
|
151
|
+
return new Stmt\Property(
|
|
152
|
+
$this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC,
|
|
153
|
+
[
|
|
154
|
+
new Stmt\PropertyProperty($this->name, $this->default)
|
|
155
|
+
],
|
|
156
|
+
$this->attributes,
|
|
157
|
+
$this->type,
|
|
158
|
+
$this->attributeGroups
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Builder;
|
|
4
|
+
|
|
5
|
+
use PhpParser\Builder;
|
|
6
|
+
use PhpParser\BuilderHelpers;
|
|
7
|
+
use PhpParser\Node;
|
|
8
|
+
use PhpParser\Node\Stmt;
|
|
9
|
+
|
|
10
|
+
class TraitUse implements Builder
|
|
11
|
+
{
|
|
12
|
+
protected $traits = [];
|
|
13
|
+
protected $adaptations = [];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates a trait use builder.
|
|
17
|
+
*
|
|
18
|
+
* @param Node\Name|string ...$traits Names of used traits
|
|
19
|
+
*/
|
|
20
|
+
public function __construct(...$traits) {
|
|
21
|
+
foreach ($traits as $trait) {
|
|
22
|
+
$this->and($trait);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Adds used trait.
|
|
28
|
+
*
|
|
29
|
+
* @param Node\Name|string $trait Trait name
|
|
30
|
+
*
|
|
31
|
+
* @return $this The builder instance (for fluid interface)
|
|
32
|
+
*/
|
|
33
|
+
public function and($trait) {
|
|
34
|
+
$this->traits[] = BuilderHelpers::normalizeName($trait);
|
|
35
|
+
return $this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Adds trait adaptation.
|
|
40
|
+
*
|
|
41
|
+
* @param Stmt\TraitUseAdaptation|Builder\TraitUseAdaptation $adaptation Trait adaptation
|
|
42
|
+
*
|
|
43
|
+
* @return $this The builder instance (for fluid interface)
|
|
44
|
+
*/
|
|
45
|
+
public function with($adaptation) {
|
|
46
|
+
$adaptation = BuilderHelpers::normalizeNode($adaptation);
|
|
47
|
+
|
|
48
|
+
if (!$adaptation instanceof Stmt\TraitUseAdaptation) {
|
|
49
|
+
throw new \LogicException('Adaptation must have type TraitUseAdaptation');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
$this->adaptations[] = $adaptation;
|
|
53
|
+
return $this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns the built node.
|
|
58
|
+
*
|
|
59
|
+
* @return Node The built node
|
|
60
|
+
*/
|
|
61
|
+
public function getNode() : Node {
|
|
62
|
+
return new Stmt\TraitUse($this->traits, $this->adaptations);
|
|
63
|
+
}
|
|
64
|
+
}
|