Skip to content

Using curly braces for a shared CASE/DEFAULT statement can generate an error in PSR2 SwitchDeclaration #887

Closed
@mkasberg

Description

@mkasberg

SwitchDeclarationSniff is throwing PHP Notices:

PHP Notice:  Undefined index: scope_condition in phar:///usr/local/bin/phpcs/CodeSniffer/Standards/PSR2/Sniffs/ControlStructures/SwitchDeclarationSniff.php on line 157
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->runphpcs() /usr/local/bin/phpcs:6
PHP   3. PHP_CodeSniffer_CLI->process() phar:///usr/local/bin/phpcs/CodeSniffer/CLI.php:104
PHP   4. PHP_CodeSniffer->processFiles() phar:///usr/local/bin/phpcs/CodeSniffer/CLI.php:886
PHP   5. PHP_CodeSniffer->processFile() phar:///usr/local/bin/phpcs/CodeSniffer.php:619
PHP   6. PHP_CodeSniffer->_processFile() phar:///usr/local/bin/phpcs/CodeSniffer.php:1714
PHP   7. PHP_CodeSniffer_File->start() phar:///usr/local/bin/phpcs/CodeSniffer.php:1836
PHP   8. PSR2_Sniffs_ControlStructures_SwitchDeclarationSniff->process() phar:///usr/local/bin/phpcs/CodeSniffer/File.php:567

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