Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for multiline attributes for MissingDocblockSniff #131

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
}
Loading