Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Add isNotValid api #23

Closed
wants to merge 1 commit into from
Closed

Add isNotValid api #23

wants to merge 1 commit into from

Conversation

gianarb
Copy link
Contributor

@gianarb gianarb commented Jul 20, 2015

I don't know if it's a good idea but I see a lot of this implementation

if (!$validator->isValid()) {
}

In my opinion this is difficult to read.
I know that a new api is an important upgrade but this is very easy to maintain and the code is more readable!

if ($validator->isNotValid()) {
}

In this PR I have not added it into the Interface because it would be a big BC Break.. :)

@Maks3w
Copy link
Member

Maks3w commented Jul 20, 2015

I don't disagree with this.

Maks3w added a commit to Maks3w/zend-validator that referenced this pull request Jul 20, 2015
While this method does not apport new features it improves the expressiveness.

credits @gianarb zendframework#23
@weierophinney
Copy link
Member

I do disagree with this. isValid() is a boolean method, and this is what the boolean operator (i.e., !) is for. If you're testing for something being invalid, you test ! $validator->isValid($data).

More methods === more to support, and more to learn.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants