Skip to content

Improve validation context#427

Merged
vjik merged 9 commits into
masterfrom
improve-context
Dec 7, 2022
Merged

Improve validation context#427
vjik merged 9 commits into
masterfrom
improve-context

Conversation

@vjik

@vjik vjik commented Dec 6, 2022

Copy link
Copy Markdown
Member
Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️
Fixed issues -
  • Remove getParameters() method
  • Make setParameter() fluent
  • Move arguments from constructor to separate methods:
    • validator and raw data → setValidatorAndRawDataOnce()
    • data set → setDataSet()
  • Remove attribute from constructor

It's allow send to validator custom parameters via context:

$validator->validate(
    $data,
    $rules,
    new ValidationContext(['a' => 7, 'b' => 42])
)

@what-the-diff

what-the-diff Bot commented Dec 6, 2022

Copy link
Copy Markdown
  • Remove null coalescing operator from ValidationContext::getDataSet()
  • Add check for data set in validation context before using it
  • Check validator and raw data are not empty when calling validate or getRawData methods of the validation context

@vjik vjik requested a review from a team December 6, 2022 14:36
@vjik vjik added the status:code review The pull request needs review. label Dec 6, 2022

@xepozz xepozz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see any improvements here

@codecov

codecov Bot commented Dec 6, 2022

Copy link
Copy Markdown

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (3be908a) compared to base (3270502).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #427   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       646       651    +5     
===========================================
  Files             76        76           
  Lines           1542      1557   +15     
===========================================
+ Hits            1542      1557   +15     
Impacted Files Coverage Δ
src/Rule/CompareHandler.php 100.00% <100.00%> (ø)
src/ValidationContext.php 100.00% <100.00%> (ø)
src/Validator.php 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@vjik

vjik commented Dec 6, 2022

Copy link
Copy Markdown
Member Author

Don't see any improvements here

Look carefully 😀

@vjik vjik merged commit 09fed81 into master Dec 7, 2022
@vjik vjik deleted the improve-context branch December 7, 2022 06:40
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.

4 participants