Skip to content

Commit 5c68ed9

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: add validator translation 99 for Italian language stop using the deprecated at() PHPUnit matcher Fix typehint phpdoc
2 parents cd93eea + 2df5c9b commit 5c68ed9

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
@@ -78,14 +78,13 @@ public function testCreateFromChoicesGroupedChoices()
7878
$list1 = new ArrayChoiceList([]);
7979
$list2 = new ArrayChoiceList([]);
8080

81-
$this->decoratedFactory->expects($this->at(0))
81+
$this->decoratedFactory->expects($this->exactly(2))
8282
->method('createListFromChoices')
83-
->with($choices1)
84-
->willReturn($list1);
85-
$this->decoratedFactory->expects($this->at(1))
86-
->method('createListFromChoices')
87-
->with($choices2)
88-
->willReturn($list2);
83+
->withConsecutive(
84+
[$choices1],
85+
[$choices2]
86+
)
87+
->willReturnOnConsecutiveCalls($list1, $list2);
8988

9089
$this->assertSame($list1, $this->factory->createListFromChoices($choices1));
9190
$this->assertSame($list2, $this->factory->createListFromChoices($choices2));
@@ -119,14 +118,13 @@ public function testCreateFromChoicesDifferentChoices($choice1, $choice2)
119118
$list1 = new ArrayChoiceList([]);
120119
$list2 = new ArrayChoiceList([]);
121120

122-
$this->decoratedFactory->expects($this->at(0))
123-
->method('createListFromChoices')
124-
->with($choices1)
125-
->willReturn($list1);
126-
$this->decoratedFactory->expects($this->at(1))
121+
$this->decoratedFactory->expects($this->exactly(2))
127122
->method('createListFromChoices')
128-
->with($choices2)
129-
->willReturn($list2);
123+
->withConsecutive(
124+
[$choices1],
125+
[$choices2]
126+
)
127+
->willReturnOnConsecutiveCalls($list1, $list2);
130128

131129
$this->assertSame($list1, $this->factory->createListFromChoices($choices1));
132130
$this->assertSame($list2, $this->factory->createListFromChoices($choices2));
@@ -177,14 +175,13 @@ public function testCreateFromChoicesDifferentValueClosure()
177175
$closure1 = function () {};
178176
$closure2 = function () {};
179177

180-
$this->decoratedFactory->expects($this->at(0))
181-
->method('createListFromChoices')
182-
->with($choices, $closure1)
183-
->willReturn($list1);
184-
$this->decoratedFactory->expects($this->at(1))
178+
$this->decoratedFactory->expects($this->exactly(2))
185179
->method('createListFromChoices')
186-
->with($choices, $closure2)
187-
->willReturn($list2);
180+
->withConsecutive(
181+
[$choices, $closure1],
182+
[$choices, $closure2]
183+
)
184+
->willReturnOnConsecutiveCalls($list1, $list2);
188185

189186
$this->assertSame($list1, $this->factory->createListFromChoices($choices, $closure1));
190187
$this->assertSame($list2, $this->factory->createListFromChoices($choices, $closure2));
@@ -292,14 +289,13 @@ public function testCreateFromLoaderDifferentLoader()
292289
$list1 = new ArrayChoiceList([]);
293290
$list2 = new ArrayChoiceList([]);
294291

295-
$this->decoratedFactory->expects($this->at(0))
296-
->method('createListFromLoader')
297-
->with($loader1)
298-
->willReturn($list1);
299-
$this->decoratedFactory->expects($this->at(1))
292+
$this->decoratedFactory->expects($this->exactly(2))
300293
->method('createListFromLoader')
301-
->with($loader2)
302-
->willReturn($list2);
294+
->withConsecutive(
295+
[$loader1],
296+
[$loader2]
297+
)
298+
->willReturnOnConsecutiveCalls($list1, $list2);
303299

304300
$this->assertSame($list1, $this->factory->createListFromLoader($loader1));
305301
$this->assertSame($list2, $this->factory->createListFromLoader($loader2));
@@ -360,14 +356,13 @@ public function testCreateFromLoaderDifferentValueClosure()
360356
$closure1 = function () {};
361357
$closure2 = function () {};
362358

363-
$this->decoratedFactory->expects($this->at(0))
359+
$this->decoratedFactory->expects($this->exactly(2))
364360
->method('createListFromLoader')
365-
->with($loader, $closure1)
366-
->willReturn($list1);
367-
$this->decoratedFactory->expects($this->at(1))
368-
->method('createListFromLoader')
369-
->with($loader, $closure2)
370-
->willReturn($list2);
361+
->withConsecutive(
362+
[$loader, $closure1],
363+
[$loader, $closure2]
364+
)
365+
->willReturnOnConsecutiveCalls($list1, $list2);
371366

372367
$this->assertSame($list1, $this->factory->createListFromLoader(ChoiceList::loader($type, $loader), $closure1));
373368
$this->assertSame($list2, $this->factory->createListFromLoader(ChoiceList::loader($type, $this->createMock(ChoiceLoaderInterface::class)), $closure2));
@@ -490,14 +485,13 @@ public function testCreateViewDifferentPreferredChoices()
490485
$view1 = new ChoiceListView();
491486
$view2 = new ChoiceListView();
492487

493-
$this->decoratedFactory->expects($this->at(0))
494-
->method('createView')
495-
->with($list, $preferred1)
496-
->willReturn($view1);
497-
$this->decoratedFactory->expects($this->at(1))
488+
$this->decoratedFactory->expects($this->exactly(2))
498489
->method('createView')
499-
->with($list, $preferred2)
500-
->willReturn($view2);
490+
->withConsecutive(
491+
[$list, $preferred1],
492+
[$list, $preferred2]
493+
)
494+
->willReturnOnConsecutiveCalls($view1, $view2);
501495

502496
$this->assertSame($view1, $this->factory->createView($list, $preferred1));
503497
$this->assertSame($view2, $this->factory->createView($list, $preferred2));
@@ -550,14 +544,13 @@ public function testCreateViewDifferentPreferredChoicesClosure()
550544
$view1 = new ChoiceListView();
551545
$view2 = new ChoiceListView();
552546

553-
$this->decoratedFactory->expects($this->at(0))
554-
->method('createView')
555-
->with($list, $preferred1)
556-
->willReturn($view1);
557-
$this->decoratedFactory->expects($this->at(1))
547+
$this->decoratedFactory->expects($this->exactly(2))
558548
->method('createView')
559-
->with($list, $preferred2)
560-
->willReturn($view2);
549+
->withConsecutive(
550+
[$list, $preferred1],
551+
[$list, $preferred2]
552+
)
553+
->willReturnOnConsecutiveCalls($view1, $view2);
561554

562555
$this->assertSame($view1, $this->factory->createView($list, $preferred1));
563556
$this->assertSame($view2, $this->factory->createView($list, $preferred2));
@@ -610,14 +603,13 @@ public function testCreateViewDifferentLabelClosure()
610603
$view1 = new ChoiceListView();
611604
$view2 = new ChoiceListView();
612605

613-
$this->decoratedFactory->expects($this->at(0))
614-
->method('createView')
615-
->with($list, null, $labels1)
616-
->willReturn($view1);
617-
$this->decoratedFactory->expects($this->at(1))
606+
$this->decoratedFactory->expects($this->exactly(2))
618607
->method('createView')
619-
->with($list, null, $labels2)
620-
->willReturn($view2);
608+
->withConsecutive(
609+
[$list, null, $labels1],
610+
[$list, null, $labels2]
611+
)
612+
->willReturnOnConsecutiveCalls($view1, $view2);
621613

622614
$this->assertSame($view1, $this->factory->createView($list, null, $labels1));
623615
$this->assertSame($view2, $this->factory->createView($list, null, $labels2));
@@ -670,14 +662,13 @@ public function testCreateViewDifferentIndexClosure()
670662
$view1 = new ChoiceListView();
671663
$view2 = new ChoiceListView();
672664

673-
$this->decoratedFactory->expects($this->at(0))
674-
->method('createView')
675-
->with($list, null, null, $index1)
676-
->willReturn($view1);
677-
$this->decoratedFactory->expects($this->at(1))
665+
$this->decoratedFactory->expects($this->exactly(2))
678666
->method('createView')
679-
->with($list, null, null, $index2)
680-
->willReturn($view2);
667+
->withConsecutive(
668+
[$list, null, null, $index1],
669+
[$list, null, null, $index2]
670+
)
671+
->willReturnOnConsecutiveCalls($view1, $view2);
681672

682673
$this->assertSame($view1, $this->factory->createView($list, null, null, $index1));
683674
$this->assertSame($view2, $this->factory->createView($list, null, null, $index2));
@@ -730,14 +721,13 @@ public function testCreateViewDifferentGroupByClosure()
730721
$view1 = new ChoiceListView();
731722
$view2 = new ChoiceListView();
732723

733-
$this->decoratedFactory->expects($this->at(0))
734-
->method('createView')
735-
->with($list, null, null, null, $groupBy1)
736-
->willReturn($view1);
737-
$this->decoratedFactory->expects($this->at(1))
724+
$this->decoratedFactory->expects($this->exactly(2))
738725
->method('createView')
739-
->with($list, null, null, null, $groupBy2)
740-
->willReturn($view2);
726+
->withConsecutive(
727+
[$list, null, null, null, $groupBy1],
728+
[$list, null, null, null, $groupBy2]
729+
)
730+
->willReturnOnConsecutiveCalls($view1, $view2);
741731

742732
$this->assertSame($view1, $this->factory->createView($list, null, null, null, $groupBy1));
743733
$this->assertSame($view2, $this->factory->createView($list, null, null, null, $groupBy2));
@@ -789,14 +779,13 @@ public function testCreateViewDifferentAttributes()
789779
$view1 = new ChoiceListView();
790780
$view2 = new ChoiceListView();
791781

792-
$this->decoratedFactory->expects($this->at(0))
793-
->method('createView')
794-
->with($list, null, null, null, null, $attr1)
795-
->willReturn($view1);
796-
$this->decoratedFactory->expects($this->at(1))
782+
$this->decoratedFactory->expects($this->exactly(2))
797783
->method('createView')
798-
->with($list, null, null, null, null, $attr2)
799-
->willReturn($view2);
784+
->withConsecutive(
785+
[$list, null, null, null, null, $attr1],
786+
[$list, null, null, null, null, $attr2]
787+
)
788+
->willReturnOnConsecutiveCalls($view1, $view2);
800789

801790
$this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1));
802791
$this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2));
@@ -848,14 +837,13 @@ public function testCreateViewDifferentAttributesClosure()
848837
$view1 = new ChoiceListView();
849838
$view2 = new ChoiceListView();
850839

851-
$this->decoratedFactory->expects($this->at(0))
852-
->method('createView')
853-
->with($list, null, null, null, null, $attr1)
854-
->willReturn($view1);
855-
$this->decoratedFactory->expects($this->at(1))
840+
$this->decoratedFactory->expects($this->exactly(2))
856841
->method('createView')
857-
->with($list, null, null, null, null, $attr2)
858-
->willReturn($view2);
842+
->withConsecutive(
843+
[$list, null, null, null, null, $attr1],
844+
[$list, null, null, null, null, $attr2]
845+
)
846+
->willReturnOnConsecutiveCalls($view1, $view2);
859847

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

0 commit comments

Comments
 (0)