Version 1.1.0 of Go! AOP Framework
This version contains several important fixes and improvements:
- Fixed cache files permission, now all cache files will be created with given cache mode, resolves #275
- Added context-sensitive matching that allows new checks #274 and resolves #272 by providing a new pointcut expression
!matchInherited()to exclude all inherited methods from matching - Fixed logic for complex pointcut expressions, combined with OR logic, resolves #217
- Fixed broken property interception generated source code for the constructor, resolves #271
- Property interceptor now use trait for common logic as well returns values by reference, see #54 and #232
Pay attention, that some internal parts are changed, so be careful, when updated. Also property interceptors logic is changed now and to modify values in advices, you should use returning by reference methods like following:
/**
* Advice that controls an access to the properties
*
* @param FieldAccess $fieldAccess Joinpoint
*
* @Around("access(public|protected Demo\Example\PropertyDemo->*)")
* @return mixed
*/
public function aroundFieldAccess(FieldAccess $fieldAccess)
{
$isRead = $fieldAccess->getAccessType() == FieldAccess::READ;
// proceed all internal advices
$fieldAccess->proceed();
if ($isRead) {
// if you want to change original property value, then return it by reference
$value = /* & */$fieldAccess->getValue();
} else {
// if you want to change value to set, then return it by reference
$value = /* & */$fieldAccess->getValueToSet();
}
echo $fieldAccess, ", value: ", json_encode($value), PHP_EOL;
}