Skip to content

Rename SkipOn* classes#391

Merged
arogachev merged 4 commits into
masterfrom
refactor
Nov 27, 2022
Merged

Rename SkipOn* classes#391
arogachev merged 4 commits into
masterfrom
refactor

Conversation

@vjik

@vjik vjik commented Nov 25, 2022

Copy link
Copy Markdown
Member
Q A
Is bugfix?
New feature?
Breaks BC? ✔️
Fixed issues -

@vjik vjik added the status:code review The pull request needs review. label Nov 25, 2022
@vjik vjik requested a review from a team November 25, 2022 12:23
@codecov

codecov Bot commented Nov 25, 2022

Copy link
Copy Markdown

Codecov Report

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

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

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #391   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       638       639    +1     
===========================================
  Files             75        75           
  Lines           1541      1515   -26     
===========================================
- Hits            1541      1515   -26     
Impacted Files Coverage Δ
src/EmptyCriteria/NeverEmpty.php 100.00% <ø> (ø)
src/EmptyCriteria/WhenEmpty.php 100.00% <ø> (ø)
src/EmptyCriteria/WhenNull.php 100.00% <ø> (ø)
src/Rule/CompareHandler.php 100.00% <ø> (ø)
src/Rule/NestedHandler.php 100.00% <ø> (ø)
src/Rule/Trait/LimitHandlerTrait.php 100.00% <ø> (ø)
src/Rule/Trait/PreValidateTrait.php 100.00% <ø> (ø)
src/RulesProvider/AttributesRulesProvider.php 100.00% <ø> (ø)
src/Helper/SkipOnEmptyNormalizer.php 100.00% <100.00%> (ø)
src/Rule/AtLeastHandler.php 100.00% <100.00%> (ø)
... and 12 more

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.

Comment thread README.md Outdated
```php
use Yiisoft\Validator\Rule\Number;
use Yiisoft\Validator\SkipOnEmptyCallback\SkipOnNull;
use Yiisoft\Validator\EmptyHandler\NullEmpty;

@arogachev arogachev Nov 26, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my opinion EmptyHandler folder name is a bit confusing. Maybe use EmptyCriteria name or something like that?

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.

I think EmptyHandler is fine. Better than EmptyCriteria because it's not simple a crtiteria for emptiness but a handler i.e. SkipOnNull doesn't only determine what is "empty" but defines how to handle it.

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.

Hmm... checked the actual code. Seems it's, indeed, a crtiteria 🤔

Comment thread src/EmptyHandler/NullEmpty.php Outdated
namespace Yiisoft\Validator\EmptyHandler;

final class SkipOnNull
final class NullEmpty

@arogachev arogachev Nov 26, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
final class NullEmpty
final class NullCriteria

Comment thread src/EmptyHandler/SimpleEmpty.php Outdated
use function is_string;

final class SkipOnEmpty
final class SimpleEmpty

@arogachev arogachev Nov 26, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
final class SimpleEmpty
final class EmptyCriteria

Comment thread src/EmptyHandler/NoEmpty.php Outdated
namespace Yiisoft\Validator\EmptyHandler;

final class SkipNone
final class NoEmpty

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
final class NoEmpty
final class NoneCriteria

@arogachev arogachev Nov 26, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Or NothingCriteria.

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.

Current name is alright IMO. Alternatively it could be Never.

Comment thread README.md Outdated
use Yiisoft\Validator\EmptyHandler\NullEmpty;

$rules = [new Required(emptyCallback: new SkipOnNull())];
$rules = [new Required(emptyCallback: new NullEmpty())];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are more places left with old names, this for example:

- If `skipOnEmpty` is `false` or `null`, `Yiisoft\Validator\SkipOnEmptyCallback\SkipNone` is used automatically as

@arogachev arogachev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

Comment thread README.md Outdated
```php
use Yiisoft\Validator\Rule\Number;
use Yiisoft\Validator\SkipOnEmptyCallback\SkipOnNull;
use Yiisoft\Validator\EmptyHandler\NullEmpty;

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.

Suggested change
use Yiisoft\Validator\EmptyHandler\NullEmpty;
use Yiisoft\Validator\EmptyCrtiteria\NullIsEmpty;
Suggested change
use Yiisoft\Validator\EmptyHandler\NullEmpty;
use Yiisoft\Validator\EmptyCrtiteria\WhenNull;

@vjik vjik requested review from arogachev and samdark November 27, 2022 10:49
@arogachev arogachev merged commit cc3e50a into master Nov 27, 2022
@arogachev arogachev deleted the refactor branch November 27, 2022 17:17
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.

3 participants