Don't break on removing a non-existing rule

This commit is contained in:
Wouter 2018-03-09 16:51:08 +01:00 committed by GitHub
parent fb5c3ecd71
commit 1f0c973681
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -594,7 +594,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
$this->_parseRules(); $this->_parseRules();
if ($rule === null) { if ($rule === null) {
unset($this->_fields[$field]); unset($this->_fields[$field]);
} else { } elseif (array_key_exists($field, $this->_fields)) {
$this->_fields[$field]->removeRule($rule); $this->_fields[$field]->removeRule($rule);
} }
return $this; return $this;