Previous Pointcut system wasn't type-safe, consisted of mix of different PointFilters and Poincuts, which resulted in extra code duplication, tricky checks and absence of strict typing of arguments.
For version 4 of framework, following major Pointcut interface will be used with it's main matches method:
/**
* Performs matching of point of code, returns true if point matches
*
* @param ReflectionClass<T>|ReflectionFileNamespace $context
* @param ReflectionMethod|ReflectionProperty|ReflectionFunction|null $reflector
* @param null|(string&class-string<T>)|(object&T) $instanceOrScope
* @param null|array<mixed> $arguments
*
* @template T of object
*/
public function matches(
ReflectionClass|ReflectionFileNamespace $context,
ReflectionMethod|ReflectionProperty|ReflectionFunction $reflector = null,
object|string $instanceOrScope = null,
array $arguments = null
): bool;
Pointcut matching is now always performed via single interface by checking first context, then context + reflector and finally, for dynamic pointcuts it checks context + reflector + instance + arguments of invocation.
Pay an attention, that in current version of framework, position of $context and $reflector has been switched to have more natural matching.
Previous Pointcut system wasn't type-safe, consisted of mix of different PointFilters and Poincuts, which resulted in extra code duplication, tricky checks and absence of strict typing of arguments.
For version 4 of framework, following major
Pointcut
interface will be used with it's mainmatches
method:Pointcut matching is now always performed via single interface by checking first context, then context + reflector and finally, for dynamic pointcuts it checks context + reflector + instance + arguments of invocation.
Pay an attention, that in current version of framework, position of
$context
and$reflector
has been switched to have more natural matching.