Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make concept of stateless validator #97

Merged
merged 18 commits into from Jan 24, 2021
Merged

Make concept of stateless validator #97

merged 18 commits into from Jan 24, 2021

Conversation

xepozz
Copy link
Contributor

@xepozz xepozz commented Jan 9, 2021

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️

I want to make Validator stateless.
It will avoid to create instance every time when we want to validate another dataset or rules.
Also it will be a little bit user-friendly when we want to get instance of Validator with usage DI:

public function action(ValidatorInterface $validator) 
{
    $result = $validator->validate($request, $rules);
}

vs

public function action(ValidatorFactoryInterface $validatorFactory) 
{
    $validator = $validatorFactory->create($rules);
    $result = $validator->validate($request);
}

@xepozz xepozz added the status:code review The pull request needs review. label Jan 9, 2021
@xepozz xepozz requested a review from a team January 9, 2021 12:13
# Conflicts:
#	src/ResultSet.php
src/ValidatorFactory.php Outdated Show resolved Hide resolved
tests/ValidatorTest.php Show resolved Hide resolved
@samdark
Copy link
Member

samdark commented Jan 23, 2021

Overall 👍

@samdark
Copy link
Member

samdark commented Jan 23, 2021

Needs to be adjsuted for #106

@samdark samdark merged commit c47e5f0 into master Jan 24, 2021
@samdark samdark deleted the stateless-validator branch January 24, 2021 14:53
@samdark
Copy link
Member

samdark commented Jan 24, 2021

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants