An open API service indexing awesome lists of open source software.

https://github.com/lstrojny/class-resolver

Intercepts PHPs "new" operator to execute a callback for name resolval
https://github.com/lstrojny/class-resolver

Last synced: 3 months ago
JSON representation

Intercepts PHPs "new" operator to execute a callback for name resolval

Awesome Lists containing this project

README

        

# Design

## Implementation overview
- Find all class declarations from `CG(class_table)`
- Override `ce->create_object` with `php_classresolver_create_object()`
- If custom `create_object`-function exists: store old `ce->object_new` in `CLASSRESOLVER_G(object_new)`
- Custom `create_object` handler:
- If class resolver is registered, resolve class name with `Class\Resolver::resolve()`
- Retrieve related class entry
- Return `zend_object_value` with new class entry
- If configurator is registered, pass original constructor parameters and classname to `Class\Configurator::preConstruct()`

## Userland API
```php