Skip to content

Squiz.Commenting.FileComment.SpacingAfterComment false positive on empty file #3384

@smileBeda

Description

@smileBeda

This comes from here.
Since it is an upstream issue, I am reporting it here.


This file contents trigger the notice there must be exactly one blank line after the file comment
(note that there is a blank line after the comment, and even if adding more than one blank line won't change this message)

<?php /** * Intentionally empty file. * * It exists to stop directory listings on poorly configured servers. * * @package whatever */ 

This does not trigger that warning:
(note that the only difference is we added something after the blank line after comment)

<?php /** * Intentionally empty file. * * It exists to stop directory listings on poorly configured servers. * * @package whatever */ echo 'this'; 

I don't think it is OK to assume there will be code in any case in a file, even when there is a comment.
Thus, the warning is faulty and should probably only trigger if there is really no empty line after comment, which is clearly not the case here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions