Skip to content

Calling hasDeprecatedWellFormatted with a false $commentStartPtr leads to error #399

Closed
@mattijv

Description

@mattijv

Preconditions

  1. Magento Coding Standard containing e64106d.

Steps to reproduce

  1. Run phpcs --standard=Magento2 Foo.php for the following sample file
<?php

namespace Foo\Bar;

class Foo
{

    protected function foo()
    {
        return 1;
    }
}

Expected result

  1. phpcs complains about a missing comment block.

Actual result

  1. A sniff fails with an error message:

An error occurred during processing; checking has been aborted. The error message was: Undefined index: comment_closer in /path/to/magento-coding-standard/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php on line 142

Alternatively, in some situations the phpcs process hangs in an eternal loop. (Due to ignoring the error and going into the following for loop with bad limits.)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions