Skip to content

Commit

Permalink
corrections for the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Sep 29, 2023
1 parent 23c250a commit 512c035
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions phalcon/Filter/Validation/AbstractValidator.zep
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract class AbstractValidator implements ValidatorInterface
*
* @return mixed
*/
public function getOption(string! key, var defaultValue = null) -> var
public function getOption(string key, var defaultValue = null) -> var
{
var value, fieldValue;

Expand All @@ -88,7 +88,7 @@ abstract class AbstractValidator implements ValidatorInterface
* If we have `attribute` as a key, it means it is a Uniqueness
* validator, we can have here multiple fields, so we need to check it
*/
if key == "attribute" && typeof value == "array" {
if key === "attribute" && typeof value === "array" {
if fetch fieldValue, value[key] {
return fieldValue;
}
Expand All @@ -97,18 +97,6 @@ abstract class AbstractValidator implements ValidatorInterface
return value;
}

/**
* Checks if an option is defined
*
* @param string $key
*
* @return bool
*/
public function hasOption(string! key) -> bool
{
return isset this->options[key];
}

/**
* Get the template message
*
Expand Down Expand Up @@ -142,6 +130,18 @@ abstract class AbstractValidator implements ValidatorInterface
return this->templates;
}

/**
* Checks if an option is defined
*
* @param string $key
*
* @return bool
*/
public function hasOption(string key) -> bool
{
return isset this->options[key];
}

/**
* Create a default message by factory
*
Expand All @@ -151,8 +151,11 @@ abstract class AbstractValidator implements ValidatorInterface
*
* @return Message
*/
public function messageFactory(<Validation> validation, var field, array! replacements = []) -> <Message>
{
public function messageFactory(
<Validation> validation,
var field,
array replacements = []
) -> <Message> {
var singleField;

if typeof field == "array" {
Expand Down Expand Up @@ -186,7 +189,7 @@ abstract class AbstractValidator implements ValidatorInterface
*
* @return void
*/
public function setOption(string! key, value) -> void
public function setOption(string key, value) -> void
{
let this->options[key] = value;
}
Expand Down Expand Up @@ -239,8 +242,8 @@ abstract class AbstractValidator implements ValidatorInterface
/**
* Checks if field can be empty.
*
* @param string $field
* @param mixed $value
* @param mixed $field
* @param mixed $value
*
* @return bool
*/
Expand Down Expand Up @@ -305,7 +308,7 @@ abstract class AbstractValidator implements ValidatorInterface
*
* @return mixed
*/
protected function prepareLabel(<Validation> validation, string! field) -> var
protected function prepareLabel(<Validation> validation, string field) -> var
{
var label;

Expand Down

0 comments on commit 512c035

Please sign in to comment.