- Add referencedClasses array to store fully resolved class names
- Implement recordReferencedClass method to track class references
- Enhance function call parsing with static function resolution
- Add native function lookup and return type detection
- Insert type conversion for runtime call results
- Resolve extension dependencies based on internal functions and classes
- Append extension requirements to generated module header
- Update tests to validate extension dependency detection
- Add test case for runtime builtin int property assignment
- Modify polymorphic class dispatch to restore string representation
- Removed strtotime from the list of functions that use direct PHPX wrappers
- Updated test case to verify only supported datetime calls use direct wrappers
- Modified strtotime test to include absolute, relative, epoch 0 and invalid dates
- Added timezone setting and additional test cases for relative date handling
- Updated expected test output to reflect new strtotime behavior
- Adjusted assertions to check for correct persistent function calls
- Added test for toStdList and toStdDict methods validating PHP array conversion with type preservation
- Included tests for late static calls from instance methods retaining receiver on inherited and overridden methods
- Added tests verifying late static calls distinguish parent and child private methods in instance context
- Covered various scenarios including scalar conversions, object arrays, and error handling cases
- Verified proper behavior with numeric keys, class inheritance, and dynamic method calls
- Tested type validation for list and dictionary conversions with multiple data types
- Create test for nested unset behavior with numeric string keys in empty array
- Verify proper removal of numeric string keys when using unset operation
- Confirm expected array structure after unset operations
- Document issue #114 related to numeric string key handling
- Fixed __FUNCTION__ to use short name instead of full namespaced name in method context
- Added conditional logic to prepend namespace only when not in method definition
- Added test case to verify proper behavior of __FUNCTION__ and __METHOD__ constants
- Ensured magic constants return correct values based on their usage context
- Updated parser logic to distinguish between function and method definitions properly
- Implemented parseNestedArrayUnset method to handle chained array dimension unsets
- Added logic to process nested ArrayDimFetch expressions in unset statements
- Created proper dimension parsing and code generation for nested array operations
- Maintained PHP evaluation order for key materialization in nested unsets
- Added comprehensive test coverage for nested unset chain behavior
- Extended compiler tests to verify correct handling of complex unset scenarios
- Support single array parameter initialization for std::array, std::vector, std::map,
std::orderedMap, std::list, and std::dict
- Implement type inference from array initializer expressions with exact type matching
- Add rectangular shape validation for std::array initializers
- Generate appropriate C++ code for value initializers using lambda expressions
- Update documentation to reflect new value initializer capabilities
- Add comprehensive tests for valid and invalid initializer scenarios
- Defer StdFunc/StdArgInfo implementation as documented in design records
- Add acceptsCallable property to ArgInfo entity to track callable type acceptance
- Implement logic to detect when function parameters accept callable types
- Add normalization of bare function callable arguments to string representation
- Create helper methods to check if types contain callable declarations
- Add resolution logic for bare identifier function names in callable context
- Update native class support to set acceptsCallable flag based on type checking
- Modify preprocessor to populate acceptsCallable field during argument parsing
- Remove deprecated typeDeclContainsCallable method and consolidate logic
- Add comprehensive test coverage for bare
- Introduce StdVector, StdMap, and StdOrderedMap parameter attributes
- Add explicit std-container contract to ArgInfo entity
- Implement parameter validation and type checking logic
- Add error handling for invalid container parameter usage
- Support container parameter contracts in function signatures
- Generate automatic type conversion at function entry points
- Add compilation tests for std container parameter contracts
- Update documentation with container parameter rules and examples
- Implement compatibility checks between child and parent classes
- Add support for container parameters in trait methods and inheritance
- Add constant initialization code separation with before/after statement handling
- Implement constant finalization logic to prevent metadata replacement during re-parsing
- Create scoped initialization blocks using do-while constructs for temporary variables
- Add codegenFinalized flag to track constant processing state
- Introduce new test case for global nested array constants initialization
- Add incremental declaration test for constant initializer preservation
- Move constant value parsing to dedicated finalizeGlobalConstantValue method
- Update translator to handle scoped constant initialization code generation
- Fixed private method accessibility check to properly return empty string
when method is private and inaccessible
- Updated property signature resolution to preserve method metadata for
nullable object properties
- Modified final class check to require non-nullability for typed property
receiver optimization
- Added test case for nullable typed property preserving by-reference
arguments when non-null
- Added test case for typed property following runtime protected override
or __call target
* fix(compiler): preserve runtime class dispatch and introspection for polymorphic objects
When an object variable has an upper-bound declared type (e.g. assigned from
a function or method return), SSA marks it as a stable object. However,
stableObjects does not guarantee the concrete runtime class: the instance
may be a subclass at runtime, or null if nullable.
1. FuncCallOptimizer::genGetClassOptimized checked isStableObject($obj->name)
and folded get_class($obj) to the declared type literal string. For
$a = getAnimal() returning a Dog, get_class($a) was incorrectly folded
to "Animal" at compile time.
2. MethodCallTrait::parseStaticCall checked isStableObject($class) and
jumped to _do_call with the declared base class. For $a::who(), this
statically invoked Base::who() instead of dispatching to Dog::who() on
the runtime object.
Require proven exact object instances (exactObjects, populated from direct
new ConcreteClass() definitions) before folding get_class() or devirtualizing
static calls on object variables. Non-exact variables fall back to runtime
class resolution (php::fn::get_class() and php::callStaticMethod()),
matching PHP semantics.
Add unit test coverage verifying exact objects continue to fold/devirtualize
while polymorphic variables retain dynamic runtime dispatch.
* fix(compiler): preserve lexical scope in dynamic static calls and runtime type checks for get_class
- Use php::callScoped with getCallableScopeExpr() for dynamic static calls inside class methods to preserve caller visibility on protected methods
- Fall back to runtime php::call for get_class on non-exact values so nullable objects throw TypeError instead of dereferencing null
- Add behavioral PHPT tests for protected polymorphic static calls and nullable get_class
- Update unit tests for scoped dispatch and runtime introspection
* test(compiler): remove stray top-level main call from PHPT tests
In TypePHP AOT compilation, function main(): void serves as the binary
entrypoint. Top-level function calls outside a function are rejected by
the preprocessor as stray code.
* fix(compiler): resolve function imports before dispatch and policy checks
* test: close PHP section in function import PHPT
* fix(compiler): resolve first-class function aliases
* fix(compiler): preserve called class in direct method calls
* fix(compiler): resolve called-class function targets
* fix(compiler): retain optimized namespace builtins
- Add materializeTrailingDefaults parameter to CallArgumentGenerator for default argument handling
- Implement native object stack slot allocation and promotion analysis
- Add nativeStackPromotions context tracking for non-escaping object allocations
- Generate NativeStackSlot declarations in compiler base code generation
- Update native method call generation to use direct member access patterns
- Add comprehensive native object member name validation and conflict detection
- Implement native destructor state management and finalization chains
- Add test cases for native class member name conflicts and stack promotion scenarios
- Replace nativeDeref calls with nativeRequireObject for improved object access safety
- Add native source project compilation workflow with project.xml configuration
- Implement closure reference capture analysis and type degradation for native objects
- Add WASI and nano mode function support checks with comprehensive API exclusions
- Introduce Composer native package discovery and validation system
- Add build scripts for WASI nano program compilation with browser module support
- Implement closure generator enhancements for reference capture handling
- Add CLI usage tests and compiler base API validations
- Integrate php-nano runtime dependencies and native package management
- Add type degradation analysis for closure use variables in generators and functions
- Renamed std::ordered_map to std::orderedMap following camelCase naming convention
- Added new std::object() function to restore concrete object type information
- Updated all test files to use the new orderedMap naming
- Modified parser to recognize orderedmap in assign operations
- Updated documentation to reflect the new naming and function
- Added polyfill implementation for std::object()
- Updated README and changelog with
* fix(compiler): support first-class callable of internal functions
PHP 8.1 `foo(...)` builds a Closure from a single VariadicPlaceholder
argument instead of calling foo. Two paths mishandled it:
- checkInternalFunctionArgCount() counted the placeholder as a real
argument, so first-class callables of internal functions requiring 2+
parameters (e.g. `posix_kill(...)`) failed with a bogus "expects at
least N arguments, 1 given".
- The math-function return-type optimization read `$expr->args[0]->value`
on callables such as `round(...)`, crashing on the undefined
VariadicPlaceholder::$value property.
Guard both with isFirstClassCallable() so the expression falls through to
Closure (Type::OBJECT) resolution.
* fix(compiler): infer builtin callables before return optimizations
---------
Co-authored-by: Tinywan <tinywan@gmail.com>
- Removed redundant zval macro handling for property access
- Replaced Z_LVAL_P and Z_DVAL_P calls with direct attribute accessors
- Updated property getter logic to use attrInt and attrFloat methods
- Modified tests to match new property access pattern
- Added comprehensive test case for inherited property reference handling
- Allow int, float, bool, string, and array Native Class properties to be passed
directly to matching reference parameters on statically resolved calls
- Generate call-scoped C++ T& bindings for typed reference parameters instead
of creating Zend references
- Maintain compile-time rooting of Native receiver objects during typed calls
- Add new parseNativeTypedPropertyReferenceArg method to handle typed property
reference arguments
- Update documentation to reflect new typed reference capabilities for fixed
Native properties
- Create new test case covering typed property reference functionality
- Modify changelog to document the
- Implement Android platform class with API level detection and compiler configuration
- Add Android-specific library linking with proper archive grouping and system libraries
- Integrate Android target detection and SDK directory resolution in build configuration
- Add Android-specific compile flags including static libstdc++ and security hardening
- Include Android platform support in translator and compiler base classes
- Add PHPX_ANDROID=1 define flag for Android builds
- Support
- Updated std::any to accept zero or one arguments instead of requiring exactly one
- When no argument is provided, std::any now returns null by default
- Modified parser logic to handle omitted parameter case in FunctionCallTrait
- Updated documentation in both English and Chinese to reflect optional parameter syntax
- Added test case demonstrating std::any() call without parameters returning null
- Changed error message to indicate zero or one argument requirement instead of exactly one
- Replace any() with std::any() in test files and compiler logic
- Replace refval() with std::ref() for reference wrapping operations
- Replace expected() with std::expected() for branch prediction hints
- Replace unexpected() with std::unexpected() for branch prediction hints
- Remove deprecated objval() function and use toObject() keyword method
- Update parser to recognize std:: class expressions with case insensitivity
- Add comprehensive changelog documenting breaking API changes
- Update documentation to reflect new std:: namespace conventions
- Add tests for case-insensitive std class and method names
- Verify global function names remain available for user-defined functions
- Replace ArgList with VarList for fixed argument arrays to avoid dynamic Args allocation
- Add call argument limit assertion to prevent unbounded call generation
- Implement direct static method calls using callStaticMethod when possible
- Add alternating dynamic static call benchmarks for class and method variations
- Update documentation on request-local call slot destruction requirements
- Fix dynamic static call target evaluation order to precede argument evaluation
- Add tests for call argument limits and dynamic class evaluation ordering
- Add function call cache infrastructure with typephp_call_cached wrapper
- Implement method call caching using typephp_call_method_cached for named methods
- Add scoped method call caching via typephp_call_method_scoped_cached for dynamic scopes
- Create late-static-bound class entry tracking with getCalledCeExpr and getCalledClassExpr
- Implement lazy static property slot resolution with typephp_get_static_property_cached
- Add benchmark cases for dynamic static method calls and scoped method invocations
- Update call cache test expectations to reflect new cached call implementations
- Integrate call caching into function and method call compilation paths
- Add nullsafe method call caching support in nullsafe access trait
- Implement static property slot registration and resolution mechanisms
- Update native property handling to use cached static property access
- Add comprehensive test coverage for various dynamic call scenarios
- Implement exact-class fast path for zero-argument late-static calls with fallback mechanism
- Add static property fetch resolution using typephp_get_static_property symbol
- Enhance isset operations on static array properties with direct typephp_array_isset calls
- Update class reference detection to return Type::STR for class constant fetch expressions
- Add benchmark suite for static cache performance measurement including late static dispatch
- Modify compiler symbols to use typephp variants for called class and static property access
- Create comprehensive tests for static array single offset presence and late static call exact guards
- Update unit tests to reflect new symbol names and variable
- Add forceArrayArgs parameter to CallArgumentGenerator methods to properly handle
named arguments with setValue method instead of set
- Implement direct foreach array target optimization to improve iteration
performance by allowing direct assignment to variant variables
- Add comprehensive tests for dynamic call cache argument preservation
including small, large, named, unpacked, reference, and exception arguments
- Add tests for dynamic property access with string, referenced-string, and
converted names
- Add tests for foreach direct array targets preserving keys, values, references
- Update CI workflows to checkout PHPX from third_party directory instead of vendor
- Add smoke test for full static builds to verify module globals setup
- Enhance benchmark suite with additional dynamic call cases for different
argument counts (zero, two, four args) to separate cache lookup from argument
materialization costs
- Add case filtering option to property