Skip to content

Commit 681f43e

Browse files
authored
Merge pull request #363 from PHPCSStandards/feature/universal-duplicatearraykey-add-extra-tests
Universal/DuplicateArrayKey: add extra tests
2 parents dbd25d3 + a823896 commit 681f43e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Universal/Tests/Arrays/DuplicateArrayKeyUnitTest.inc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ $everythingZero = [
5454
0. => 'r',
5555
.0 => 's',
5656
(true) ? 0 : 1 => 't',
57-
! true => 'u',
57+
! \true => 'u',
5858
];
5959

6060
$everythingOne = [
@@ -80,7 +80,7 @@ $everythingOne = [
8080
1. => 'q',
8181
001. => 'r',
8282
(true) ? 1 : 0 => 's',
83-
! false => 't',
83+
! \false => 't',
8484
(string) true => 'u',
8585
];
8686

@@ -165,3 +165,13 @@ $testPHPLt8VsPHP8 = array(
165165
1 => 'j', // Duplicate in PHP < 8, not in PHP 8.
166166
2 => 'k', // Duplicate in PHP < 8, not in PHP 8.
167167
);
168+
169+
// Issue PHPCSExtra#316, PHPCSStandards/PHPCSUtils#619 no false positive for numeric string keys starting/ending with an underscore.
170+
$validStringKeys = array(
171+
'_1' => 'value1',
172+
'_2' => 'value2',
173+
'3_' => 'value3',
174+
'4_' => 'value4',
175+
'_5_' => 'value5',
176+
'_6_' => 'value6',
177+
);

0 commit comments

Comments
 (0)