@file doc blocks for test classes with an additional class in the file

Created on 27 May 2016, over 8 years ago
Updated 29 January 2025, 24 days ago

Problem/Motivation

In a previous issue #2304909: Relax requirement for @file when using OO Class or Interface per file , we decided that we did not need a @file doc block for PSR-4 files with exactly one class in them. #2665744: @file is not required for classes, interfaces and traits made a Coder rule for it, and #2572643: Fix 'Drupal.Commenting.FileComment' coding standard fixed up Core so that we could run the Coder rule, and #2665992: @file is not required for classes, interfaces and traits ran it against Core and turned on this as a permanent sniffer in 8.2.x.

Then on #2734195: Remove @file tag docblock from files that contain a namespaced class/interface/trait, whose file name is the class name with a .php extension , @neerajsingh noticed that we still have a bunch of test class files that have @file doc blocks, and made a patch to remove them. @jhodgdon marked this as a duplicate and reopened #2572643: Fix 'Drupal.Commenting.FileComment' coding standard . @alexpott on comment #28 figured out that the reason these are still in Core is that they are test class files, where there is an additional class in the file (used for testing purposes). An example:
core/modules/block/tests/src/Unit/BlockRepositoryTest.php
This contains:

namespace Drupal\Tests\block\Unit;

class BlockRepositoryTest extends UnitTestCase {
}

interface TestContextAwareBlockInterface extends BlockPluginInterface, ContextAwarePluginInterface {
}

So, the question here is whether we need a @file doc block for this class file. If so, what should it say? If not, we need a new/revised Coder rule to detect/fix/remove this doc block.

Proposed resolution

TBD

Remaining tasks

TBD

📌 Task
Status

Active

Component

Coding Standards

Created by

🇺🇸United States jhodgdon Spokane, WA, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024