Skip to content
Closed
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
2 changes: 1 addition & 1 deletion public/js/jsvalidation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/jsvalidation.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/jsvalidation.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/assets/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ $.extend(true, laravelValidation, {
return laravelValidation.helpers.escapeRegExp(currentValue);
});

return new RegExp('^'+regexpParts.join('.*')+'$');
return new RegExp('^'+regexpParts.join('[^\\]]*')+'$');
}
}
});
2 changes: 1 addition & 1 deletion src/Javascript/JavascriptRulesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

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

Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Javascript/MessageParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Javascript/RuleParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RuleParser
/**
* Token used to secure romte validations.
*
* @var null|string $remoteToken
* @var null|string
*/
protected $remoteToken;

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

Expand Down
8 changes: 4 additions & 4 deletions src/Javascript/ValidatorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function generateJavascriptValidations()
$jsValidations = [];

foreach ($this->validator->getRules() as $attribute => $rules) {
if (! $this->jsValidationEnabled($attribute)) {
if (!$this->jsValidationEnabled($attribute)) {
continue;
}

Expand All @@ -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 Expand Up @@ -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);
}

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/Remote/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function setRemoteValidation($attribute, $validateAll = false)

return;
}
if (! $validateAll) {
if (!$validateAll) {
$rules = $this->purgeNonRemoteRules($rules, $validator);
}
$validator->setRules([$attribute => $rules]);
Expand All @@ -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]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Support/AccessProtectedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

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

Expand Down Expand Up @@ -147,7 +147,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/RuleListTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
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