Conversation
vjik
commented
Nov 25, 2022
| Q | A |
|---|---|
| Is bugfix? | ❌ |
| New feature? | ❌ |
| Breaks BC? | ✔️ |
| Fixed issues | - |
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
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
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. |
| ```php | ||
| use Yiisoft\Validator\Rule\Number; | ||
| use Yiisoft\Validator\SkipOnEmptyCallback\SkipOnNull; | ||
| use Yiisoft\Validator\EmptyHandler\NullEmpty; |
There was a problem hiding this comment.
In my opinion EmptyHandler folder name is a bit confusing. Maybe use EmptyCriteria name or something like that?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Hmm... checked the actual code. Seems it's, indeed, a crtiteria 🤔
| namespace Yiisoft\Validator\EmptyHandler; | ||
|
|
||
| final class SkipOnNull | ||
| final class NullEmpty |
There was a problem hiding this comment.
| final class NullEmpty | |
| final class NullCriteria |
| use function is_string; | ||
|
|
||
| final class SkipOnEmpty | ||
| final class SimpleEmpty |
There was a problem hiding this comment.
| final class SimpleEmpty | |
| final class EmptyCriteria |
| namespace Yiisoft\Validator\EmptyHandler; | ||
|
|
||
| final class SkipNone | ||
| final class NoEmpty |
There was a problem hiding this comment.
| final class NoEmpty | |
| final class NoneCriteria |
There was a problem hiding this comment.
Current name is alright IMO. Alternatively it could be Never.
| use Yiisoft\Validator\EmptyHandler\NullEmpty; | ||
|
|
||
| $rules = [new Required(emptyCallback: new SkipOnNull())]; | ||
| $rules = [new Required(emptyCallback: new NullEmpty())]; |
There was a problem hiding this comment.
There are more places left with old names, this for example:
Line 160 in 8b20d2b
| ```php | ||
| use Yiisoft\Validator\Rule\Number; | ||
| use Yiisoft\Validator\SkipOnEmptyCallback\SkipOnNull; | ||
| use Yiisoft\Validator\EmptyHandler\NullEmpty; |
There was a problem hiding this comment.
| use Yiisoft\Validator\EmptyHandler\NullEmpty; | |
| use Yiisoft\Validator\EmptyCrtiteria\NullIsEmpty; |
| use Yiisoft\Validator\EmptyHandler\NullEmpty; | |
| use Yiisoft\Validator\EmptyCrtiteria\WhenNull; |