Skip to content

Commit dc6e814

Browse files
committed
Fix orList to be the same as in JS and follow the chicago style for commas
1 parent d92a2da commit dc6e814

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Utils/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ public static function orList(array $items)
500500
range(1, $selectedLength - 1),
501501
function ($list, $index) use ($selected, $selectedLength) {
502502
return $list.
503-
($selectedLength > 2 && $index !== $selectedLength - 1? ', ' : ' ') .
503+
($selectedLength > 2 ? ', ' : ' ') .
504504
($index === $selectedLength - 1 ? 'or ' : '') .
505505
$selected[$index];
506506
},

tests/Utils/QuotedOrListTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testReturnsTwoItemList()
4747
public function testReturnsCommaSeparatedManyItemList()
4848
{
4949
$this->assertEquals(
50-
'"A", "B" or "C"',
50+
'"A", "B", or "C"',
5151
Utils::quotedOrList(['A', 'B', 'C'])
5252
);
5353
}
@@ -58,7 +58,7 @@ public function testReturnsCommaSeparatedManyItemList()
5858
public function testLimitsToFiveItems()
5959
{
6060
$this->assertEquals(
61-
'"A", "B", "C", "D" or "E"',
61+
'"A", "B", "C", "D", or "E"',
6262
Utils::quotedOrList(['A', 'B', 'C', 'D', 'E', 'F'])
6363
);
6464
}

tests/Validator/FieldsOnCorrectTypeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public function testOnlyShowsOneSetOfSuggestionsAtATimePreferringTypes()
322322
public function testLimitsLotsOfTypeSuggestions()
323323
{
324324
$expected = 'Cannot query field "f" on type "T". ' .
325-
'Did you mean to use an inline fragment on "A", "B", "C", "D" or "E"?';
325+
'Did you mean to use an inline fragment on "A", "B", "C", "D", or "E"?';
326326

327327
$this->assertEquals($expected, FieldsOnCorrectType::undefinedFieldMessage(
328328
'f',
@@ -338,7 +338,7 @@ public function testLimitsLotsOfTypeSuggestions()
338338
public function testLimitsLotsOfFieldSuggestions()
339339
{
340340
$expected = 'Cannot query field "f" on type "T". ' .
341-
'Did you mean "z", "y", "x", "w" or "v"?';
341+
'Did you mean "z", "y", "x", "w", or "v"?';
342342

343343
$this->assertEquals($expected, FieldsOnCorrectType::undefinedFieldMessage(
344344
'f',

0 commit comments

Comments
 (0)