diff --git a/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php b/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php index 6da012ebe2459a5156355eee535fd2ca2757996d..f2b04020b95d5bb0dbf146a9474abddfe5baa94b 100644 --- a/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php @@ -962,6 +962,7 @@ class ScopeIndentSniff implements Sniff T_OPEN_CURLY_BRACKET, T_COLON, T_OPEN_TAG, + T_ATTRIBUTE_END, ] ) === false ) { diff --git a/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc b/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc index 582df387bf2b479a157ff78e51399dc3fd7b6fc4..7b753fd10fc0fb2a8b96f42685a72f62809df053 100644 --- a/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc +++ b/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc @@ -203,3 +203,22 @@ $has_index_value_scalar['foo']['value'] = array ( EXPECTED ], ]; + +/** + * Test PHP attributes. + */ +class TestPhpAttributes { + + /** + * Bar property. + */ + #[NotBlank] + private bool $bar; + + /** + * Tests method with PHP attribute and docblock. + */ + #[\ReturnTypeWillChange] + public function attributes(): void {} + +} diff --git a/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc.fixed b/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc.fixed index 4c74f205f0c497b01262f4cdbf6f2c8e9e2cbfbc..a1b3fa4d997dc9933526f435aa0980aa7bb42dd0 100644 --- a/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc.fixed +++ b/tests/Drupal/WhiteSpace/ScopeIndentUnitTest.inc.fixed @@ -215,3 +215,22 @@ $has_index_value_scalar['foo']['value'] = array ( EXPECTED ], ]; + +/** + * Test PHP attributes. + */ +class TestPhpAttributes { + + /** + * Bar property. + */ + #[NotBlank] + private bool $bar; + + /** + * Tests method with PHP attribute and docblock. + */ + #[\ReturnTypeWillChange] + public function attributes(): void {} + +}