{"action":"created","issue":{"url":"https://api.github.com/repos/slevomat/coding-standard/issues/486","repository_url":"https://api.github.com/repos/slevomat/coding-standard","labels_url":"https://api.github.com/repos/slevomat/coding-standard/issues/486/labels{/name}","comments_url":"https://api.github.com/repos/slevomat/coding-standard/issues/486/comments","events_url":"https://api.github.com/repos/slevomat/coding-standard/issues/486/events","html_url":"https://github.com/slevomat/coding-standard/issues/486","id":362530542,"node_id":"MDU6SXNzdWUzNjI1MzA1NDI=","number":486,"title":"Undefined index issue on ControlStructureSpacingSniff with fixer","user":{"login":"Soullivaneuh","id":1698357,"node_id":"MDQ6VXNlcjE2OTgzNTc=","avatar_url":"https://avatars0.githubusercontent.com/u/1698357?v=4","gravatar_id":"","url":"https://api.github.com/users/Soullivaneuh","html_url":"https://github.com/Soullivaneuh","followers_url":"https://api.github.com/users/Soullivaneuh/followers","following_url":"https://api.github.com/users/Soullivaneuh/following{/other_user}","gists_url":"https://api.github.com/users/Soullivaneuh/gists{/gist_id}","starred_url":"https://api.github.com/users/Soullivaneuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soullivaneuh/subscriptions","organizations_url":"https://api.github.com/users/Soullivaneuh/orgs","repos_url":"https://api.github.com/users/Soullivaneuh/repos","events_url":"https://api.github.com/users/Soullivaneuh/events{/privacy}","received_events_url":"https://api.github.com/users/Soullivaneuh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-21T09:30:11Z","updated_at":"2018-09-21T09:54:57Z","closed_at":null,"author_association":"NONE","body":"Since `v4.8.0`:\r\n\r\n```\r\nphpcbf -p --parallel=6 --standard=ruleset.xml\r\n\r\nFatal error: Uncaught PHP_CodeSniffer\\Exceptions\\RuntimeException: Undefined index:  in /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php on line 254 in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php:562\r\nStack trace:\r\n#0 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php(254): PHP_CodeSniffer\\Runner->handleErrors(8, 'Undefined index...', '/home/developer...', 254, Array)\r\n#1 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php(210): SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff->findControlStructureEnd(Object(PHP_CodeSniffer\\Files\\LocalFile), 149)\r\n#2 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php(137): SlevomatCodingSt in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php on line 562\r\n\r\nFatal error: Uncaught PHP_CodeSniffer\\Exceptions\\RuntimeException: Undefined variable: childOutput in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php on line 705 in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php:562\r\nStack trace:\r\n#0 /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(705): PHP_CodeSniffer\\Runner->handleErrors(8, 'Undefined varia...', '/home/developer...', 705, Array)\r\n#1 /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(502): PHP_CodeSniffer\\Runner->processChildProcs(Array)\r\n#2 /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(193): PHP_CodeSniffer\\Runner->run()\r\n#3 /home/developer/.composer/vendor/squizlabs/php_codesniffer/bin/phpcbf(18): PHP_CodeSniffer\\Runner->runPHPCBF()\r\n#4 {main}\r\n  thrown in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php on line 562\r\n```\r\n\r\nWorks like a charm on `4.7.3`.\r\n\r\nGit bisect revealed this commit: 93c582ce997e485f34e825f0950c042de980d35c\r\n\r\nHere is also my ruleset configuration:\r\n\r\n```xml\r\n<?xml version=\"1.0\"?>\r\n<ruleset name=\"Standard\">\r\n    <file>src</file>\r\n    <file>src-dev</file>\r\n    <file>tests</file>\r\n    <file>config</file>\r\n\r\n    <exclude-pattern>tests/fixtures/repos</exclude-pattern>\r\n\r\n\r\n    <rule ref=\"Generic.PHP.ForbiddenFunctions\">\r\n        <properties>\r\n            <property\r\n                name=\"forbiddenFunctions\"\r\n                type=\"array\"\r\n                value=\"\r\n                    delete=>unset,\r\n                    die=>null,\r\n                    dump=>null,\r\n                    echo=>null,\r\n                    exit=>null,\r\n                    print=>null,\r\n                    sizeof=>count,\r\n                    var_dump=>null\r\n                \"\r\n            />\r\n        </properties>\r\n    </rule>\r\n\r\n    <rule ref=\"PSR1\"/>\r\n    <rule ref=\"PSR1.Files.SideEffects.FoundWithSymbols\">\r\n        <exclude-pattern>env.php</exclude-pattern>\r\n    </rule>\r\n    <rule ref=\"PSR2\">\r\n        <exclude name=\"Generic.Files.LineLength.TooLong\"/>\r\n        <exclude name=\"Generic.Files.LineLength.MaxExceeded\"/>\r\n    </rule>\r\n\r\n    <rule ref=\"Squiz.Functions.GlobalFunction.Found\">\r\n        <exclude-pattern>src/functions.php</exclude-pattern>\r\n    </rule>\r\n\r\n    <rule ref=\"Symfony\">\r\n        <exclude name=\"Symfony.Commenting.License\"/>\r\n        <exclude name=\"Symfony.Commenting.Annotations.Invalid\"/>\r\n        <exclude name=\"Symfony.Commenting.ClassComment.Missing\"/>\r\n        <exclude name=\"Zend.NamingConventions.ValidVariableName.MemberVarContainsNumbers\"/>\r\n        <!-- @see https://github.com/djoos/Symfony-coding-standard/issues/120 -->\r\n        <exclude name=\"Symfony.Commenting.FunctionComment\"/>\r\n        <!-- @see https://github.com/djoos/Symfony-coding-standard/issues/119 -->\r\n        <exclude name=\"Symfony.Functions.ReturnType.Invalid\"/>\r\n        <!-- @see https://github.com/djoos/Symfony-coding-standard/issues/27 -->\r\n        <exclude name=\"PEAR.Functions.FunctionCallSignature\"/>\r\n        <!-- @see https://github.com/djoos/Symfony-coding-standard/issues/44 -->\r\n        <exclude name=\"Squiz.Strings.ConcatenationSpacing\"/>\r\n        <!-- @see https://github.com/djoos/Symfony-coding-standard/issues/122 -->\r\n        <exclude name=\"Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace\"/>\r\n        <exclude name=\"Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore\"/>\r\n        <exclude name=\"PEAR.WhiteSpace.ScopeClosingBrace.Line\"/>\r\n        <exclude name=\"Symfony.Formatting.BlankLineBeforeReturn.Invalid\"/>\r\n        <!-- https://github.com/djoos/Symfony-coding-standard/issues/123 -->\r\n        <exclude name=\"Symfony.Formatting.ReturnOrThrow.Invalid\"/>\r\n    </rule>\r\n\r\n    <!-- @see https://github.com/djoos/Symfony-coding-standard/issues/121 -->\r\n    <rule ref=\"Symfony.NamingConventions.ValidClassName.InvalidAbstractName\">\r\n        <exclude-pattern>*TestCase.php</exclude-pattern>\r\n        <exclude-pattern>src/AppBundle/Entity/Operation.php</exclude-pattern>\r\n    </rule>\r\n\r\n    <rule ref=\"SlevomatCodingStandard\">\r\n        <exclude name=\"SlevomatCodingStandard.ControlStructures.DisallowYodaComparison\"/>\r\n        <exclude name=\"SlevomatCodingStandard.ControlStructures.DisallowEmpty\"/>\r\n        <exclude name=\"SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Classes.SuperfluousExceptionNaming\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenDifferentAnnotationsTypes\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators\"/>\r\n        <!-- This rule should be enable later with a high diff review. -->\r\n        <exclude name=\"SlevomatCodingStandard.ControlStructures.EarlyExit\"/>\r\n        <exclude name=\"SlevomatCodingStandard.ControlStructures.NewWithoutParentheses\"/>\r\n        <exclude name=\"SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation\"/>\r\n        <!-- @see https://github.com/slevomat/coding-standard/issues/245 -->\r\n        <exclude name=\"SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces\"/>\r\n        <!-- @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3471 -->\r\n        <exclude name=\"SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReNoValidateFormTypeExtension.phpferenceViaFullyQualifiedNameWithoutNamespace\"/>\r\n        <!-- @see https://github.com/slevomat/coding-standard/issues/246 -->\r\n        <exclude name=\"SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions.NonFullyQualifiedException\"/>\r\n        <!-- @see https://github.com/slevomat/coding-standard/issues/441 -->\r\n        <exclude name=\"SlevomatCodingStandard.Commenting.UselessInheritDocComment.UselessInheritDocComment\"/>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod\">\r\n        <exclude-pattern>src/AppBundle/Command/OperationExecuteCommand.php</exclude-pattern>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Classes.TraitUseSpacing\">\r\n        <properties>\r\n            <property\r\n                    name=\"linesCountBeforeFirstUse\"\r\n                    type=\"int\"\r\n                    value=\"0\"\r\n            />\r\n        </properties>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Files.TypeNameMatchesFileName\">\r\n        <properties>\r\n            <property\r\n                name=\"rootNamespaces\"\r\n                type=\"array\"\r\n                value=\"\r\n                    tests=>Tests,\r\n                    src=>App,\r\n                    src/AppBundle=>AppBundle,\r\n                    src/PowerDNSBundle=>PowerDNSBundle,\r\n                    src-dev=>Dev,\r\n                \"\r\n            />\r\n            <property name=\"ignoredNamespaces\" type=\"array\" value=\"DoctrineMigrations\"/>\r\n        </properties>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly\">\r\n        <properties>\r\n            <property name=\"allowFullyQualifiedNameForCollidingClasses\" value=\"true\"/>\r\n            <property name=\"allowFullyQualifiedGlobalClasses\" value=\"true\"/>\r\n            <property name=\"allowFullyQualifiedGlobalFunctions\" value=\"true\"/>\r\n            <property name=\"allowFullyQualifiedGlobalConstants\" value=\"true\"/>\r\n        </properties>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName\">\r\n        <exclude-pattern>config/bundles.php</exclude-pattern>\r\n        <exclude-pattern>src/Kernel.php</exclude-pattern>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Namespaces.UnusedUses\">\r\n        <properties>\r\n            <property name=\"searchAnnotations\" value=\"true\"/>\r\n        </properties>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.TypeHints.DeclareStrictTypes\">\r\n        <properties>\r\n            <property name=\"newlinesCountBetweenOpenTagAndDeclare\" value=\"2\"/>\r\n            <property name=\"spacesCountAroundEqualsSign\" value=\"0\"/>\r\n        </properties>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.TypeHints.TypeHintDeclaration\">\r\n        <properties>\r\n            <property\r\n                name=\"usefulAnnotations\"\r\n                type=\"array\"\r\n                value=\"\r\n                    @after,\r\n                    @before,\r\n                    @dataProvider,\r\n                    @deprecated,\r\n                    @required,\r\n                    @see,\r\n                    @ApiDoc,\r\n                    @Assert\\,\r\n                    @QueryParam,\r\n                    @ORM\\,\r\n                    @ParamConverter,\r\n                    @Route,\r\n                    @Security,\r\n                    @Method,\r\n                    @IsGranted,\r\n                    @Operation\r\n                \"\r\n            />\r\n            <property name=\"enableEachParameterAndReturnInspection\" value=\"true\"/>\r\n        </properties>\r\n    </rule>\r\n    <rule ref=\"SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces\">\r\n        <properties>\r\n            <property name=\"linesCountAfterOpeningBrace\" value=\"0\"/>\r\n            <property name=\"linesCountBeforeClosingBrace\" value=\"0\"/>\r\n        </properties>\r\n    </rule>\r\n</ruleset>\r\n```"},"comment":{"url":"https://api.github.com/repos/slevomat/coding-standard/issues/comments/423479613","html_url":"https://github.com/slevomat/coding-standard/issues/486#issuecomment-423479613","issue_url":"https://api.github.com/repos/slevomat/coding-standard/issues/486","id":423479613,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzQ3OTYxMw==","user":{"login":"Soullivaneuh","id":1698357,"node_id":"MDQ6VXNlcjE2OTgzNTc=","avatar_url":"https://avatars0.githubusercontent.com/u/1698357?v=4","gravatar_id":"","url":"https://api.github.com/users/Soullivaneuh","html_url":"https://github.com/Soullivaneuh","followers_url":"https://api.github.com/users/Soullivaneuh/followers","following_url":"https://api.github.com/users/Soullivaneuh/following{/other_user}","gists_url":"https://api.github.com/users/Soullivaneuh/gists{/gist_id}","starred_url":"https://api.github.com/users/Soullivaneuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soullivaneuh/subscriptions","organizations_url":"https://api.github.com/users/Soullivaneuh/orgs","repos_url":"https://api.github.com/users/Soullivaneuh/repos","events_url":"https://api.github.com/users/Soullivaneuh/events{/privacy}","received_events_url":"https://api.github.com/users/Soullivaneuh/received_events","type":"User","site_admin":false},"created_at":"2018-09-21T09:54:57Z","updated_at":"2018-09-21T09:54:57Z","author_association":"NONE","body":"Ok found it. Here is the output with -vvv option:\r\n\r\n```\r\n 1|<?php\r\n 2|\r\n 3|declare(strict_types=1);\r\n 4|\r\n 5|use Doctrine\\Common\\Annotations\\AnnotationReader;\r\n 6|\r\n 7|\\error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~\\E_STRICT);\r\n 8|\\ini_set('display_errors', '0');\r\n 9|\r\n10|\\mb_internal_encoding('UTF-8');\r\n11|\r\n12|\\ini_set('memory_limit', '512M');\r\n13|\\ini_set('date.timezone', 'Europe/Paris');\r\n14|\r\n15|\\define('KERNEL_PROJECT_DIR', __DIR__.'/..');\r\n16|\r\n17|// Change nested level max for xdebug\r\n18|if (false !== \\ini_get('xdebug.max_nesting_level')) {\r\n19|    \\ini_set('xdebug.max_nesting_level', '500');\r\n20|}\r\n21|\r\n22|AnnotationReader::addGlobalIgnoredName('phpcsSuppress');\r\n23|\r\n24|// Needed for Browscap init.\r\n25|$sharedPath = __DIR__.'/../var/shared';\r\n26|if (!\\file_exists($sharedPath)) {\r\n27|    \\mkdir($sharedPath);\r\n28|}\r\n29|\r\n--- END FILE CONTENT ---\r\n\t=> Changeset started by SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff (line 189)\r\n\t\tQ: SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff (line 198) replaced token 148 (T_WHITESPACE) \"\\nif\" => \"if\"\r\n\t\tQ: SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff (line 201) replaced token 147 (T_SEMICOLON) \";\" => \";\\n\"\r\n\t\tQ: SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff (line 201) replaced token 147 (T_SEMICOLON) \";\" => \";\\n\\n\"\r\n\t\tA: SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff (line 203) replaced token 148 (T_WHITESPACE) \"\\nif\" => \"if\"\r\n\t\tA: SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff (line 203) replaced token 147 (T_SEMICOLON) \";\" => \";\\n\\n\"\r\n\t=> Changeset ended: 2 changes applied\r\n\r\nFatal error: Uncaught PHP_CodeSniffer\\Exceptions\\RuntimeException: Undefined index:  in /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php on line 254 in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php:562\r\nStack trace:\r\n#0 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php(254): PHP_CodeSniffer\\Runner->handleErrors(8, 'Undefined index...', '/home/developer...', 254, Array)\r\n#1 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php(210): SlevomatCodingStandard\\Sniffs\\ControlStructures\\ControlStructureSpacingSniff->findControlStructureEnd(Object(PHP_CodeSniffer\\Files\\LocalFile), 149)\r\n#2 /home/developer/.composer/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/ControlStructureSpacingSniff.php(137): SlevomatCodingSt in /home/developer/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php on line 562\r\n```"}}
{"actor":{"display_login":"Soullivaneuh"}}