Skip to content

Commit d924925

Browse files
committed
Format code.
1 parent c2de9c3 commit d924925

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

src/Concerns/ValidatesAttributes.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ public function validateDimensions(string $attribute, $value, array $parameters)
339339

340340
$parameters = $this->parseNamedParameters($parameters);
341341

342-
if ($this->failsBasicDimensionChecks($parameters, $width, $height) ||
343-
$this->failsRatioCheck($parameters, $width, $height)) {
342+
if ($this->failsBasicDimensionChecks($parameters, $width, $height)
343+
|| $this->failsRatioCheck($parameters, $width, $height)) {
344344
return false;
345345
}
346346

@@ -770,9 +770,9 @@ public function validateMimetypes(string $attribute, $value, array $parameters):
770770
return false;
771771
}
772772

773-
return $value->getPath() !== '' &&
774-
(in_array($value->getMimeType(), $parameters) ||
775-
in_array(explode('/', $value->getMimeType())[0] . '/*', $parameters));
773+
return $value->getPath() !== ''
774+
&& (in_array($value->getMimeType(), $parameters)
775+
|| in_array(explode('/', $value->getMimeType())[0] . '/*', $parameters));
776776
}
777777

778778
/**
@@ -1263,12 +1263,12 @@ protected function isTestingRelativeDateTime($value): bool
12631263
*/
12641264
protected function failsBasicDimensionChecks(array $parameters, int $width, int $height): bool
12651265
{
1266-
return (isset($parameters['width']) && $parameters['width'] != $width) ||
1267-
(isset($parameters['min_width']) && $parameters['min_width'] > $width) ||
1268-
(isset($parameters['max_width']) && $parameters['max_width'] < $width) ||
1269-
(isset($parameters['height']) && $parameters['height'] != $height) ||
1270-
(isset($parameters['min_height']) && $parameters['min_height'] > $height) ||
1271-
(isset($parameters['max_height']) && $parameters['max_height'] < $height);
1266+
return (isset($parameters['width']) && $parameters['width'] != $width)
1267+
|| (isset($parameters['min_width']) && $parameters['min_width'] > $width)
1268+
|| (isset($parameters['max_width']) && $parameters['max_width'] < $width)
1269+
|| (isset($parameters['height']) && $parameters['height'] != $height)
1270+
|| (isset($parameters['min_height']) && $parameters['min_height'] > $height)
1271+
|| (isset($parameters['max_height']) && $parameters['max_height'] < $height);
12721272
}
12731273

12741274
/**

src/ValidationRuleParser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ protected function prepareRule($rule)
151151
$rule = new ClosureValidationRule($rule);
152152
}
153153

154-
if (! is_object($rule) ||
155-
$rule instanceof RuleContract ||
156-
($rule instanceof Exists && $rule->queryCallbacks()) ||
157-
($rule instanceof Unique && $rule->queryCallbacks())) {
154+
if (! is_object($rule)
155+
|| $rule instanceof RuleContract
156+
|| ($rule instanceof Exists && $rule->queryCallbacks())
157+
|| ($rule instanceof Unique && $rule->queryCallbacks())) {
158158
return $rule;
159159
}
160160

src/Validator.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,8 @@ protected function validateAttribute(string $attribute, $rule)
779779
// First we will get the correct keys for the given attribute in case the field is nested in
780780
// an array. Then we determine if the given rule accepts other field names as parameters.
781781
// If so, we will replace any asterisks found in the parameters with the correct keys.
782-
if (($keys = $this->getExplicitKeys($attribute)) &&
783-
$this->dependsOnOtherFields($rule)) {
782+
if (($keys = $this->getExplicitKeys($attribute))
783+
&& $this->dependsOnOtherFields($rule)) {
784784
$parameters = $this->replaceAsterisksInParameters($parameters, $keys);
785785
}
786786

@@ -789,8 +789,8 @@ protected function validateAttribute(string $attribute, $rule)
789789
// If the attribute is a file, we will verify that the file upload was actually successful
790790
// and if it wasn't we will add a failure for the attribute. Files may not successfully
791791
// upload if they are too large based on PHP's settings so we will bail in this case.
792-
if ($value instanceof UploadedFile && ! $value->isValid() &&
793-
$this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules))
792+
if ($value instanceof UploadedFile && ! $value->isValid()
793+
&& $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules))
794794
) {
795795
return $this->addFailure($attribute, 'uploaded', []);
796796
}
@@ -875,10 +875,10 @@ protected function replaceAsterisksInParameters(array $parameters, array $keys):
875875
*/
876876
protected function isValidatable($rule, string $attribute, $value): bool
877877
{
878-
return $this->presentOrRuleIsImplicit($rule, $attribute, $value) &&
879-
$this->passesOptionalCheck($attribute) &&
880-
$this->isNotNullIfMarkedAsNullable($rule, $attribute) &&
881-
$this->hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute);
878+
return $this->presentOrRuleIsImplicit($rule, $attribute, $value)
879+
&& $this->passesOptionalCheck($attribute)
880+
&& $this->isNotNullIfMarkedAsNullable($rule, $attribute)
881+
&& $this->hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute);
882882
}
883883

884884
/**
@@ -893,8 +893,8 @@ protected function presentOrRuleIsImplicit($rule, string $attribute, $value): bo
893893
return $this->isImplicit($rule);
894894
}
895895

896-
return $this->validatePresent($attribute, $value) ||
897-
$this->isImplicit($rule);
896+
return $this->validatePresent($attribute, $value)
897+
|| $this->isImplicit($rule);
898898
}
899899

900900
/**
@@ -904,8 +904,8 @@ protected function presentOrRuleIsImplicit($rule, string $attribute, $value): bo
904904
*/
905905
protected function isImplicit($rule): bool
906906
{
907-
return $rule instanceof ImplicitRule ||
908-
in_array($rule, $this->implicitRules);
907+
return $rule instanceof ImplicitRule
908+
|| in_array($rule, $this->implicitRules);
909909
}
910910

911911
/**
@@ -980,17 +980,17 @@ protected function shouldStopValidating(string $attribute): bool
980980
return $this->messages->has($attribute);
981981
}
982982

983-
if (isset($this->failedRules[$attribute]) &&
984-
array_key_exists('uploaded', $this->failedRules[$attribute])) {
983+
if (isset($this->failedRules[$attribute])
984+
&& array_key_exists('uploaded', $this->failedRules[$attribute])) {
985985
return true;
986986
}
987987

988988
// In case the attribute has any rule that indicates that the field is required
989989
// and that rule already failed then we should stop validation at this point
990990
// as now there is no point in calling other rules with this field empty.
991-
return $this->hasRule($attribute, $this->implicitRules) &&
992-
isset($this->failedRules[$attribute]) &&
993-
array_intersect(array_keys($this->failedRules[$attribute]), $this->implicitRules);
991+
return $this->hasRule($attribute, $this->implicitRules)
992+
&& isset($this->failedRules[$attribute])
993+
&& array_intersect(array_keys($this->failedRules[$attribute]), $this->implicitRules);
994994
}
995995

996996
/**

0 commit comments

Comments
 (0)