From 6ffc2267512ff4bbdf9043b7fc56cbba64425ebe Mon Sep 17 00:00:00 2001
From: Peter
Date: Tue, 6 Aug 2019 00:39:52 +0000
Subject: [PATCH] Apply fixes from StyleCI
---
src/Javascript/JavascriptRulesTrait.php | 2 +-
src/Javascript/JavascriptValidator.php | 4 ++--
src/Javascript/MessageParser.php | 2 +-
src/Javascript/RuleParser.php | 10 +++++-----
src/Javascript/ValidatorHandler.php | 8 ++++----
src/JsValidatorFactory.php | 6 +++---
src/Remote/Validator.php | 4 ++--
src/Support/AccessProtectedTrait.php | 2 +-
src/Support/DelegatedValidator.php | 4 ++--
src/Support/RuleListTrait.php | 2 +-
src/Support/UseDelegatedValidatorTrait.php | 2 +-
11 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/Javascript/JavascriptRulesTrait.php b/src/Javascript/JavascriptRulesTrait.php
index 8f62a921..43dfb990 100644
--- a/src/Javascript/JavascriptRulesTrait.php
+++ b/src/Javascript/JavascriptRulesTrait.php
@@ -44,7 +44,7 @@ protected function ruleConfirmed($attribute, array $parameters)
*/
protected function ruleAfter($attribute, array $parameters)
{
- if (! ($date = strtotime($parameters[0]))) {
+ if (!($date = strtotime($parameters[0]))) {
$date = $this->getAttributeName($parameters[0]);
}
diff --git a/src/Javascript/JavascriptValidator.php b/src/Javascript/JavascriptValidator.php
index 4cf3ed4d..5660b2dd 100644
--- a/src/Javascript/JavascriptValidator.php
+++ b/src/Javascript/JavascriptValidator.php
@@ -118,7 +118,7 @@ public function __toString()
public function __get($name)
{
$data = $this->getViewData();
- if (! array_key_exists($name, $data)) {
+ if (!array_key_exists($name, $data)) {
throw new PropertyNotFoundException($name, get_class());
}
@@ -136,7 +136,7 @@ protected function getViewData()
$data = $this->validator->validationData();
$data['selector'] = $this->selector;
- if (! is_null($this->ignore)) {
+ if (!is_null($this->ignore)) {
$data['ignore'] = $this->ignore;
}
diff --git a/src/Javascript/MessageParser.php b/src/Javascript/MessageParser.php
index dd43ab56..b5db4154 100644
--- a/src/Javascript/MessageParser.php
+++ b/src/Javascript/MessageParser.php
@@ -87,7 +87,7 @@ private function fakeRequiredIfData($data, $rule, $parameters)
*/
private function fakeFileData($data, $attribute)
{
- if (! $this->validator->hasRule($attribute, ['Mimes', 'Image'])) {
+ if (!$this->validator->hasRule($attribute, ['Mimes', 'Image'])) {
return;
}
diff --git a/src/Javascript/RuleParser.php b/src/Javascript/RuleParser.php
index b66ae530..11eeeb5f 100644
--- a/src/Javascript/RuleParser.php
+++ b/src/Javascript/RuleParser.php
@@ -25,7 +25,7 @@ class RuleParser
/**
* Token used to secure romte validations.
*
- * @var null|string $remoteToken
+ * @var null|string
*/
protected $remoteToken;
@@ -63,10 +63,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);
@@ -127,7 +127,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];
@@ -177,7 +177,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..3eb8d2e9 100644
--- a/src/Javascript/ValidatorHandler.php
+++ b/src/Javascript/ValidatorHandler.php
@@ -77,7 +77,7 @@ protected function generateJavascriptValidations()
$jsValidations = [];
foreach ($this->validator->getRules() as $attribute => $rules) {
- if (! $this->jsValidationEnabled($attribute)) {
+ if (!$this->jsValidationEnabled($attribute)) {
continue;
}
@@ -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),
@@ -133,7 +133,7 @@ protected function isValidatable($jsRule, $includeRemote)
*/
public function jsValidationEnabled($attribute)
{
- return ! $this->validator->hasRule($attribute, self::JSVALIDATION_DISABLE);
+ return !$this->validator->hasRule($attribute, self::JSVALIDATION_DISABLE);
}
/**
diff --git a/src/JsValidatorFactory.php b/src/JsValidatorFactory.php
index 29a48fba..ba3205d8 100644
--- a/src/JsValidatorFactory.php
+++ b/src/JsValidatorFactory.php
@@ -121,7 +121,7 @@ protected function getValidationData(array $rules, array $customAttributes = [])
*/
public function formRequest($formRequest, $selector = null)
{
- if (! is_object($formRequest)) {
+ if (!is_object($formRequest)) {
$formRequest = $this->createFormRequest($formRequest);
}
@@ -161,7 +161,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);
@@ -198,7 +198,7 @@ public function validator(Validator $validator, $selector = null)
*/
protected function jsValidator(Validator $validator, $selector = null)
{
- $remote = ! $this->options['disable_remote_validation'];
+ $remote = !$this->options['disable_remote_validation'];
$view = $this->options['view'];
$selector = is_null($selector) ? $this->options['form_selector'] : $selector;
diff --git a/src/Remote/Validator.php b/src/Remote/Validator.php
index d74a2438..756c9af8 100644
--- a/src/Remote/Validator.php
+++ b/src/Remote/Validator.php
@@ -140,7 +140,7 @@ protected function setRemoteValidation($attribute, $validateAll = false)
return;
}
- if (! $validateAll) {
+ if (!$validateAll) {
$rules = $this->purgeNonRemoteRules($rules, $validator);
}
$validator->setRules([$attribute => $rules]);
@@ -159,7 +159,7 @@ protected function purgeNonRemoteRules($rules, $validator)
foreach ($rules as $i => $rule) {
$parsedRule = ValidationRuleParser::parse([$rule]);
- if (! $this->isRemoteRule($parsedRule[0])) {
+ if (!$this->isRemoteRule($parsedRule[0])) {
unset($rules[$i]);
}
}
diff --git a/src/Support/AccessProtectedTrait.php b/src/Support/AccessProtectedTrait.php
index f1976914..c6fe4ee9 100644
--- a/src/Support/AccessProtectedTrait.php
+++ b/src/Support/AccessProtectedTrait.php
@@ -50,7 +50,7 @@ protected function getProtected($instance, $property)
*/
protected function callProtected($instance, $method, $args = [])
{
- if (! ($instance instanceof Closure)) {
+ if (!($instance instanceof Closure)) {
$instance = $this->createProtectedCaller($instance);
}
diff --git a/src/Support/DelegatedValidator.php b/src/Support/DelegatedValidator.php
index 681a2637..bf75cb6a 100644
--- a/src/Support/DelegatedValidator.php
+++ b/src/Support/DelegatedValidator.php
@@ -119,7 +119,7 @@ public function makeReplacements($message, $attribute, $rule, $parameters)
if (is_object($rule)) {
$rule = get_class($rule);
}
-
+
return $this->callValidator('makeReplacements', [$message, $attribute, $rule, $parameters]);
}
@@ -147,7 +147,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/RuleListTrait.php b/src/Support/RuleListTrait.php
index 7833c78f..3b679bfc 100644
--- a/src/Support/RuleListTrait.php
+++ b/src/Support/RuleListTrait.php
@@ -58,7 +58,7 @@ protected function isImplemented($rule)
protected function isRemoteRule($rule)
{
return in_array($rule, $this->serverRules) ||
- ! in_array($rule, $this->clientRules);
+ !in_array($rule, $this->clientRules);
}
/**
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;