Skip to content

False error on some comments after class closing brace #689

@phlopsi

Description

@phlopsi
$ phpcs --version PHP_CodeSniffer version 2.3.3 (stable) by Squiz (http://www.squiz.net) 

My file "C1.php":

<?php namespace N1; class C1 { } // C1

This file should be correctly formatted according to PSR-2, but when i check on it i get this:

$ phpcs --standard=PSR2 C1.php FILE: C:\Users\[...]\Desktop\C1.php ---------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------- 8 | ERROR | Closing class brace must be on a line by itself ---------------------------------------------------------------------- Time: 78ms; Memory: 2.25Mb 

In PSR-2 it only says "The opening brace for the class MUST go on its own line; the closing brace for the class MUST go on the next line after the body."
In the conclusion it's also mentioned that "There are many elements of style and practice intentionally omitted by this guide. These include but are not limited to: [...] Comments and documentation blocks"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions