Skip to content

Commit

Permalink
added workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
kasitmp committed Mar 7, 2017
1 parent 6c75f16 commit 15142fb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
7 changes: 3 additions & 4 deletions src/Validator/StringLengthBetween.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ protected function describe()
*/
protected function parse($value)
{
if (!is_string($value)) {
return null;
if (strlen($value) >= $this->minValue && strlen($value) <= $this->maxValue) {
return $value;
}
$value = strlen($value);
return parent::parse($value);
return null;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Validator/StringLengthLargerThanOrEqualToParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ protected function describe()
*/
protected function parse($value)
{
if (!is_string($value)) {
return null;
if (strlen($value) >= $this->minValue) {
return $value;
}
$value = strlen($value);
return parent::parse($value);
return null;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Validator/StringLengthLargerThanParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ protected function describe()
*/
protected function parse($value)
{
if (!is_string($value)) {
return null;
if (strlen($value) > $this->minValue) {
return $value;
}
$value = strlen($value);
return parent::parse($value);
return null;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Validator/StringLengthSmallerThanOrEqualToParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ protected function describe()
*/
protected function parse($value)
{
if (!is_string($value)) {
return null;
if (strlen($value) <= $this->maxValue) {
return $value;
}
$value = strlen($value);
return parent::parse($value);
return null;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Validator/StringLengthSmallerThanParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ protected function describe()
*/
protected function parse($value)
{
if (!is_string($value)) {
return null;
if (strlen($value) < $this->maxValue) {
return $value;
}
$value = strlen($value);
return parent::parse($value);
return null;
}

/**
Expand Down

0 comments on commit 15142fb

Please sign in to comment.