Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ enabled:
disabled:
- concat_without_spaces
- phpdoc_no_package
- logical_not_operators_with_successor_space
- simplified_null_return

finder:
Expand Down
2 changes: 1 addition & 1 deletion config/jsvalidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
*
* See https://jqueryvalidation.org/validate/#ignore
*/
'ignore' => ":hidden, [contenteditable='true']"
'ignore' => ":hidden, [contenteditable='true']",
];
12 changes: 6 additions & 6 deletions src/Javascript/RuleParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +26,7 @@ class RuleParser
/**
* Token used to secure romte validations.
*
* @var null|string $remoteToken
* @var null|string
*/
protected $remoteToken;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/Javascript/ValidatorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions src/JsValidatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Support/DelegatedValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down Expand Up @@ -151,7 +151,7 @@ public function getMessage($attribute, $rule)
if (is_object($rule)) {
$rule = get_class($rule);
}

return $this->callValidator('getMessage', [$attribute, $rule]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Support/UseDelegatedValidatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait UseDelegatedValidatorTrait
/**
* Delegated validator.
*
* @var \Proengsoft\JsValidation\Support\DelegatedValidator $validator
* @var \Proengsoft\JsValidation\Support\DelegatedValidator
*/
protected $validator;

Expand Down
4 changes: 2 additions & 2 deletions src/Support/ValidationRuleParserProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ValidationRuleParserProxy
{
use AccessProtectedTrait;

/**
* ValidationRuleParser instance.
*
Expand Down Expand Up @@ -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]);
}

/**
Expand Down