Skip to content

Commit 2df5c9b

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: add validator translation 99 for Italian language stop using the deprecated at() PHPUnit matcher Fix typehint phpdoc
2 parents 726b863 + 3255a36 commit 2df5c9b

File tree

5 files changed

+272
-272
lines changed

5 files changed

+272
-272
lines changed

Guess/Guess.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ abstract class Guess
6060
* If there are multiple guesses with the same, highest confidence, the
6161
* returned guess is any of them.
6262
*
63-
* @param Guess[] $guesses An array of guesses
63+
* @param static[] $guesses An array of guesses
6464
*
65-
* @return self|null
65+
* @return static|null
6666
*/
6767
public static function getBestGuess(array $guesses)
6868
{

Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php

Lines changed: 72 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ public function testCreateFromChoicesGroupedChoices()
7474
$list1 = new ArrayChoiceList([]);
7575
$list2 = new ArrayChoiceList([]);
7676

77-
$this->decoratedFactory->expects($this->at(0))
77+
$this->decoratedFactory->expects($this->exactly(2))
7878
->method('createListFromChoices')
79-
->with($choices1)
80-
->willReturn($list1);
81-
$this->decoratedFactory->expects($this->at(1))
82-
->method('createListFromChoices')
83-
->with($choices2)
84-
->willReturn($list2);
79+
->withConsecutive(
80+
[$choices1],
81+
[$choices2]
82+
)
83+
->willReturnOnConsecutiveCalls($list1, $list2);
8584

8685
$this->assertSame($list1, $this->factory->createListFromChoices($choices1));
8786
$this->assertSame($list2, $this->factory->createListFromChoices($choices2));
@@ -115,14 +114,13 @@ public function testCreateFromChoicesDifferentChoices($choice1, $choice2)
115114
$list1 = new ArrayChoiceList([]);
116115
$list2 = new ArrayChoiceList([]);
117116

118-
$this->decoratedFactory->expects($this->at(0))
119-
->method('createListFromChoices')
120-
->with($choices1)
121-
->willReturn($list1);
122-
$this->decoratedFactory->expects($this->at(1))
117+
$this->decoratedFactory->expects($this->exactly(2))
123118
->method('createListFromChoices')
124-
->with($choices2)
125-
->willReturn($list2);
119+
->withConsecutive(
120+
[$choices1],
121+
[$choices2]
122+
)
123+
->willReturnOnConsecutiveCalls($list1, $list2);
126124

127125
$this->assertSame($list1, $this->factory->createListFromChoices($choices1));
128126
$this->assertSame($list2, $this->factory->createListFromChoices($choices2));
@@ -151,14 +149,13 @@ public function testCreateFromChoicesDifferentValueClosure()
151149
$closure1 = function () {};
152150
$closure2 = function () {};
153151

154-
$this->decoratedFactory->expects($this->at(0))
152+
$this->decoratedFactory->expects($this->exactly(2))
155153
->method('createListFromChoices')
156-
->with($choices, $closure1)
157-
->willReturn($list1);
158-
$this->decoratedFactory->expects($this->at(1))
159-
->method('createListFromChoices')
160-
->with($choices, $closure2)
161-
->willReturn($list2);
154+
->withConsecutive(
155+
[$choices, $closure1],
156+
[$choices, $closure2]
157+
)
158+
->willReturnOnConsecutiveCalls($list1, $list2);
162159

163160
$this->assertSame($list1, $this->factory->createListFromChoices($choices, $closure1));
164161
$this->assertSame($list2, $this->factory->createListFromChoices($choices, $closure2));
@@ -185,14 +182,13 @@ public function testCreateFromLoaderDifferentLoader()
185182
$list1 = new ArrayChoiceList([]);
186183
$list2 = new ArrayChoiceList([]);
187184

188-
$this->decoratedFactory->expects($this->at(0))
189-
->method('createListFromLoader')
190-
->with($loader1)
191-
->willReturn($list1);
192-
$this->decoratedFactory->expects($this->at(1))
185+
$this->decoratedFactory->expects($this->exactly(2))
193186
->method('createListFromLoader')
194-
->with($loader2)
195-
->willReturn($list2);
187+
->withConsecutive(
188+
[$loader1],
189+
[$loader2]
190+
)
191+
->willReturnOnConsecutiveCalls($list1, $list2);
196192

197193
$this->assertSame($list1, $this->factory->createListFromLoader($loader1));
198194
$this->assertSame($list2, $this->factory->createListFromLoader($loader2));
@@ -221,14 +217,13 @@ public function testCreateFromLoaderDifferentValueClosure()
221217
$closure1 = function () {};
222218
$closure2 = function () {};
223219

224-
$this->decoratedFactory->expects($this->at(0))
220+
$this->decoratedFactory->expects($this->exactly(2))
225221
->method('createListFromLoader')
226-
->with($loader, $closure1)
227-
->willReturn($list1);
228-
$this->decoratedFactory->expects($this->at(1))
229-
->method('createListFromLoader')
230-
->with($loader, $closure2)
231-
->willReturn($list2);
222+
->withConsecutive(
223+
[$loader, $closure1],
224+
[$loader, $closure2]
225+
)
226+
->willReturnOnConsecutiveCalls($list1, $list2);
232227

233228
$this->assertSame($list1, $this->factory->createListFromLoader($loader, $closure1));
234229
$this->assertSame($list2, $this->factory->createListFromLoader($loader, $closure2));
@@ -257,14 +252,13 @@ public function testCreateViewDifferentPreferredChoices()
257252
$view1 = new ChoiceListView();
258253
$view2 = new ChoiceListView();
259254

260-
$this->decoratedFactory->expects($this->at(0))
261-
->method('createView')
262-
->with($list, $preferred1)
263-
->willReturn($view1);
264-
$this->decoratedFactory->expects($this->at(1))
255+
$this->decoratedFactory->expects($this->exactly(2))
265256
->method('createView')
266-
->with($list, $preferred2)
267-
->willReturn($view2);
257+
->withConsecutive(
258+
[$list, $preferred1],
259+
[$list, $preferred2]
260+
)
261+
->willReturnOnConsecutiveCalls($view1, $view2);
268262

269263
$this->assertSame($view1, $this->factory->createView($list, $preferred1));
270264
$this->assertSame($view2, $this->factory->createView($list, $preferred2));
@@ -293,14 +287,13 @@ public function testCreateViewDifferentPreferredChoicesClosure()
293287
$view1 = new ChoiceListView();
294288
$view2 = new ChoiceListView();
295289

296-
$this->decoratedFactory->expects($this->at(0))
290+
$this->decoratedFactory->expects($this->exactly(2))
297291
->method('createView')
298-
->with($list, $preferred1)
299-
->willReturn($view1);
300-
$this->decoratedFactory->expects($this->at(1))
301-
->method('createView')
302-
->with($list, $preferred2)
303-
->willReturn($view2);
292+
->withConsecutive(
293+
[$list, $preferred1],
294+
[$list, $preferred2]
295+
)
296+
->willReturnOnConsecutiveCalls($view1, $view2);
304297

305298
$this->assertSame($view1, $this->factory->createView($list, $preferred1));
306299
$this->assertSame($view2, $this->factory->createView($list, $preferred2));
@@ -329,14 +322,13 @@ public function testCreateViewDifferentLabelClosure()
329322
$view1 = new ChoiceListView();
330323
$view2 = new ChoiceListView();
331324

332-
$this->decoratedFactory->expects($this->at(0))
333-
->method('createView')
334-
->with($list, null, $labels1)
335-
->willReturn($view1);
336-
$this->decoratedFactory->expects($this->at(1))
325+
$this->decoratedFactory->expects($this->exactly(2))
337326
->method('createView')
338-
->with($list, null, $labels2)
339-
->willReturn($view2);
327+
->withConsecutive(
328+
[$list, null, $labels1],
329+
[$list, null, $labels2]
330+
)
331+
->willReturnOnConsecutiveCalls($view1, $view2);
340332

341333
$this->assertSame($view1, $this->factory->createView($list, null, $labels1));
342334
$this->assertSame($view2, $this->factory->createView($list, null, $labels2));
@@ -365,14 +357,13 @@ public function testCreateViewDifferentIndexClosure()
365357
$view1 = new ChoiceListView();
366358
$view2 = new ChoiceListView();
367359

368-
$this->decoratedFactory->expects($this->at(0))
360+
$this->decoratedFactory->expects($this->exactly(2))
369361
->method('createView')
370-
->with($list, null, null, $index1)
371-
->willReturn($view1);
372-
$this->decoratedFactory->expects($this->at(1))
373-
->method('createView')
374-
->with($list, null, null, $index2)
375-
->willReturn($view2);
362+
->withConsecutive(
363+
[$list, null, null, $index1],
364+
[$list, null, null, $index2]
365+
)
366+
->willReturnOnConsecutiveCalls($view1, $view2);
376367

377368
$this->assertSame($view1, $this->factory->createView($list, null, null, $index1));
378369
$this->assertSame($view2, $this->factory->createView($list, null, null, $index2));
@@ -401,14 +392,13 @@ public function testCreateViewDifferentGroupByClosure()
401392
$view1 = new ChoiceListView();
402393
$view2 = new ChoiceListView();
403394

404-
$this->decoratedFactory->expects($this->at(0))
405-
->method('createView')
406-
->with($list, null, null, null, $groupBy1)
407-
->willReturn($view1);
408-
$this->decoratedFactory->expects($this->at(1))
395+
$this->decoratedFactory->expects($this->exactly(2))
409396
->method('createView')
410-
->with($list, null, null, null, $groupBy2)
411-
->willReturn($view2);
397+
->withConsecutive(
398+
[$list, null, null, null, $groupBy1],
399+
[$list, null, null, null, $groupBy2]
400+
)
401+
->willReturnOnConsecutiveCalls($view1, $view2);
412402

413403
$this->assertSame($view1, $this->factory->createView($list, null, null, null, $groupBy1));
414404
$this->assertSame($view2, $this->factory->createView($list, null, null, null, $groupBy2));
@@ -437,14 +427,13 @@ public function testCreateViewDifferentAttributes()
437427
$view1 = new ChoiceListView();
438428
$view2 = new ChoiceListView();
439429

440-
$this->decoratedFactory->expects($this->at(0))
430+
$this->decoratedFactory->expects($this->exactly(2))
441431
->method('createView')
442-
->with($list, null, null, null, null, $attr1)
443-
->willReturn($view1);
444-
$this->decoratedFactory->expects($this->at(1))
445-
->method('createView')
446-
->with($list, null, null, null, null, $attr2)
447-
->willReturn($view2);
432+
->withConsecutive(
433+
[$list, null, null, null, null, $attr1],
434+
[$list, null, null, null, null, $attr2]
435+
)
436+
->willReturnOnConsecutiveCalls($view1, $view2);
448437

449438
$this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1));
450439
$this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2));
@@ -473,14 +462,13 @@ public function testCreateViewDifferentAttributesClosure()
473462
$view1 = new ChoiceListView();
474463
$view2 = new ChoiceListView();
475464

476-
$this->decoratedFactory->expects($this->at(0))
477-
->method('createView')
478-
->with($list, null, null, null, null, $attr1)
479-
->willReturn($view1);
480-
$this->decoratedFactory->expects($this->at(1))
465+
$this->decoratedFactory->expects($this->exactly(2))
481466
->method('createView')
482-
->with($list, null, null, null, null, $attr2)
483-
->willReturn($view2);
467+
->withConsecutive(
468+
[$list, null, null, null, null, $attr1],
469+
[$list, null, null, null, null, $attr2]
470+
)
471+
->willReturnOnConsecutiveCalls($view1, $view2);
484472

485473
$this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1));
486474
$this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2));

0 commit comments

Comments
 (0)