@@ -85,22 +85,20 @@ public function testFileNotFound(Video $constraint)
85
85
86
86
public static function provideConstraintsWithNotFoundMessage (): iterable
87
87
{
88
- yield 'Doctrine style ' => [new Video ([
89
- 'notFoundMessage ' => 'myMessage ' ,
90
- ])];
88
+ yield 'Doctrine style ' => [new Video (notFoundMessage: 'myMessage ' )];
91
89
yield 'Named arguments ' => [
92
90
new Video (notFoundMessage: 'myMessage ' ),
93
91
];
94
92
}
95
93
96
94
public function testValidSize ()
97
95
{
98
- $ constraint = new Video ([
99
- ' minWidth ' => 1 ,
100
- ' maxWidth ' => 2 ,
101
- ' minHeight ' => 1 ,
102
- ' maxHeight ' => 2 ,
103
- ] );
96
+ $ constraint = new Video (
97
+ minWidth: 1 ,
98
+ maxWidth: 2 ,
99
+ minHeight: 1 ,
100
+ maxHeight: 2 ,
101
+ );
104
102
105
103
$ this ->validator ->validate ($ this ->video , $ constraint );
106
104
@@ -123,10 +121,10 @@ public function testWidthTooSmall(Video $constraint)
123
121
124
122
public static function provideMinWidthConstraints (): iterable
125
123
{
126
- yield 'Doctrine style ' => [new Video ([
127
- ' minWidth ' => 3 ,
128
- ' minWidthMessage ' => 'myMessage ' ,
129
- ] )];
124
+ yield 'Doctrine style ' => [new Video (
125
+ minWidth: 3 ,
126
+ minWidthMessage: 'myMessage ' ,
127
+ )];
130
128
yield 'Named arguments ' => [
131
129
new Video (minWidth: 3 , minWidthMessage: 'myMessage ' ),
132
130
];
@@ -148,10 +146,10 @@ public function testWidthTooBig(Video $constraint)
148
146
149
147
public static function provideMaxWidthConstraints (): iterable
150
148
{
151
- yield 'Doctrine style ' => [new Video ([
152
- ' maxWidth ' => 1 ,
153
- ' maxWidthMessage ' => 'myMessage ' ,
154
- ] )];
149
+ yield 'Doctrine style ' => [new Video (
150
+ maxWidth: 1 ,
151
+ maxWidthMessage: 'myMessage ' ,
152
+ )];
155
153
yield 'Named arguments ' => [
156
154
new Video (maxWidth: 1 , maxWidthMessage: 'myMessage ' ),
157
155
];
@@ -173,10 +171,10 @@ public function testHeightTooSmall(Video $constraint)
173
171
174
172
public static function provideMinHeightConstraints (): iterable
175
173
{
176
- yield 'Doctrine style ' => [new Video ([
177
- ' minHeight ' => 3 ,
178
- ' minHeightMessage ' => 'myMessage ' ,
179
- ] )];
174
+ yield 'Doctrine style ' => [new Video (
175
+ minHeight: 3 ,
176
+ minHeightMessage: 'myMessage ' ,
177
+ )];
180
178
yield 'Named arguments ' => [
181
179
new Video (minHeight: 3 , minHeightMessage: 'myMessage ' ),
182
180
];
@@ -198,10 +196,10 @@ public function testHeightTooBig(Video $constraint)
198
196
199
197
public static function provideMaxHeightConstraints (): iterable
200
198
{
201
- yield 'Doctrine style ' => [new Video ([
202
- ' maxHeight ' => 1 ,
203
- ' maxHeightMessage ' => 'myMessage ' ,
204
- ] )];
199
+ yield 'Doctrine style ' => [new Video (
200
+ maxHeight: 1 ,
201
+ maxHeightMessage: 'myMessage ' ,
202
+ )];
205
203
yield 'Named arguments ' => [
206
204
new Video (maxHeight: 1 , maxHeightMessage: 'myMessage ' ),
207
205
];
@@ -225,10 +223,10 @@ public function testPixelsTooFew(Video $constraint)
225
223
226
224
public static function provideMinPixelsConstraints (): iterable
227
225
{
228
- yield 'Doctrine style ' => [new Video ([
229
- ' minPixels ' => 5 ,
230
- ' minPixelsMessage ' => 'myMessage ' ,
231
- ] )];
226
+ yield 'Doctrine style ' => [new Video (
227
+ minPixels: 5 ,
228
+ minPixelsMessage: 'myMessage ' ,
229
+ )];
232
230
yield 'Named arguments ' => [
233
231
new Video (minPixels: 5 , minPixelsMessage: 'myMessage ' ),
234
232
];
@@ -252,10 +250,10 @@ public function testPixelsTooMany(Video $constraint)
252
250
253
251
public static function provideMaxPixelsConstraints (): iterable
254
252
{
255
- yield 'Doctrine style ' => [new Video ([
256
- ' maxPixels ' => 3 ,
257
- ' maxPixelsMessage ' => 'myMessage ' ,
258
- ] )];
253
+ yield 'Doctrine style ' => [new Video (
254
+ maxPixels: 3 ,
255
+ maxPixelsMessage: 'myMessage ' ,
256
+ )];
259
257
yield 'Named arguments ' => [
260
258
new Video (maxPixels: 3 , maxPixelsMessage: 'myMessage ' ),
261
259
];
@@ -277,10 +275,10 @@ public function testRatioTooSmall(Video $constraint)
277
275
278
276
public static function provideMinRatioConstraints (): iterable
279
277
{
280
- yield 'Doctrine style ' => [new Video ([
281
- ' minRatio ' => 2 ,
282
- ' minRatioMessage ' => 'myMessage ' ,
283
- ] )];
278
+ yield 'Doctrine style ' => [new Video (
279
+ minRatio: 2 ,
280
+ minRatioMessage: 'myMessage ' ,
281
+
F987
)];
284
282
yield 'Named arguments ' => [
285
283
new Video (minRatio: 2 , minRatioMessage: 'myMessage ' ),
286
284
];
@@ -302,20 +300,18 @@ public function testRatioTooBig(Video $constraint)
302
300
303
301
public static function provideMaxRatioConstraints (): iterable
304
302
{
305
- yield 'Doctrine style ' => [new Video ([
306
- ' maxRatio ' => 0.5 ,
307
- ' maxRatioMessage ' => 'myMessage ' ,
308
- ] )];
303
+ yield 'Doctrine style ' => [new Video (
304
+ maxRatio: 0.5 ,
305
+ maxRatioMessage: 'myMessage ' ,
306
+ )];
309
307
yield 'Named arguments ' => [
310
308
new Video (maxRatio: 0.5 , maxRatioMessage: 'myMessage ' ),
311
309
];
312
310
}
313
311
314
312
public function testMaxRatioUsesTwoDecimalsOnly ()
315
313
{
316
- $ constraint = new Video ([
317
- 'maxRatio ' => 1.33 ,
318
- ]);
314
+ $ constraint = new Video (maxRatio: 1.33 );
319
315
320
316
$ this ->validator ->validate ($ this ->video4By3 , $ constraint );
321
317
@@ -324,9 +320,7 @@ public function testMaxRatioUsesTwoDecimalsOnly()
324
320
325
321
public function testMinRatioUsesInputMoreDecimals ()
326
322
{
327
- $ constraint = new Video ([
328
- 'minRatio ' => 4 / 3 ,
329
- ]);
323
+ $ constraint = new Video (minRatio: 4 / 3 );
330
324
331
325
$ this ->validator ->validate ($ this ->video4By3 , $ constraint );
332
326
@@ -335,9 +329,7 @@ public function testMinRatioUsesInputMoreDecimals()
335
329
336
330
public function testMaxRatioUsesInputMoreDecimals ()
337
331
{
338
- $ constraint = new Video
1241
([
339
- 'maxRatio ' => 16 / 9 ,
340
- ]);
332
+ $ constraint = new Video (maxRatio: 16 / 9 );
341
333
342
334
$ this ->validator ->validate ($ this ->video16By9 , $ constraint );
343
335
@@ -360,10 +352,10 @@ public function testSquareNotAllowed(Video $constraint)
360
352
361
353
public static function provideAllowSquareConstraints (): iterable
362
354
{
363
- yield 'Doctrine style ' => [new Video ([
364
- ' allowSquare ' => false ,
365
- ' allowSquareMessage ' => 'myMessage ' ,
366
- ] )];
355
+ yield 'Doctrine style ' => [new Video (
356
+ allowSquare: false ,
357
+ allowSquareMessage: 'myMessage ' ,
358
+ )];
367
359
yield 'Named arguments ' => [
368
360
new Video (allowSquare: false , allowSquareMessage: 'myMessage ' ),
369
361
];
@@ -385,10 +377,10 @@ public function testLandscapeNotAllowed(Video $constraint)
385
377
386
378
public static function provideAllowLandscapeConstraints (): iterable
387
379
{
388
- yield 'Doctrine style ' => [new Video ([
389
- ' allowLandscape ' => false ,
390
- ' allowLandscapeMessage ' => 'myMessage ' ,
391
- ] )];
380
+ yield 'Doctrine style ' => [new Video (
381
+ allowLandscape: false ,
382
+ allowLandscapeMessage: 'myMessage ' ,
383
+ )];
392
384
yield 'Named arguments ' => [
393
385
new Video (allowLandscape: false , allowLandscapeMessage: 'myMessage ' ),
394
386
];
@@ -410,20 +402,18 @@ public function testPortraitNotAllowed(Video $constraint)
410
402
411
403
public static function provideAllowPortraitConstraints (): iterable
412
404
{
413
- yield 'Doctrine style ' => [new Video ([
414
- ' allowPortrait ' => false ,
415
- ' allowPortraitMessage ' => 'myMessage ' ,
416
- ] )];
405
+ yield 'Doctrine style ' => [new Video (
406
+ allowPortrait: false ,
407
+ allowPortraitMessage: 'myMessage ' ,
408
+ )];
417
409
yield 'Named arguments ' => [
418
410
new Video (allowPortrait: false , allowPortraitMessage: 'myMessage ' ),
419
411
];
420
412
}
421
413
422
414
public function testCorrupted ()
423
415
{
424
- $ constraint = new Video ([
425
- 'maxRatio ' => 1 ,
426
- ]);
416
+ $ constraint = new Video (maxRatio: 1 );
427
417
428
418
$ this ->validator ->validate ($ this ->videoCorrupted , $ constraint );
429
419
@@ -466,12 +456,12 @@ public function testInvalidMimeTypeWithNarrowedSet(Video $constraint)
466
456
467
457
public static function provideInvalidMimeTypeWithNarrowedSet ()
468
458
{
469
- yield 'Doctrine style ' => [new Video ([
470
- ' mimeTypes ' => [
459
+ yield 'Doctrine style ' => [new Video (
460
+ mimeTypes: [
471
461
'video/mkv ' ,
472
462
'video/mov ' ,
473
463
],
474
- ] )];
464
+ )];
475
465
yield 'Named arguments ' => [
476
466
new Video (mimeTypes: [
477
467
'video/mkv ' ,
0 commit comments