From c75165c09d7e1292c0afa5b3002197da654900bf Mon Sep 17 00:00:00 2001 From: Cam Kemshal-Bell Date: Thu, 15 Aug 2024 17:41:15 +1000 Subject: [PATCH] chore: styleci fixes --- .../Validation/Concerns/ValidatesAttributes.php | 12 ++++++------ tests/Validation/ValidationDimensionsRuleTest.php | 6 +++--- tests/Validation/ValidationImageFileRuleTest.php | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index 3bcdd544d0d7..f68f7e9bce39 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -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) || @@ -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; } @@ -813,14 +813,14 @@ private function failsMinRatioCheck($parameters, $width, $height) /** * Determine if the given parameters fail a dimension max ratio check. * - * @param array $parameters - * @param int $width - * @param int $height + * @param array $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; } diff --git a/tests/Validation/ValidationDimensionsRuleTest.php b/tests/Validation/ValidationDimensionsRuleTest.php index 7b86b7166923..77c3a0b1d0ec 100644 --- a/tests/Validation/ValidationDimensionsRuleTest.php +++ b/tests/Validation/ValidationDimensionsRuleTest.php @@ -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); } } diff --git a/tests/Validation/ValidationImageFileRuleTest.php b/tests/Validation/ValidationImageFileRuleTest.php index 68adb8c0ed6e..f1940338554f 100644 --- a/tests/Validation/ValidationImageFileRuleTest.php +++ b/tests/Validation/ValidationImageFileRuleTest.php @@ -61,13 +61,13 @@ 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), ); } @@ -75,13 +75,13 @@ public function testDimentionWithTheMinRatioMethod() 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), ); } @@ -89,13 +89,13 @@ public function testDimentionWithTheMaxRatioMethod() 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), ); }