Skip to content

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

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

Closed
smileBeda opened this issue Jun 29, 2021 · 1 comment
Milestone

Comments

@smileBeda
Copy link

smileBeda commented Jun 29, 2021

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.

@gsherwood gsherwood added this to the 3.6.1 milestone Jul 18, 2021
@gsherwood gsherwood changed the title When file has no code, but a File Comment, then a wrongful "there must be exactly one blank line after the file comment" warning is produced Squiz.Commenting.FileComment.SpacingAfterComment false positive on empty file Jul 18, 2021
gsherwood added a commit that referenced this issue Jul 18, 2021
gsherwood added a commit that referenced this issue Jul 18, 2021
@gsherwood
Copy link
Member

Thanks for reporting this. This is now fixed and will be released in 3.6.1.

MocioF added a commit to MocioF/No-unsafe-inline that referenced this issue Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants