Add `CallbackRule` rule
Open
Nobody has claimed this yet.
status:under discussion
- Dominant language
- PHP
- Stars
- 167
- Forks
- 47
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 3
Description
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));
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing Callback rule and its tests, then compare how the example's CallbackRule method should return a RuleInterface. Done means the new rule supports the shown attribute usage and applies the returned rule, with tests covering the example behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100