diff --git a/moodle/Tests/Sniffs/Commenting/MissingDocblockSniffTest.php b/moodle/Tests/Sniffs/Commenting/MissingDocblockSniffTest.php index 8f007a1..0f92795 100644 --- a/moodle/Tests/Sniffs/Commenting/MissingDocblockSniffTest.php +++ b/moodle/Tests/Sniffs/Commenting/MissingDocblockSniffTest.php @@ -108,6 +108,23 @@ public static function docblockCorrectnessProvider(): array { 'fixtureFilename' => null, 'errors' => [ 13 => 'Missing docblock for class class_only_with_attributes_incorrect_whitespace', + 20 => 'Missing docblock for function method_only_with_attributes_incorrect_whitespace', + ], + 'warnings' => [], + ], + 'Interface only with attributes and incorrect whitespace' => [ + 'fixture' => 'interface_only_with_attributes_incorrect_whitespace', + 'fixtureFilename' => null, + 'errors' => [ + 13 => 'Missing docblock for interface interface_only_with_attributes_incorrect_whitespace', + ], + 'warnings' => [], + ], + 'Trait only with attributes and incorrect whitespace' => [ + 'fixture' => 'trait_only_with_attributes_incorrect_whitespace', + 'fixtureFilename' => null, + 'errors' => [ + 13 => 'Missing docblock for trait trait_only_with_attributes_incorrect_whitespace', ], 'warnings' => [], ], diff --git a/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/class_only_with_attributes_incorrect_whitespace.php b/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/class_only_with_attributes_incorrect_whitespace.php index 33c021e..6d50083 100644 --- a/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/class_only_with_attributes_incorrect_whitespace.php +++ b/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/class_only_with_attributes_incorrect_whitespace.php @@ -11,4 +11,12 @@ #[with_multiple_attributes, and_another_attribute] class class_only_with_attributes_incorrect_whitespace { + /** + * Method level docblock. + */ + #[example_attribute] + #[with_multiple_attributes, and_another_attribute] + + function method_only_with_attributes_incorrect_whitespace(): void { + } } diff --git a/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/docblock_with_multiline_attributes.php b/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/docblock_with_multiline_attributes.php index 045f8d1..f516255 100644 --- a/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/docblock_with_multiline_attributes.php +++ b/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/docblock_with_multiline_attributes.php @@ -9,9 +9,9 @@ defined('MOODLE_INTERNAL') || die(); // Make this always the 1st line in all CS fixtures. /** - * Example class. + * Example class. */ -#[\Attribute( +#[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -20,7 +20,7 @@ class class_multiline_attribute { /** * Method attribute. */ - #[\Attribute( + #[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -31,7 +31,7 @@ function method_multiline_attribute(): void { /** * Interface with multiline attributes. */ -#[\Attribute( +#[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -41,7 +41,7 @@ interface interface_multiline_attribute { /** * Trait with multiline attributes. */ -#[\Attribute( +#[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -52,7 +52,7 @@ trait trait_multiline_attribute { * Example class. */ -#[\Attribute( +#[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -62,7 +62,7 @@ class class_multiline_attribute_space_between { * Method attribute. */ - #[\Attribute( + #[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -74,7 +74,7 @@ function method_multiline_attribute_space_between(): void { * Interface with multiline attributes. */ -#[\Attribute( +#[someattribute( attr1: 'asdf', attr2: 'asdf', )] @@ -85,7 +85,7 @@ interface interface_multiline_attribute_space_between { * Trait with multiline attributes and space between. */ - #[\Attribute( + #[someattribute( attr1: 'asdf', attr2: 'asdf', )] diff --git a/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/interface_only_with_attributes_incorrect_whitespace.php b/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/interface_only_with_attributes_incorrect_whitespace.php new file mode 100644 index 0000000..caa180b --- /dev/null +++ b/moodle/Tests/Sniffs/Commenting/fixtures/MissingDocblock/interface_only_with_attributes_incorrect_whitespace.php @@ -0,0 +1,14 @@ +