/var/www/html/back/app/Attributes/CustomAttribute.php
<?php

declare(strict_types=1);

namespace App\Attributes;

use Attribute;

// Атрибут, который получает имя функции через глобальную переменную
#[Attribute(Attribute::TARGET_METHOD)]
class CustomAttribute
{
    public function __construct()
    {
    }

    public function getFunctionName(): string
    {
        global $_current_function_name;

        return $_current_function_name;
    }
}