.... to allow for adding additional test case files.
Squiz/OperatorBracket: prevent PHP notices during live coding
During live coding (or in the case of parse errors), the "end of the expression" cannot always be correctly determined. In such a case, the sniff should stay silent.
This wasn't always handled correctly so far and could lead to the following PHP notices:
Undefined array key "parenthesis_closer" in path/to/phpcs/src/Standards/Squiz/Sniffs/Formatting/OperatorBracketSniff.php on line 357
Undefined array key "bracket_closer" in path/to/phpcs/src/Standards/Squiz/Sniffs/Formatting/OperatorBracketSniff.php on line 362
This commit fixes these by adding some extra defensive coding and bowing out when an unclosed bracket set is encountered.
Includes tests.
Suggested changelog entry
Squiz.Formatting.OperatorBracket: bug fix for potential PHP notice during live coding
Description
Squiz/OperatorBracket: rename test case file
.... to allow for adding additional test case files.
Squiz/OperatorBracket: prevent PHP notices during live coding
During live coding (or in the case of parse errors), the "end of the expression" cannot always be correctly determined. In such a case, the sniff should stay silent.
This wasn't always handled correctly so far and could lead to the following PHP notices:
This commit fixes these by adding some extra defensive coding and bowing out when an unclosed bracket set is encountered.
Includes tests.
Suggested changelog entry
Squiz.Formatting.OperatorBracket: bug fix for potential PHP notice during live coding
Related issues/external references
Loosely related to https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/152 as this issue was discovered when creating an update for the fixer conflict list.
Types of changes