Coding-standard: Undefined index issue on RequireTernaryOperatorSniff with fixer

Created on 25 Sep 2018  路  2Comments  路  Source: slevomat/coding-standard

Similar to #486

            Processing SlevomatCodingStandard\Sniffs\ControlStructures\RequireTernaryOperatorSniff...   => Fixing file: 1/1 violations remaining---START FILE CONTENT---
 1|<?php
 2|
 3|declare(strict_types=1);
 4|
 5|use Doctrine\Common\Annotations\AnnotationReader;
 6|
 7|\error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~\E_STRICT);
 8|\ini_set('display_errors', '0');
 9|
10|\mb_internal_encoding('UTF-8');
11|
12|\ini_set('memory_limit', '512M');
13|\ini_set('date.timezone', 'Europe/Paris');
14|
15|\define('KERNEL_PROJECT_DIR', __DIR__.'/..');
16|
17|// Change nested level max for xdebug
18|if (false !== \ini_get('xdebug.max_nesting_level')) {
19|    \ini_set('xdebug.max_nesting_level', '500');
20|}
21|
22|AnnotationReader::addGlobalIgnoredName('phpcsSuppress');
23|
24|// Needed for Browscap init.
25|$sharedPath = __DIR__.'/../var/shared';
26|if (!\file_exists($sharedPath)) {
27|    \mkdir($sharedPath);
28|}
29|
--- END FILE CONTENT ---
    => Changeset started by SlevomatCodingStandard\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 189)
        Q: SlevomatCodingStandard\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 198) replaced token 148 (T_WHITESPACE) "\nif" => "if"
        Q: SlevomatCodingStandard\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 201) replaced token 147 (T_SEMICOLON) ";" => ";\n"
        Q: SlevomatCodingStandard\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 201) replaced token 147 (T_SEMICOLON) ";" => ";\n\n"
        A: SlevomatCodingStandard\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 203) replaced token 148 (T_WHITESPACE) "\nif" => "if"
        A: SlevomatCodingStandard\Sniffs\ControlStructures\ControlStructureSpacingSniff (line 203) replaced token 147 (T_SEMICOLON) ";" => ";\n\n"
    => Changeset ended: 2 changes applied
DONE in 0.0001 seconds
            Processing SlevomatCodingStandard\Sniffs\ControlStructures\AssignmentInConditionSniff... DONE in 0 seconds
            Processing SlevomatCodingStandard\Sniffs\ControlStructures\RequireTernaryOperatorSniff... 
Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: Undefined index:  in /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/RequireTernaryOperatorSniff.php on line 53 in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php:562
Stack trace:
#0 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/RequireTernaryOperatorSniff.php(53): PHP_CodeSniffer\Runner->handleErrors(8, 'Undefined index...', '/home/developer...', 53, Array)
#1 /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(497): SlevomatCodingStandard\Sniffs\ControlStructures\RequireTernaryOperatorSniff->process(Object(PHP_CodeSniffer\Files\LocalFile), 149)
#2 /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(91): PHP_CodeSniffer\Files\File->process()
#3 /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Fixer.php(174): PHP_CodeSniffer\Files\LocalFile->pro in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php on line 562
Bug

Most helpful comment

All 2 comments

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

soullivaneuh picture soullivaneuh  路  5Comments

alexz707 picture alexz707  路  7Comments

carusogabriel picture carusogabriel  路  5Comments

dereuromark picture dereuromark  路  3Comments

alcaeus picture alcaeus  路  6Comments