mirror of
https://github.com/Respect/Validation.git
synced 2024-06-03 06:12:17 +02:00
Apply "SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
44f4d65a3d
commit
e89b32270b
|
@ -13,7 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Rules;
|
||||
|
||||
use function call_user_func;
|
||||
use function array_merge;
|
||||
use function call_user_func_array;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Validates the input using the return of a given callable.
|
||||
|
@ -50,6 +52,11 @@ final class Callback extends AbstractRule
|
|||
*/
|
||||
public function validate($input): bool
|
||||
{
|
||||
return (bool) call_user_func($this->callback, $input, ...$this->arguments);
|
||||
$arguments = [$input];
|
||||
if (count($this->arguments) > 0) {
|
||||
$arguments = array_merge($arguments, $this->arguments);
|
||||
}
|
||||
|
||||
return (bool) call_user_func_array($this->callback, $arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" />
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias" />
|
||||
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
|
||||
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
|
||||
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses" />
|
||||
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon" />
|
||||
|
|
Loading…
Reference in a new issue