Skip to content

Commit acc55a9

Browse files
fix(ScopeIndent): Support PHP attributes (#3461148 by nicxvan)
1 parent 0fd66d3 commit acc55a9

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ public function process(File $phpcsFile, $stackPtr)
962962
T_OPEN_CURLY_BRACKET,
963963
T_COLON,
964964
T_OPEN_TAG,
965+
T_ATTRIBUTE_END,
965966
]
966967
) === false
967968
) {

tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,22 @@ $has_index_value_scalar['foo']['value'] = array (
203203
EXPECTED
204204
],
205205
];
206+
207+
/**
208+
* Test PHP attributes.
209+
*/
210+
class TestPhpAttributes {
211+
212+
/**
213+
* Bar property.
214+
*/
215+
#[NotBlank]
216+
private bool $bar;
217+
218+
/**
219+
* Tests method with PHP attribute and docblock.
220+
*/
221+
#[\ReturnTypeWillChange]
222+
public function attributes(): void {}
223+
224+
}

tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc.fixed

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,22 @@ $has_index_value_scalar['foo']['value'] = array (
215215
EXPECTED
216216
],
217217
];
218+
219+
/**
220+
* Test PHP attributes.
221+
*/
222+
class TestPhpAttributes {
223+
224+
/**
225+
* Bar property.
226+
*/
227+
#[NotBlank]
228+
private bool $bar;
229+
230+
/**
231+
* Tests method with PHP attribute and docblock.
232+
*/
233+
#[\ReturnTypeWillChange]
234+
public function attributes(): void {}
235+
236+
}

0 commit comments

Comments
 (0)