Skip to content

Commit 4ed19a7

Browse files
committed
chore: update and fix interfaces generator
1 parent aa317b2 commit 4ed19a7

6 files changed

Lines changed: 148 additions & 84 deletions

bin/console

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ require __DIR__ . '/../vendor/autoload.php';
1111

1212
$app = new Application();
1313

14-
$app->add(new CreateStaticValidatorInterfaceCommand());
15-
$app->add(new CreateChainedValidatorInterfaceCommand());
16-
$app->add(new CreateValidatorInterfacesCommand());
14+
$app->addCommand(new CreateStaticValidatorInterfaceCommand());
15+
$app->addCommand(new CreateChainedValidatorInterfaceCommand());
16+
$app->addCommand(new CreateValidatorInterfacesCommand());
1717

1818
$app->run();

src/ChainedValidatorInterface.php

Lines changed: 70 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
interface ChainedValidatorInterface
66
{
77
public function all(
8-
mixed $constraints = null,
8+
\Symfony\Component\Validator\Constraint|array|null $constraints = null,
99
?array $groups = null,
1010
mixed $payload = null,
1111
): ChainedValidatorInterface&Validator;
1212

1313
public function atLeastOneOf(
14-
mixed $constraints = null,
14+
\Symfony\Component\Validator\Constraint|array|null $constraints = null,
1515
?array $groups = null,
1616
mixed $payload = null,
1717
?string $message = null,
@@ -38,23 +38,20 @@ public function blank(
3838
): ChainedValidatorInterface&Validator;
3939

4040
public function callback(
41-
callable|array|string|null $callback = null,
41+
callable|string|null $callback = null,
4242
?array $groups = null,
4343
mixed $payload = null,
44-
?array $options = null,
4544
): ChainedValidatorInterface&Validator;
4645

4746
public function cardScheme(
4847
array|string|null $schemes,
4948
?string $message = null,
5049
?array $groups = null,
5150
mixed $payload = null,
52-
?array $options = null,
5351
): ChainedValidatorInterface&Validator;
5452

5553
public function cascade(
5654
array|string|null $exclude = null,
57-
?array $options = null,
5855
): ChainedValidatorInterface&Validator;
5956

6057
public function charset(
@@ -65,7 +62,7 @@ public function charset(
6562
): ChainedValidatorInterface&Validator;
6663

6764
public function choice(
68-
array|string $options = [],
65+
array|string|null $options = null,
6966
?array $choices = null,
7067
callable|string|null $callback = null,
7168
?bool $multiple = null,
@@ -93,7 +90,7 @@ public function cidr(
9390
): ChainedValidatorInterface&Validator;
9491

9592
public function collection(
96-
mixed $fields = null,
93+
?array $fields = null,
9794
?array $groups = null,
9895
mixed $payload = null,
9996
?bool $allowExtraFields = null,
@@ -103,7 +100,7 @@ public function collection(
103100
): ChainedValidatorInterface&Validator;
104101

105102
public function count(
106-
array|int|null $exactly = null,
103+
?int $exactly = null,
107104
?int $min = null,
108105
?int $max = null,
109106
?int $divisibleBy = null,
@@ -113,7 +110,6 @@ public function count(
113110
?string $divisibleByMessage = null,
114111
?array $groups = null,
115112
mixed $payload = null,
116-
?array $options = null,
117113
): ChainedValidatorInterface&Validator;
118114

119115
public function country(
@@ -129,7 +125,6 @@ public function cssColor(
129125
?string $message = null,
130126
?array $groups = null,
131127
$payload = null,
132-
?array $options = null,
133128
): ChainedValidatorInterface&Validator;
134129

135130
public function currency(
@@ -147,11 +142,10 @@ public function date(
147142
): ChainedValidatorInterface&Validator;
148143

149144
public function dateTime(
150-
array|string|null $format = null,
145+
?string $format = null,
151146
?string $message = null,
152147
?array $groups = null,
153148
mixed $payload = null,
154-
?array $options = null,
155149
): ChainedValidatorInterface&Validator;
156150

157151
public function disableAutoMapping(
@@ -165,7 +159,6 @@ public function divisibleBy(
165159
?string $message = null,
166160
?array $groups = null,
167161
mixed $payload = null,
168-
?array $options = null,
169162
): ChainedValidatorInterface&Validator;
170163

171164
public function email(
@@ -188,11 +181,10 @@ public function equalTo(
188181
?string $message = null,
189182
?array $groups = null,
190183
mixed $payload = null,
191-
?array $options = null,
192184
): ChainedValidatorInterface&Validator;
193185

194186
public function expression(
195-
\Symfony\Component\ExpressionLanguage\Expression|array|string|null $expression,
187+
\Symfony\Component\ExpressionLanguage\Expression|string|null $expression,
196188
?string $message = null,
197189
?array $values = null,
198190
?array $groups = null,
@@ -245,7 +237,6 @@ public function greaterThan(
245237
?string $message = null,
246238
?array $groups = null,
247239
mixed $payload = null,
248-
?array $options = null,
249240
): ChainedValidatorInterface&Validator;
250241

251242
public function greaterThanOrEqual(
@@ -254,7 +245,6 @@ public function greaterThanOrEqual(
254245
?string $message = null,
255246
?array $groups = null,
256247
mixed $payload = null,
257-
?array $options = null,
258248
): ChainedValidatorInterface&Validator;
259249

260250
public function hostname(
@@ -278,7 +268,6 @@ public function identicalTo(
278268
?string $message = null,
279269
?array $groups = null,
280270
mixed $payload = null,
281-
?array $options = null,
282271
): ChainedValidatorInterface&Validator;
283272

284273
public function image(
@@ -366,14 +355,13 @@ public function isTrue(
366355
): ChainedValidatorInterface&Validator;
367356

368357
public function isbn(
369-
array|string|null $type = null,
358+
?string $type = null,
370359
?string $message = null,
371360
?string $isbn10Message = null,
372361
?string $isbn13Message = null,
373362
?string $bothIsbnMessage = null,
374363
?array $groups = null,
375364
mixed $payload = null,
376-
?array $options = null,
377365
): ChainedValidatorInterface&Validator;
378366

379367
public function isin(
@@ -408,7 +396,7 @@ public function language(
408396
): ChainedValidatorInterface&Validator;
409397

410398
public function length(
411-
array|int|null $exactly = null,
399+
?int $exactly = null,
412400
?int $min = null,
413401
?int $max = null,
414402
?string $charset = null,
@@ -420,7 +408,6 @@ public function length(
420408
?string $charsetMessage = null,
421409
?array $groups = null,
422410
mixed $payload = null,
423-
?array $options = null,
424411
): ChainedValidatorInterface&Validator;
425412

426413
public function lessThan(
@@ -429,7 +416,6 @@ public function lessThan(
429416
?string $message = null,
430417
?array $groups = null,
431418
mixed $payload = null,
432-
?array $options = null,
433419
): ChainedValidatorInterface&Validator;
434420

435421
public function lessThanOrEqual(
@@ -438,7 +424,6 @@ public function lessThanOrEqual(
438424
?string $message = null,
439425
?array $groups = null,
440426
mixed $payload = null,
441-
?array $options = null,
442427
): ChainedValidatorInterface&Validator;
443428

444429
public function locale(
@@ -515,7 +500,6 @@ public function notEqualTo(
515500
?string $message = null,
516501
?array $groups = null,
517502
mixed $payload = null,
518-
?array $options = null,
519503
): ChainedValidatorInterface&Validator;
520504

521505
public function notIdenticalTo(
@@ -524,7 +508,6 @@ public function notIdenticalTo(
524508
?string $message = null,
525509
?array $groups = null,
526510
mixed $payload = null,
527-
?array $options = null,
528511
): ChainedValidatorInterface&Validator;
529512

530513
public function notNull(
@@ -535,7 +518,7 @@ public function notNull(
535518
): ChainedValidatorInterface&Validator;
536519

537520
public function optional(
538-
mixed $options = null,
521+
\Symfony\Component\Validator\Constraint|array $constraints = [],
539522
?array $groups = null,
540523
mixed $payload = null,
541524
): ChainedValidatorInterface&Validator;
@@ -578,24 +561,23 @@ public function range(
578561
): ChainedValidatorInterface&Validator;
579562

580563
public function regex(
581-
array|string|null $pattern,
564+
?string $pattern,
582565
?string $message = null,
583566
?string $htmlPattern = null,
584567
?bool $match = null,
585568
?callable $normalizer = null,
586569
?array $groups = null,
587570
mixed $payload = null,
588-
?array $options = null,
589571
): ChainedValidatorInterface&Validator;
590572

591573
public function required(
592-
mixed $options = null,
574+
\Symfony\Component\Validator\Constraint|array $constraints = [],
593575
?array $groups = null,
594576
mixed $payload = null,
595577
): ChainedValidatorInterface&Validator;
596578

597579
public function sequentially(
598-
mixed $constraints = null,
580+
\Symfony\Component\Validator\Constraint|array|null $constraints = null,
599581
?array $groups = null,
600582
mixed $payload = null,
601583
): ChainedValidatorInterface&Validator;
@@ -609,17 +591,16 @@ public function time(
609591
): ChainedValidatorInterface&Validator;
610592

611593
public function timezone(
612-
array|int|null $zone = null,
594+
?int $zone = null,
613595
?string $message = null,
614596
?string $countryCode = null,
615597
?bool $intlCompatible = null,
616598
?array $groups = null,
617599
mixed $payload = null,
618-
?array $options = null,
619600
): ChainedValidatorInterface&Validator;
620601

621602
public function traverse(
622-
array|bool|null $traverse = null,
603+
?bool $traverse = null,
623604
mixed $payload = null,
624605
): ChainedValidatorInterface&Validator;
625606

@@ -628,7 +609,6 @@ public function type(
628609
?string $message = null,
629610
?array $groups = null,
630611
mixed $payload = null,
631-
?array $options = null,
632612
): ChainedValidatorInterface&Validator;
633613

634614
public function ulid(
@@ -653,7 +633,7 @@ public function unique(
653633
public function url(
654634
?array $options = null,
655635
?string $message = null,
656-
?array $protocols = null,
636+
array|string|null $protocols = null,
657637
?bool $relativeProtocol = null,
658638
?callable $normalizer = null,
659639
?array $groups = null,
@@ -679,6 +659,58 @@ public function valid(
679659
?bool $traverse = null,
680660
): ChainedValidatorInterface&Validator;
681661

662+
public function video(
663+
string|int|null $maxSize = null,
664+
?bool $binaryFormat = null,
665+
array|string|null $mimeTypes = null,
666+
?int $filenameMaxLength = null,
667+
?int $minWidth = null,
668+
?int $maxWidth = null,
669+
?int $maxHeight = null,
670+
?int $minHeight = null,
671+
int|float|null $maxRatio = null,
672+
int|float|null $minRatio = null,
673+
int|float|null $minPixels = null,
674+
int|float|null $maxPixels = null,
675+
?bool $allowSquare = null,
676+
?bool $allowLandscape = null,
677+
?bool $allowPortrait = null,
678+
?array $allowedCodecs = null,
679+
?array $allowedContainers = null,
680+
?string $notFoundMessage = null,
681+
?string $notReadableMessage = null,
682+
?string $maxSizeMessage = null,
683+
?string $mimeTypesMessage = null,
684+
?string $disallowEmptyMessage = null,
685+
?string $filenameTooLongMessage = null,
686+
?string $uploadIniSizeErrorMessage = null,
687+
?string $uploadFormSizeErrorMessage = null,
688+
?string $uploadPartialErrorMessage = null,
689+
?string $uploadNoFileErrorMessage = null,
690+
?string $uploadNoTmpDirErrorMessage = null,
691+
?string $uploadCantWriteErrorMessage = null,
692+
?string $uploadExtensionErrorMessage = null,
693+
?string $uploadErrorMessage = null,
694+
?string $sizeNotDetectedMessage = null,
695+
?string $maxWidthMessage = null,
696+
?string $minWidthMessage = null,
697+
?string $maxHeightMessage = null,
698+
?string $minHeightMessage = null,
699+
?string $minPixelsMessage = null,
700+
?string $maxPixelsMessage = null,
701+
?string $maxRatioMessage = null,
702+
?string $minRatioMessage = null,
703+
?string $allowSquareMessage = null,
704+
?string $allowLandscapeMessage = null,
705+
?string $allowPortraitMessage = null,
706+
?string $corruptedMessage = null,
707+
?string $multipleVideoStreamsMessage = null,
708+
?string $unsupportedCodecMessage = null,
709+
?string $unsupportedContainerMessage = null,
710+
?array $groups = null,
711+
mixed $payload = null,
712+
): ChainedValidatorInterface&Validator;
713+
682714
public function week(
683715
?string $min = null,
684716
?string $max = null,
@@ -691,7 +723,7 @@ public function week(
691723
): ChainedValidatorInterface&Validator;
692724

693725
public function when(
694-
\Symfony\Component\ExpressionLanguage\Expression|Closure|array|string $expression,
726+
\Symfony\Component\ExpressionLanguage\Expression|Closure|string $expression,
695727
\Symfony\Component\Validator\Constraint|array|null $constraints = null,
696728
?array $values = null,
697729
?array $groups = null,

src/Command/CreateChainedValidatorInterfaceCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public function execute(InputInterface $input, OutputInterface $output): int
2525
$packagePath = InstalledVersions::getInstallPath('symfony/validator');
2626
$constraintsPath = sprintf('%s/Constraints', $packagePath);
2727
$classes = Lister::instantiatableClassesInDirectory($constraintsPath);
28-
2928
$file = new InterfaceWriter('ChainedValidatorInterface');
29+
3030
$file->writeInterfaceStart();
3131

3232
foreach ($classes as $class) {

src/Command/CreateStaticValidatorInterfaceCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public function execute(InputInterface $input, OutputInterface $output): int
2525
$packagePath = InstalledVersions::getInstallPath('symfony/validator');
2626
$constraintsPath = sprintf('%s/Constraints', $packagePath);
2727
$classes = Lister::instantiatableClassesInDirectory($constraintsPath);
28-
2928
$file = new InterfaceWriter('StaticValidatorInterface');
29+
3030
$file->writeInterfaceStart();
3131

3232
foreach ($classes as $class) {

0 commit comments

Comments
 (0)