AspectContext
This commit is contained in:
parent
6050e3bb72
commit
d35c3df06d
8 changed files with 70 additions and 19 deletions
|
|
@ -3,13 +3,19 @@
|
|||
namespace Tests\Aspects;
|
||||
|
||||
use Attribute;
|
||||
use IceFox\Aspect\AspectContext;
|
||||
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class ModifyingAspect
|
||||
{
|
||||
public static mixed $modifier = null;
|
||||
|
||||
public function after(object|string $target, mixed $result): mixed
|
||||
public function __construct(
|
||||
private readonly AspectContext $context,
|
||||
) {
|
||||
}
|
||||
|
||||
public function after(mixed $result): mixed
|
||||
{
|
||||
if (self::$modifier !== null) {
|
||||
return (self::$modifier)($result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue