Skip to content

Suppression of function prototype breaks checking of lines within function #311

@abulford

Description

@abulford

More generally, it appears that if the @codingStandardsIgnoreEnd line is after a function's prototype and before the closing } but the @codingStandardsIgnoreStart is above the function, everything following the @codingStandardsIgnoreEnd is treated as if it's not in the function.

This can be a problem if just the function prototype needs suppressing, but not the entire function, currently the only workaround is to suppress the entire function.

The following code demonstrates the issue:

<?php namespace A; // @codingStandardsIgnoreStart class lowerCamelCaseClass // @codingStandardsIgnoreEnd { private $memberVariable; // @codingStandardsIgnoreStart public function _functionWithAnUnderscorePrefix() // @codingStandardsIgnoreEnd { $this->memberVariable = 'string'; $this->memberVariable .= PHP_EOL; return $this->memberVariable; } } 

While the class name can be suppressed to prevent the Class name "lowerCamelCaseClass" is not in camel caps format error, attempting to suppress the function name causes the three lines within the function to display a Visibility must be declared on property "$this" error.

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