Skip to content

Add CallbackRule rule #781

@vjik

Description

@vjik

This is analogue of Callback but it returns a different rule that is already being applied.

Example of usage:

/**
 * @var array<int, string>
 */
private readonly array $categories;

#[CallbackRule(method: categoryIdRule)]
public int|null $categoryId = null;

private function categoryIdRule(): RuleInterface
{
    return new In(array_keys($this->categories));
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions