Skip to content

PSR12.Files.OpenTag incorrectly identifies PHP file with only an opening tag #2664

Closed
@grantlucas

Description

@grantlucas

When trying out the latest PSR-12 support, I found that PSR12.Files.OpenTag.NotAlone was triggering on PHP files where there is just an opening PHP tag. We have some of these in our project due to framework reasons. It's not great but kind of required.

Triggers error

<?php

[phpcs] Opening PHP tag must be on a line by itself (PSR12.Files.OpenTag.NotAlone)

Doesn't trigger error

<?php

// comment

Please correct me if I'm wrong but I don't see anywhere in PSR-12 where a PHP file can't just have an opening tag, however useless.

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