Skip to content

Commit 128a997

Browse files
committed
add test to ensure T_FN backfill is applied correctly
1 parent 71bed8b commit 128a997

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/Core/Tokenizer/AttributesTest.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function attribute_on_function_test() {}
2222
#[AttributeWithParams('foo', bar: ['bar' => 'foobar'])]
2323
function attribute_with_params_on_function_test() {}
2424

25+
/* testAttributeWithShortClosureParameter */
26+
#[AttributeWithParams(static fn ($value) => ! $value)]
27+
function attribute_with_short_closure_param_test() {}
28+
2529
/* testTwoAttributeOnTheSameLine */
2630
#[CustomAttribute] #[AttributeWithParams('foo')]
2731
function two_attribute_on_same_line_test() {}

tests/Core/Tokenizer/AttributesTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,28 @@ public function dataAttribute()
128128
T_CLOSE_PARENTHESIS,
129129
],
130130
],
131+
[
132+
'/* testAttributeWithShortClosureParameter */',
133+
17,
134+
[
135+
T_STRING,
136+
T_OPEN_PARENTHESIS,
137+
T_STATIC,
138+
T_WHITESPACE,
139+
T_FN,
140+
T_WHITESPACE,
141+
T_OPEN_PARENTHESIS,
142+
T_VARIABLE,
143+
T_CLOSE_PARENTHESIS,
144+
T_WHITESPACE,
145+
T_FN_ARROW,
146+
T_WHITESPACE,
147+
T_BOOLEAN_NOT,
148+
T_WHITESPACE,
149+
T_VARIABLE,
150+
T_CLOSE_PARENTHESIS,
151+
],
152+
],
131153
[
132154
'/* testAttributeGrouping */',
133155
26,

0 commit comments

Comments
 (0)