Releases
1.0
PHP AST Code Generation Helper - Early Access v1.0
Compare
Sorry, something went wrong.
No results found
Method Summary for Release 1.0
ClassGenerationHelper
addClassProperty : Adds a property to a class with type, visibility, and default value.
setNamespace : Assigns a namespace to a class or interface and adds imports.
createClass : Creates a new class with the given name.
addClassMethod : Adds a method to a class with visibility, return type, parameters, and body.
extendClass : Sets a parent class for inheritance.
implementInterfaces : Adds one or more interfaces to a class.
addTraitsToClass : Adds traits to a class.
addConstructorToClass : Adds a constructor to a class with parameters.
createFullClass : Combines properties, methods, traits, and interfaces into a complete class.
BasicGenerationHelper
return : Creates a return statement using the given expression.
addVisibility : Sets the visibility of a method or property.
createDocComment : Generates PHPDoc comments for a method or property.
createArguments : Converts an array into AST-compatible arguments for method calls.
createArray : Converts a PHP array into an AST array node.
convertToAstNode : Converts a PHP value to an AST node (e.g., int, string, bool).
isValidDefault : Validates default values based on type.
generateFile : Generates a PHP file for a class, interface, or namespace.
MethodGenerationHelper
createMethod : Creates a method with the specified name, visibility, and return type.
TestGenerationHelper
createSetUpMethod : Generates a setUp method for initializing test dependencies.
createTestMethod : Creates a test method with a specific name and body.
createAssertion : Creates a PHPUnit assertion statement.
addTestImports : Adds PHPUnit and other imports to a test class.
createTestClass : Builds a complete test class with methods and optional setUp.
VariableGenerationHelper
assignThisVarToVar : Assigns a class property to a variable.
assignThisVarToThisVar : Assigns one class property to another.
new : Creates a new object instance.
assignVarToVar : Assigns one variable to another.
assign : Assigns one expression to another.
var : Creates a variable node.
thisVar : Fetches a property from the current instance.
You can’t perform that action at this time.