Releases: quintenmbusiness/PhpAstCodeGenerationHelper
Releases · quintenmbusiness/PhpAstCodeGenerationHelper
1.0.2
Full Changelog: 1.0.1...1.0.2
1.0.1
Coverage im proved
PHP AST Code Generation Helper - Early Access v1.0
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 areturnstatement 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 asetUpmethod 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 optionalsetUp.
VariableGenerationHelper
assignThisVarToVar: Assigns a class property to a variable.assignThisVarToThisVar: Assigns one class property to another.new: Creates anewobject 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.
PHP AST Code Generation Helper - Early Access v0.1.0
Early Access Release (v0.1.0)
This is the initial release of the PHP AST Code Generation Helper. It provides a utility library for generating PHP Abstract Syntax Tree (AST) nodes programmatically using nikic/php-parser.
🚀 Features
- Create methods with customizable visibility and return types.
- Generate properties with types and visibility modifiers.
- Simplified helpers for
$this->propertyand variable assignment.
🔧 Limitations
- Limited functionality: This release is a preview version aimed at early adopters. Only basic method and property generation are supported.
- Future releases will include:
- Full class generation.
- Additional AST helpers.
- Enhanced support for complex types.