diff --git a/.styleci.yml b/.styleci.yml index e5553d4b..4d804418 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -7,7 +7,6 @@ enabled: disabled: - concat_without_spaces - phpdoc_no_package - - logical_not_operators_with_successor_space - simplified_null_return finder: diff --git a/config/jsvalidation.php b/config/jsvalidation.php index 7f42f6cf..51fa7015 100644 --- a/config/jsvalidation.php +++ b/config/jsvalidation.php @@ -49,5 +49,5 @@ * * See https://jqueryvalidation.org/validate/#ignore */ - 'ignore' => ":hidden, [contenteditable='true']" + 'ignore' => ":hidden, [contenteditable='true']", ]; diff --git a/src/Javascript/RuleParser.php b/src/Javascript/RuleParser.php index c685a097..23f1bb34 100644 --- a/src/Javascript/RuleParser.php +++ b/src/Javascript/RuleParser.php @@ -3,8 +3,8 @@ namespace Proengsoft\JsValidation\Javascript; use Proengsoft\JsValidation\JsValidatorFactory; -use Proengsoft\JsValidation\Support\RuleListTrait; use Proengsoft\JsValidation\Support\DelegatedValidator; +use Proengsoft\JsValidation\Support\RuleListTrait; use Proengsoft\JsValidation\Support\UseDelegatedValidatorTrait; class RuleParser @@ -26,7 +26,7 @@ class RuleParser /** * Token used to secure romte validations. * - * @var null|string $remoteToken + * @var null|string */ protected $remoteToken; @@ -64,10 +64,10 @@ public function getRule($attribute, $rule, $parameters, $rawRule) $isRemote = $this->isRemoteRule($rule); if ($isConditional || $isRemote) { - list($attribute, $parameters) = $this->remoteRule($attribute, $isConditional); + [$attribute, $parameters] = $this->remoteRule($attribute, $isConditional); $jsRule = self::REMOTE_RULE; } else { - list($jsRule, $attribute, $parameters) = $this->clientRule($attribute, $rule, $parameters); + [$jsRule, $attribute, $parameters] = $this->clientRule($attribute, $rule, $parameters); } $attribute = $this->getAttributeName($attribute); @@ -128,7 +128,7 @@ protected function clientRule($attribute, $rule, $parameters) $method = "rule{$rule}"; if (method_exists($this, $method)) { - list($attribute, $parameters) = $this->$method($attribute, $parameters); + [$attribute, $parameters] = $this->$method($attribute, $parameters); } return [$jsRule, $attribute, $parameters]; @@ -180,7 +180,7 @@ protected function getAttributeName($attribute) public function parseNamedParameters($parameters) { return array_reduce($parameters, function ($result, $item) { - list($key, $value) = array_pad(explode('=', $item, 2), 2, null); + [$key, $value] = array_pad(explode('=', $item, 2), 2, null); $result[$key] = $value; diff --git a/src/Javascript/ValidatorHandler.php b/src/Javascript/ValidatorHandler.php index 86e7d7bd..a974ab61 100644 --- a/src/Javascript/ValidatorHandler.php +++ b/src/Javascript/ValidatorHandler.php @@ -100,8 +100,8 @@ protected function jsConvertRules($attribute, $rules, $includeRemote) { $jsRules = []; foreach ($rules as $rawRule) { - list($rule, $parameters) = $this->validator->parseRule($rawRule); - list($jsAttribute, $jsRule, $jsParams) = $this->rules->getRule($attribute, $rule, $parameters, $rawRule); + [$rule, $parameters] = $this->validator->parseRule($rawRule); + [$jsAttribute, $jsRule, $jsParams] = $this->rules->getRule($attribute, $rule, $parameters, $rawRule); if ($this->isValidatable($jsRule, $includeRemote)) { $jsRules[$jsAttribute][$jsRule][] = [$rule, $jsParams, $this->messages->getMessage($attribute, $rule, $parameters), diff --git a/src/JsValidatorFactory.php b/src/JsValidatorFactory.php index 42a5bbf1..f6ee86f7 100644 --- a/src/JsValidatorFactory.php +++ b/src/JsValidatorFactory.php @@ -136,11 +136,11 @@ public function formRequest($formRequest, $selector = null) $validator = $this->getValidatorInstance($rules, $formRequest->messages(), $formRequest->attributes()); $jsValidator = $this->validator($validator, $selector); - + if (method_exists($formRequest, 'withJsValidator')) { $formRequest->withJsValidator($jsValidator); } - + return $jsValidator; } @@ -173,7 +173,7 @@ protected function createFormRequest($class) * @var $formRequest \Illuminate\Foundation\Http\FormRequest * @var $request Request */ - list($class, $params) = $this->parseFormRequestName($class); + [$class, $params] = $this->parseFormRequestName($class); $request = $this->app->__get('request'); $formRequest = $this->app->build($class, $params); diff --git a/src/Support/DelegatedValidator.php b/src/Support/DelegatedValidator.php index fb0e87ab..0b585b12 100644 --- a/src/Support/DelegatedValidator.php +++ b/src/Support/DelegatedValidator.php @@ -123,7 +123,7 @@ public function makeReplacements($message, $attribute, $rule, $parameters) if (is_object($rule)) { $rule = get_class($rule); } - + return $this->callValidator('makeReplacements', [$message, $attribute, $rule, $parameters]); } @@ -151,7 +151,7 @@ public function getMessage($attribute, $rule) if (is_object($rule)) { $rule = get_class($rule); } - + return $this->callValidator('getMessage', [$attribute, $rule]); } diff --git a/src/Support/UseDelegatedValidatorTrait.php b/src/Support/UseDelegatedValidatorTrait.php index 308ab8c4..48cc794d 100644 --- a/src/Support/UseDelegatedValidatorTrait.php +++ b/src/Support/UseDelegatedValidatorTrait.php @@ -7,7 +7,7 @@ trait UseDelegatedValidatorTrait /** * Delegated validator. * - * @var \Proengsoft\JsValidation\Support\DelegatedValidator $validator + * @var \Proengsoft\JsValidation\Support\DelegatedValidator */ protected $validator; diff --git a/src/Support/ValidationRuleParserProxy.php b/src/Support/ValidationRuleParserProxy.php index dd6c0485..d5d936e9 100644 --- a/src/Support/ValidationRuleParserProxy.php +++ b/src/Support/ValidationRuleParserProxy.php @@ -7,7 +7,7 @@ class ValidationRuleParserProxy { use AccessProtectedTrait; - + /** * ValidationRuleParser instance. * @@ -52,7 +52,7 @@ public function parse($rules) */ public function explodeRules($rules) { - return $this->callProtected($this->parserMethod, 'explodeRules', [ $rules ]); + return $this->callProtected($this->parserMethod, 'explodeRules', [$rules]); } /**