Skip to content

Commit 701b27f

Browse files
author
xiajianjun
committed
fix bug
1 parent fff2e19 commit 701b27f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/ValidatorTrait.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,14 @@ public function beforeValidate(){}
125125
*/
126126
public function validate(array $onlyChecked = [],$hasErrorStop=null)
127127
{
128-
if ( $this->_hasValidated ) {
129-
return $this;
130-
}
131-
132128
if ( !property_exists($this, 'data') ) {
133129
throw new \InvalidArgumentException('Must be defined property \'data (array)\' in the classes used.');
134130
}
135131

136-
$data = $this->data;
132+
if ( $this->_hasValidated || !($data = $this->data) ) {
133+
return $this;
134+
}
135+
137136
$this->beforeValidate();
138137
$this->clearErrors();
139138
$this->hasErrorStop($hasErrorStop);

0 commit comments

Comments
 (0)