Skip to content

Commit 7161e24

Browse files
author
symfonyaml
committed
Apply coding standards suggested by fabbot.io
1 parent 268ecd0 commit 7161e24

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

src/Symfony/Component/Validator/Constraints/Video.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14-
use Symfony\Component\Validator\Constraints\File;
15-
1614
/**
1715
* @author Kev <https://github.com/symfonyaml>
1816
*/
@@ -136,7 +134,7 @@ public function __construct(
136134
?string $allowPortraitMessage = null,
137135
?string $corruptedMessage = null,
138136
?array $groups = null,
139-
mixed $payload = null
137+
mixed $payload = null,
140138
) {
141139
parent::__construct(
142140
$options,

src/Symfony/Component/Validator/Constraints/VideoValidator.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@
2020
*/
2121
class VideoValidator extends FileValidator
2222
{
23-
/**
24-
* @return void
25-
*/
2623
public function validate(mixed $value, Constraint $constraint): void
2724
{
2825
if (!$constraint instanceof Video) {
2926
throw new UnexpectedTypeException($constraint, Video::class);
3027
}
3128

32-
if (!\class_exists('FFMpeg\FFProbe')) {
29+
if (!class_exists('FFMpeg\FFProbe')) {
3330
throw new \LogicException('The "php-ffmpeg/php-ffmpeg" library must be installed to use the Video constraint. Try running "composer require php-ffmpeg/php-ffmpeg".');
3431
}
3532

@@ -55,7 +52,7 @@ public function validate(mixed $value, Constraint $constraint): void
5552
$ffprobe = \FFMpeg\FFProbe::create();
5653
$stream = $ffprobe->streams($value)->videos()->first();
5754
if (!$stream) {
58-
throw new \Exception('Unexpected FFMpeg error');
55+
throw new \Exception('Unexpected FFMpeg error.');
5956
}
6057
$dimensions = $stream->getDimensions();
6158
} catch (\Exception $e) {
@@ -72,7 +69,7 @@ public function validate(mixed $value, Constraint $constraint): void
7269

7370
if ($constraint->minWidth) {
7471
if (!ctype_digit((string) $constraint->minWidth)) {
75-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum width.', $constraint->minWidth));
72+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum width.', $constraint->minWidth));
7673
}
7774

7875
if ($width < $constraint->minWidth) {
@@ -88,7 +85,7 @@ public function validate(mixed $value, Constraint $constraint): void
8885

8986
if ($constraint->maxWidth) {
9087
if (!ctype_digit((string) $constraint->maxWidth)) {
91-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum width.', $constraint->maxWidth));
88+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum width.', $constraint->maxWidth));
9289
}
9390

9491
if ($width > $constraint->maxWidth) {
@@ -104,7 +101,7 @@ public function validate(mixed $value, Constraint $constraint): void
104101

105102
if ($constraint->minHeight) {
106103
if (!ctype_digit((string) $constraint->minHeight)) {
107-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height.', $constraint->minHeight));
104+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum height.', $constraint->minHeight));
108105
}
109106

110107
if ($height < $constraint->minHeight) {
@@ -120,7 +117,7 @@ public function validate(mixed $value, Constraint $constraint): void
120117

121118
if ($constraint->maxHeight) {
122119
if (!ctype_digit((string) $constraint->maxHeight)) {
123-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight));
120+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight));
124121
}
125122

126123
if ($height > $constraint->maxHeight) {
@@ -136,7 +133,7 @@ public function validate(mixed $value, Constraint $constraint): void
136133

137134
if (null !== $constraint->minPixels) {
138135
if (!ctype_digit((string) $constraint->minPixels)) {
139-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels));
136+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels));
140137
}
141138

142139
if ($pixels < $constraint->minPixels) {
@@ -152,7 +149,7 @@ public function validate(mixed $value, Constraint $constraint): void
152149

153150
if (null !== $constraint->maxPixels) {
154151
if (!ctype_digit((string) $constraint->maxPixels)) {
155-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels));
152+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels));
156153
}
157154

158155
if ($pixels > $constraint->maxPixels) {
@@ -170,7 +167,7 @@ public function validate(mixed $value, Constraint $constraint): void
170167

171168
if (null !== $constraint->minRatio) {
172169
if (!is_numeric((string) $constraint->minRatio)) {
173-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio.', $constraint->minRatio));
170+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum ratio.', $constraint->minRatio));
174171
}
175172

176173
if ($ratio < round($constraint->minRatio, 2)) {
@@ -184,7 +181,7 @@ public function validate(mixed $value, Constraint $constraint): void
184181

185182
if (null !== $constraint->maxRatio) {
186183
if (!is_numeric((string) $constraint->maxRatio)) {
187-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio.', $constraint->maxRatio));
184+
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum ratio.', $constraint->maxRatio));
188185
}
189186

190187
if ($ratio > round($constraint->maxRatio, 2)) {

src/Symfony/Component/Validator/Tests/Constraints/VideoTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Validator\Tests\Constraints;
413

514
use PHPUnit\Framework\TestCase;

src/Symfony/Component/Validator/Tests/Constraints/VideoValidatorTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Validator\Tests\Constraints;
413

514
use Symfony\Component\Validator\Constraints\Video;
@@ -84,7 +93,7 @@ public static function provideConstraintsWithNotFoundMessage(): iterable
8493
];
8594
}
8695

87-
public function testValidSize(): void
96+
public function testValidSize()
8897
{
8998
$constraint = new Video([
9099
'minWidth' => 1,

0 commit comments

Comments
 (0)