Skip to content

Commit

Permalink
chore: styleci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CamKem committed Aug 15, 2024
1 parent 5cabd32 commit c75165c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ public function validateDimensions($attribute, $value, $parameters)

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

return !(
return ! (
$this->failsBasicDimensionChecks($parameters, $width, $height) ||
$this->failsRatioCheck($parameters, $width, $height) ||
$this->failsMinRatioCheck($parameters, $width, $height) ||
Expand Down Expand Up @@ -799,7 +799,7 @@ protected function failsRatioCheck($parameters, $width, $height)
*/
private function failsMinRatioCheck($parameters, $width, $height)
{
if (!isset($parameters['min_ratio'])) {
if (! isset($parameters['min_ratio'])) {
return false;
}

Expand All @@ -813,14 +813,14 @@ private function failsMinRatioCheck($parameters, $width, $height)
/**
* Determine if the given parameters fail a dimension max ratio check.
*
* @param array<string,string> $parameters
* @param int $width
* @param int $height
* @param array<string,string> $parameters
* @param int $width
* @param int $height
* @return bool
*/
private function failsMaxRatioCheck($parameters, $width, $height)
{
if (!isset($parameters['max_ratio'])) {
if (! isset($parameters['max_ratio'])) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Validation/ValidationDimensionsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule()
$this->assertSame('dimensions:height=100', (string) $rule);

$rule = Rule::dimensions()
->minRatio(1/2)
->maxRatio(1/3);
->minRatio(1 / 2)
->maxRatio(1 / 3);
$this->assertSame('dimensions:min_ratio=0.5,max_ratio=0.33333333333333', (string) $rule);

$rule = Rule::dimensions()
->ratioRange(min: 1/2, max: 1/3);
->ratioRange(min: 1 / 2, max: 1 / 3);
$this->assertSame('dimensions:min_ratio=0.5,max_ratio=0.33333333333333', (string) $rule);
}
}
12 changes: 6 additions & 6 deletions tests/Validation/ValidationImageFileRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,41 @@ public function testDimentionWithTheRatioMethod()
public function testDimentionWithTheMinRatioMethod()
{
$this->fails(
File::image()->dimensions(Rule::dimensions()->minRatio(1/2)),
File::image()->dimensions(Rule::dimensions()->minRatio(1 / 2)),
UploadedFile::fake()->image('foo.png', 100, 100),
['validation.dimensions'],
);

$this->passes(
File::image()->dimensions(Rule::dimensions()->minRatio(1/2)),
File::image()->dimensions(Rule::dimensions()->minRatio(1 / 2)),
UploadedFile::fake()->image('foo.png', 100, 200),
);
}

public function testDimentionWithTheMaxRatioMethod()
{
$this->fails(
File::image()->dimensions(Rule::dimensions()->maxRatio(1/2)),
File::image()->dimensions(Rule::dimensions()->maxRatio(1 / 2)),
UploadedFile::fake()->image('foo.png', 100, 300),
['validation.dimensions'],
);

$this->passes(
File::image()->dimensions(Rule::dimensions()->maxRatio(1/2)),
File::image()->dimensions(Rule::dimensions()->maxRatio(1 / 2)),
UploadedFile::fake()->image('foo.png', 100, 100),
);
}

public function testDimentionWithTheRatioRangeMethod()
{
$this->fails(
File::image()->dimensions(Rule::dimensions()->ratioRange(1/2, 1/3)),
File::image()->dimensions(Rule::dimensions()->ratioRange(1 / 2, 1 / 3)),
UploadedFile::fake()->image('foo.png', 100, 100),
['validation.dimensions'],
);

$this->passes(
File::image()->dimensions(Rule::dimensions()->ratioRange(1/2, 1/3)),
File::image()->dimensions(Rule::dimensions()->ratioRange(1 / 2, 1 / 3)),
UploadedFile::fake()->image('foo.png', 100, 200),
);
}
Expand Down

0 comments on commit c75165c

Please sign in to comment.