Skip to content

Commit f036961

Browse files
committed
Generic/DisallowLongArraySyntax: move an intentional parse error test
This commit moves an intentional parse error test to its own file. The parse error test does not trigger DisallowLongArraySyntaxSniff::process() as this sniff listen for T_ARRAY and the `array` keyword without parentheses is tokenized by PHPCS as T_STRING. Keeping the test as I'm not sure why it was introduced and it might protect against regressions in the future if things change in the tokenizer.
1 parent 30b3148 commit f036961

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.1.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ $foo = array(
1010
3
1111
);
1212
$var = array/*comment*/(1,2,3);
13-
$var = array;
1413

1514
function foo(array $array) {}
1615

src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.1.inc.fixed

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ $foo = [
1010
3
1111
];
1212
$var = /*comment*/[1,2,3];
13-
$var = array;
1413

1514
function foo(array $array) {}
1615

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
// Intentional parse error (long array syntax missing parentheses).
4+
// This should be the only test in this file.
5+
// Testing that the sniff is *not* triggered.
6+
7+
$var = array;

0 commit comments

Comments
 (0)