Skip to content

When a comment has too many asterisks, phpcbf gives FAILED TO FIX error #1840

Closed
@Flimm

Description

@Flimm

I have enabled Squiz.Commenting rule. Take this example file:

<?php
class Example {

	/** ************************************************************************
	 * Example
	 **************************************************************************/
	function example() {
	}
}

Running phpcs on this file gives several errors, the ones marked with [X] are:

 4 | ERROR | [x] Expected 5 space(s) before asterisk; 8 found
   |       |     (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 4 | ERROR | [x] Expected 1 space after asterisk; 0 found
   |       |     (Squiz.Commenting.DocCommentAlignment.NoSpaceAfterStar)

So far, so good. However, running phpcbf gives this result:


PHPCBF RESULT SUMMARY
---------------------------------------------------------------------------------------------------------------
FILE            FIXED  REMAINING
---------------------------------------------------------------------------------------------------------------
...example.php  FAILED TO FIX
---------------------------------------------------------------------------------------------------------------
A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE
---------------------------------------------------------------------------------------------------------------
PHPCBF FAILED TO FIX 1 FILE
---------------------------------------------------------------------------------------------------------------

Removing all the additional asterisks in the code fixes this problem. It would be nice if phpcbf knew how to handle this case.

Versions: PHPCS 3.2.2, PHP 7.1.12.

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