Skip to content

Commit

Permalink
Add test for multiline attributes for MissingDocblockSniff
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Ziegenberg <[email protected]>
  • Loading branch information
ziegenberg authored and stronk7 committed Mar 23, 2024
1 parent 3bfeb70 commit 74421e1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions moodle/Tests/Sniffs/Commenting/MissingDocblockSniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ public static function docblockCorrectnessProvider(): array {
'errors' => [],
'warnings' => [],
],
'Docblock with attributes on function (correct)' => [
'fixture' => 'docblock_with_multiline_attributes',
'fixtureFilename' => null,
'errors' => [],
'warnings' => [],
],
'Testcase' => [
'fixture' => 'testcase_class',
'fixtureFilename' => '/lib/tests/example_test.php',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* This file contains multiple testcases for multi line attributes.
*/

namespace MoodleHQ\MoodleCS\moodle\Tests\Sniffs\PHPUnit;

defined('MOODLE_INTERNAL') || die(); // Make this always the 1st line in all CS fixtures.

/**
* Example class.
*/
#[\Attribute(
attr1: 'asdf',
attr2: 'asdf',
)]
class class_multiline_attribute {

/**
* Method attribute.
*/
#[\Attribute(
attr1: 'asdf',
attr2: 'asdf',
)]
function method_multiline_attribute(): void {
}
}

/**
* Interface with multiline attributes.
*/
#[\Attribute(
attr1: 'asdf',
attr2: 'asdf',
)]
interface interface_multiline_attribute {
}

/**
* Trait with multiline attributes.
*/

#[\Attribute(
attr1: 'asdf',
attr2: 'asdf',
)]
trait trait_multiline_attribute {
}

0 comments on commit 74421e1

Please sign in to comment.