Skip to content

Commit

Permalink
Add test for multiline attributes for MissingDocblockSniff on methods…
Browse files Browse the repository at this point in the history
… outside of classes
  • Loading branch information
ziegenberg committed Sep 19, 2024
1 parent 89ff0ac commit 6d83352
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
9 changes: 5 additions & 4 deletions moodle/Tests/Sniffs/Commenting/MissingDocblockSniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,11 @@ public static function docblockCorrectnessProvider(): array {
'fixture' => 'docblock_with_multiline_attributes',
'fixtureFilename' => null,
'errors' => [
59 => 'Missing docblock for class class_multiline_attribute_space_between',
69 => 'Missing docblock for function method_multiline_attribute_space_between',
81 => 'Missing docblock for interface interface_multiline_attribute_space_between',
92 => 'Missing docblock for trait trait_multiline_attribute_space_between',
69 => 'Missing docblock for class class_multiline_attribute_space_between',
79 => 'Missing docblock for function method_multiline_attribute_space_between',
91 => 'Missing docblock for function single_method_multiline_attribute_space_between',
102 => 'Missing docblock for interface interface_multiline_attribute_space_between',
113 => 'Missing docblock for trait trait_multiline_attribute_space_between',
],
'warnings' => [],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ function method_multiline_attribute(): void {
}
}

/*
* Function with multiline attributes.
*/
#[someattribute(
attr1: 'asdf',
attr2: 'asdf',
)]
function single_method_multiline_attribute(): void {
}

/**
* Interface with multiline attributes.
*/
Expand Down Expand Up @@ -70,6 +80,17 @@ function method_multiline_attribute_space_between(): void {
}
}

/*
* Function with multiline attributes and space between.
*/

#[someattribute(
attr1: 'asdf',
attr2: 'asdf',
)]
function single_method_multiline_attribute_space_between(): void {
}

/**
* Interface with multiline attributes.
*/
Expand Down

0 comments on commit 6d83352

Please sign in to comment.