From dffcac2bd55eac286880e5010e1e571936831199 Mon Sep 17 00:00:00 2001
From: Daniel Siepmann <coding@daniel-siepmann.de>
Date: Tue, 2 May 2017 09:04:19 +0200
Subject: [PATCH 1/3] FEATURE: Add FQObjectIdentifier to TypoScript tokens

* To make later checks easier, add the fully qualified object
  identifier, to all object identifier tokens while tokenizing
  TypoScript.
* Adjust tests accordingly.
* Add necessary autoloading.

Closes: #66
---
 composer.json                                 |    3 +-
 .../Tokenizers/FQObjectIdentifier.php         |  125 ++
 src/CodeSniffer/Tokenizers/TypoScript.php     |   31 +-
 .../Sniffs/Removed/TypoScriptSniff.php        |   19 +-
 .../Tokenizers/FqObjectIdentifierTest.php     |  158 +++
 .../CodeSniffer/Tokenizers/TypoScriptTest.php |    7 +-
 .../Tokenizers/TypoScript/example.ts          |   13 +
 .../Tokenizers/TypoScript/expected.php        | 1088 ++++++++++++++++-
 .../Removed/TypoScriptSniff/Expected.json     |   25 +-
 .../TypoScriptSniff/InputFileForIssues.ts     |    4 +-
 10 files changed, 1404 insertions(+), 69 deletions(-)
 create mode 100644 src/CodeSniffer/Tokenizers/FQObjectIdentifier.php
 create mode 100644 tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php

diff --git a/composer.json b/composer.json
index 6f9a5df..bb5f5a8 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,8 @@
     },
     "autoload": {
         "psr-4": {
-            "Typo3Update\\": "src/Standards/Typo3Update/"
+            "Typo3Update\\": "src/Standards/Typo3Update/",
+            "Typo3Update\\CodeSniffer\\": "src/CodeSniffer/"
         },
         "files": [
             "src/CodeSniffer/Tokenizers/TypoScript.php"
diff --git a/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php b/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php
new file mode 100644
index 0000000..6ebe8f9
--- /dev/null
+++ b/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php
@@ -0,0 +1,125 @@
+<?php
+namespace Typo3Update\CodeSniffer\Tokenizers;
+
+/*
+ * Copyright (C) 2017  Daniel Siepmann <coding@daniel-siepmann.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/**
+ * Update tokens with fully qualified object identifier.
+ */
+class FQObjectIdentifier
+{
+    /**
+     * Key used to save identifier to token.
+     * @var string
+     */
+    const IDENTIFIER = 'fqObjectIdentifier';
+
+    /**
+     * The fully qualified object identifier, dot separated.
+     *
+     * @var array
+     */
+    protected $fqPath = [];
+
+    /**
+     * Current "real" depth, count of opening braces.
+     * @var int
+     */
+    protected $depth = 0;
+
+    /**
+     * Add token as path segment.
+     * @param array $token
+     */
+    public function addPathSegment(array &$token)
+    {
+        $this->syncPath();
+
+        $path = [];
+        foreach (explode('.', $token['content']) as $pathSegment) {
+            $path[] = [
+                'content' => $pathSegment,
+                'depth' => $this->getDepth(),
+            ];
+        }
+        $this->fqPath = array_merge($this->fqPath, $path);
+
+        $this->addFqObjectIdentifier($token);
+    }
+
+    /**
+     * Sync path with current depth.
+     */
+    public function syncPath()
+    {
+        $this->fqPath = array_filter(
+            $this->fqPath,
+            function ($pathSegment) {
+                return $pathSegment['depth'] < $this->depth;
+            }
+        );
+    }
+
+    /**
+     * Respect opening brace internal.
+     */
+    public function handleOpeningBrace()
+    {
+        ++$this->depth;
+    }
+
+    /**
+     * Respect closing brace internal.
+     */
+    public function handleClosingBrace()
+    {
+        --$this->depth;
+        $this->syncPath();
+    }
+
+    /**
+     * @return int
+     */
+    public function getDepth()
+    {
+        return $this->depth;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPath()
+    {
+        $path = '';
+        foreach ($this->fqPath as $pathSegment) {
+            $path .= '.' . $pathSegment['content'];
+        }
+
+        return substr($path, 1);
+    }
+
+    /**
+     * @param array $token
+     */
+    protected function addFqObjectIdentifier(array &$token)
+    {
+        $token[static::IDENTIFIER] = $this->getPath();
+    }
+}
diff --git a/src/CodeSniffer/Tokenizers/TypoScript.php b/src/CodeSniffer/Tokenizers/TypoScript.php
index 26136f6..0b66125 100644
--- a/src/CodeSniffer/Tokenizers/TypoScript.php
+++ b/src/CodeSniffer/Tokenizers/TypoScript.php
@@ -19,7 +19,9 @@
  * 02110-1301, USA.
  */
 
+use Helmich\TypoScriptParser\Tokenizer\TokenInterface;
 use Helmich\TypoScriptParser\Tokenizer\Tokenizer;
+use Typo3Update\CodeSniffer\Tokenizers\FQObjectIdentifier;
 
 /**
  * Tokenizes a string of TypoScript.
@@ -68,8 +70,33 @@ class PHP_CodeSniffer_Tokenizers_TYPOSCRIPT
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter) We need to match the signature.
      */
-    public function processAdditional(&$tokens, $eolChar)
+    public function processAdditional(array &$tokens, $eolChar)
     {
-        return;
+        $this->addFQObjectIdentifiers($tokens);
+    }
+
+    /**
+     * Add fully qualified object identifier to all object identifiers.
+     *
+     * @param array $tokens
+     */
+    protected function addFQObjectIdentifiers(array &$tokens)
+    {
+        $fqObjectIdentifier = new FQObjectIdentifier();
+
+        foreach ($tokens as &$token) {
+            if ($token['type'] === TokenInterface::TYPE_OBJECT_IDENTIFIER) {
+                $fqObjectIdentifier->addPathSegment($token);
+                continue;
+            }
+            if ($token['type'] === TokenInterface::TYPE_BRACE_OPEN) {
+                $fqObjectIdentifier->handleOpeningBrace();
+                continue;
+            }
+            if ($token['type'] === TokenInterface::TYPE_BRACE_CLOSE) {
+                $fqObjectIdentifier->handleClosingBrace();
+                continue;
+            }
+        }
     }
 }
diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php
index 98c0cca..7ce75bb 100644
--- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php
+++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php
@@ -21,6 +21,7 @@
 
 use Helmich\TypoScriptParser\Tokenizer\TokenInterface;
 use PHP_CodeSniffer_File as PhpCsFile;
+use Typo3Update\CodeSniffer\Tokenizers\FQObjectIdentifier;
 use Typo3Update\Options;
 use Typo3Update\Sniffs\Removed\AbstractGenericUsage;
 
@@ -90,13 +91,19 @@ class Typo3Update_Sniffs_Removed_TypoScriptSniff extends AbstractGenericUsage
     {
         $tokens = $phpcsFile->getTokens();
         $token = $tokens[$stackPtr];
-        $objectIdentifier = $token['content'];
+        $objectIdentifiersToLoopUp = [$token['content']];
 
-        if (isset($this->configured[$objectIdentifier]) && $token['type'] === $this->configured[$objectIdentifier]['type']) {
-            $this->removed = [
-                $this->configured[$objectIdentifier]
-            ];
-            return true;
+        if (isset($token[FQObjectIdentifier::IDENTIFIER]) && $token[FQObjectIdentifier::IDENTIFIER] !== $token['content']) {
+            $objectIdentifiersToLoopUp[] = $token[FQObjectIdentifier::IDENTIFIER];
+        }
+
+        foreach ($objectIdentifiersToLoopUp as $objectIdentifier) {
+            if (isset($this->configured[$objectIdentifier]) && $token['type'] === $this->configured[$objectIdentifier]['type']) {
+                $this->removed = [
+                    $this->configured[$objectIdentifier]
+                ];
+                return true;
+            }
         }
 
         return false;
diff --git a/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php b/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php
new file mode 100644
index 0000000..805ec06
--- /dev/null
+++ b/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php
@@ -0,0 +1,158 @@
+<?php
+
+namespace Typo3Update\Tests\CodeSniffer\Tokenizers;
+
+/*
+ * Copyright (C) 2017  Daniel Siepmann <coding@daniel-siepmann.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+use Helmich\TypoScriptParser\Tokenizer\TokenInterface;
+use PHPUnit\Framework\TestCase;
+use Typo3Update\CodeSniffer\Tokenizers\FQObjectIdentifier;
+
+class FqObjectIdentifierTest extends TestCase
+{
+    /**
+     * @test
+     */
+    public function addingPathSegmentAddsFqToNewToken()
+    {
+        $initialToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'plugin.tx_example',
+        ];
+        $lastToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'settings',
+        ];
+        $expectedResult = $lastToken;
+        $expectedResult['fqObjectIdentifier'] = 'plugin.tx_example.settings';
+
+        $identifier = new FqObjectIdentifier();
+        $identifier->addPathSegment($initialToken);
+        $identifier->handleOpeningBrace();
+        $identifier->addPathSegment($lastToken);
+
+        $this->assertEquals(
+            $expectedResult,
+            $lastToken,
+            'Adding path segment does not add FQObjectIdentifier to token.'
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function addingPathSegment2ndTimeAddsFqToNewToken()
+    {
+        $initialToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'plugin.tx_example',
+        ];
+        $firstToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'settings',
+        ];
+        $lastToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'someSetting',
+        ];
+        $expectedResult = $lastToken;
+        $expectedResult['fqObjectIdentifier'] = 'plugin.tx_example.settings.someSetting';
+
+        $identifier = new FqObjectIdentifier();
+        $identifier->addPathSegment($initialToken);
+        $identifier->handleOpeningBrace();
+        $identifier->addPathSegment($firstToken);
+        $identifier->handleOpeningBrace();
+        $identifier->addPathSegment($lastToken);
+
+        $this->assertEquals(
+            $expectedResult,
+            $lastToken,
+            'Adding path segment does not add FQObjectIdentifier to token on 2nd call.'
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function openingAndClosingBracesWillAdjustPath()
+    {
+        $initialToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'plugin.tx_example',
+        ];
+        $firstToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'settings',
+        ];
+        $secondToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'someSetting',
+        ];
+        $lastToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'view',
+        ];
+        $expectedResult = $lastToken;
+        $expectedResult['fqObjectIdentifier'] = 'plugin.tx_example.view';
+
+        $identifier = new FqObjectIdentifier();
+        $identifier->addPathSegment($initialToken);
+        $identifier->handleOpeningBrace();
+        $identifier->addPathSegment($firstToken);
+        $identifier->handleOpeningBrace();
+        $identifier->addPathSegment($secondToken);
+        $identifier->handleClosingBrace();
+        $identifier->addPathSegment($lastToken);
+
+        $this->assertEquals(
+            $expectedResult,
+            $lastToken,
+            'Curly braces do not modify path as expected.'
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function AddingPathSegmentAfterAnotherResetsPath()
+    {
+        $initialToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'plugin.tx_example.settings.someThing',
+        ];
+        $lastToken = [
+            'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
+            'content' => 'plugin.tx_example.settings.anotherOne',
+        ];
+        $expectedResult = $lastToken;
+        $expectedResult['fqObjectIdentifier'] = $expectedResult['content'];
+
+        $identifier = new FqObjectIdentifier();
+        $identifier->addPathSegment($initialToken);
+        $identifier->addPathSegment($lastToken);
+
+        $this->assertEquals(
+            $expectedResult,
+            $lastToken,
+            'Adding path segment without braces in between resets.'
+        );
+    }
+}
diff --git a/tests/CodeSniffer/Tokenizers/TypoScriptTest.php b/tests/CodeSniffer/Tokenizers/TypoScriptTest.php
index 51ec788..15f0778 100644
--- a/tests/CodeSniffer/Tokenizers/TypoScriptTest.php
+++ b/tests/CodeSniffer/Tokenizers/TypoScriptTest.php
@@ -22,6 +22,8 @@ namespace Typo3Update\Tests\CodeSniffer\Tokenizers;
  */
 
 use PHPUnit\Framework\TestCase;
+use PHP_CodeSniffer_File as PhpCsFile;
+use PHP_CodeSniffer as PhpCs;
 
 /**
  * Test TypoScript tokenizer.
@@ -55,9 +57,12 @@ class TypoScriptTest extends TestCase
             'example.ts',
         ]);
 
+        // Initialize constants, etc.
+        new PhpCs();
+
         $this->assertEquals(
             require $resultFile,
-            $subject->tokenizeString(file_get_contents($testFile), "\n"),
+            PhpCsFile::tokenizeString(file_get_contents($testFile), $subject, "\n"),
             'Did not get expected tokens.'
         );
     }
diff --git a/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/example.ts b/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/example.ts
index dee12f7..c47ce1b 100644
--- a/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/example.ts
+++ b/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/example.ts
@@ -3,4 +3,17 @@ plugin {
     tx_example {
         settings = TEST
     }
+    tx_example_2 {
+        settings = TEST
+    }
+}
+plugin.tx_example.view.something = 1
+plugin.tx_example {
+    view {
+        something = 1
+    }
+    settings2 = TEST
+}
+config {
+    enable_realurl = 1
 }
diff --git a/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/expected.php b/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/expected.php
index 196ca8e..5ae8ea8 100644
--- a/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/expected.php
+++ b/tests/Fixtures/CodeSniffer/Tokenizers/TypoScript/expected.php
@@ -1,148 +1,1140 @@
 <?php
 
 return [
-0 => array (
+  0 =>
+  array (
     'code' => 'COMMENT',
     'type' => 'COMMENT',
     'line' => 1,
     'content' => '# Comment',
-),
-1 => array (
+    'column' => 1,
+    'length' => 9,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  1 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 1,
     'content' => '
 ',
-),
-2 => array (
+    'column' => 10,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  2 =>
+  array (
     'code' => 'OBJ_IDENT',
     'type' => 'OBJ_IDENT',
     'line' => 2,
     'content' => 'plugin',
-),
-3 => array (
+    'column' => 1,
+    'length' => 6,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin',
+  ),
+  3 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 2,
     'content' => ' ',
-),
-4 => array (
+    'column' => 7,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  4 =>
+  array (
     'code' => 'BR_OPEN',
     'type' => 'BR_OPEN',
     'line' => 2,
     'content' => '{',
-),
-5 => array (
+    'column' => 8,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  5 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 2,
     'content' => '
 ',
-),
-6 => array (
+    'column' => 9,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  6 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 3,
     'content' => '    ',
-),
-7 => array (
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  7 =>
+  array (
     'code' => 'OBJ_IDENT',
     'type' => 'OBJ_IDENT',
     'line' => 3,
     'content' => 'tx_example',
-),
-8 => array (
+    'column' => 5,
+    'length' => 10,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example',
+  ),
+  8 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 3,
     'content' => ' ',
-),
-9 => array (
+    'column' => 15,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  9 =>
+  array (
     'code' => 'BR_OPEN',
     'type' => 'BR_OPEN',
     'line' => 3,
     'content' => '{',
-),
-10 => array (
+    'column' => 16,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  10 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 3,
     'content' => '
 ',
-),
-11 => array (
+    'column' => 17,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  11 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 4,
     'content' => '        ',
-),
-12 => array (
+    'column' => 1,
+    'length' => 8,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  12 =>
+  array (
     'code' => 'OBJ_IDENT',
     'type' => 'OBJ_IDENT',
     'line' => 4,
     'content' => 'settings',
-),
-13 => array (
+    'column' => 9,
+    'length' => 8,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example.settings',
+  ),
+  13 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 4,
     'content' => ' ',
-),
-14 => array (
+    'column' => 17,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  14 =>
+  array (
     'code' => 'OP_ASSIGN',
     'type' => 'OP_ASSIGN',
     'line' => 4,
     'content' => '=',
-),
-15 => array (
+    'column' => 18,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  15 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 4,
     'content' => ' ',
-),
-16 => array (
+    'column' => 19,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  16 =>
+  array (
     'code' => 'RVALUE',
     'type' => 'RVALUE',
     'line' => 4,
     'content' => 'TEST',
-),
-17 => array (
+    'column' => 20,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  17 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 4,
     'content' => '
 ',
-),
-18 => array (
+    'column' => 24,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  18 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 5,
     'content' => '    ',
-),
-19 => array (
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  19 =>
+  array (
     'code' => 'BR_CLOSE',
     'type' => 'BR_CLOSE',
     'line' => 5,
     'content' => '}',
-),
-20 => array (
+    'column' => 5,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  20 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
     'line' => 5,
     'content' => '
 ',
-),
-21 => array (
+    'column' => 6,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  21 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 6,
+    'content' => '    ',
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  22 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 6,
+    'content' => 'tx_example_2',
+    'column' => 5,
+    'length' => 12,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example_2',
+  ),
+  23 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 6,
+    'content' => ' ',
+    'column' => 17,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  24 =>
+  array (
+    'code' => 'BR_OPEN',
+    'type' => 'BR_OPEN',
+    'line' => 6,
+    'content' => '{',
+    'column' => 18,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  25 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 6,
+    'content' => '
+',
+    'column' => 19,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  26 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 7,
+    'content' => '        ',
+    'column' => 1,
+    'length' => 8,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  27 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 7,
+    'content' => 'settings',
+    'column' => 9,
+    'length' => 8,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example_2.settings',
+  ),
+  28 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 7,
+    'content' => ' ',
+    'column' => 17,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  29 =>
+  array (
+    'code' => 'OP_ASSIGN',
+    'type' => 'OP_ASSIGN',
+    'line' => 7,
+    'content' => '=',
+    'column' => 18,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  30 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 7,
+    'content' => ' ',
+    'column' => 19,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  31 =>
+  array (
+    'code' => 'RVALUE',
+    'type' => 'RVALUE',
+    'line' => 7,
+    'content' => 'TEST',
+    'column' => 20,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  32 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 7,
+    'content' => '
+',
+    'column' => 24,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  33 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 8,
+    'content' => '    ',
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  34 =>
+  array (
     'code' => 'BR_CLOSE',
     'type' => 'BR_CLOSE',
-    'line' => 6,
+    'line' => 8,
     'content' => '}',
-),
-22 => array (
+    'column' => 5,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  35 =>
+  array (
     'code' => 'WS',
     'type' => 'WS',
-    'line' => 6,
+    'line' => 8,
+    'content' => '
+',
+    'column' => 6,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  36 =>
+  array (
+    'code' => 'BR_CLOSE',
+    'type' => 'BR_CLOSE',
+    'line' => 9,
+    'content' => '}',
+    'column' => 1,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  37 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 9,
+    'content' => '
+',
+    'column' => 2,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  38 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 10,
+    'content' => 'plugin.tx_example.view.something',
+    'column' => 1,
+    'length' => 32,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example.view.something',
+  ),
+  39 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 10,
+    'content' => ' ',
+    'column' => 33,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  40 =>
+  array (
+    'code' => 'OP_ASSIGN',
+    'type' => 'OP_ASSIGN',
+    'line' => 10,
+    'content' => '=',
+    'column' => 34,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  41 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 10,
+    'content' => ' ',
+    'column' => 35,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  42 =>
+  array (
+    'code' => 'RVALUE',
+    'type' => 'RVALUE',
+    'line' => 10,
+    'content' => '1',
+    'column' => 36,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  43 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 10,
+    'content' => '
+',
+    'column' => 37,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  44 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 11,
+    'content' => 'plugin.tx_example',
+    'column' => 1,
+    'length' => 17,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example',
+  ),
+  45 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 11,
+    'content' => ' ',
+    'column' => 18,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  46 =>
+  array (
+    'code' => 'BR_OPEN',
+    'type' => 'BR_OPEN',
+    'line' => 11,
+    'content' => '{',
+    'column' => 19,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  47 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 11,
+    'content' => '
+',
+    'column' => 20,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  48 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 12,
+    'content' => '    ',
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  49 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 12,
+    'content' => 'view',
+    'column' => 5,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example.view',
+  ),
+  50 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 12,
+    'content' => ' ',
+    'column' => 9,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  51 =>
+  array (
+    'code' => 'BR_OPEN',
+    'type' => 'BR_OPEN',
+    'line' => 12,
+    'content' => '{',
+    'column' => 10,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  52 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 12,
+    'content' => '
+',
+    'column' => 11,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  53 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 13,
+    'content' => '        ',
+    'column' => 1,
+    'length' => 8,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  54 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 13,
+    'content' => 'something',
+    'column' => 9,
+    'length' => 9,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example.view.something',
+  ),
+  55 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 13,
+    'content' => ' ',
+    'column' => 18,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  56 =>
+  array (
+    'code' => 'OP_ASSIGN',
+    'type' => 'OP_ASSIGN',
+    'line' => 13,
+    'content' => '=',
+    'column' => 19,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  57 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 13,
+    'content' => ' ',
+    'column' => 20,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  58 =>
+  array (
+    'code' => 'RVALUE',
+    'type' => 'RVALUE',
+    'line' => 13,
+    'content' => '1',
+    'column' => 21,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  59 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 13,
+    'content' => '
+',
+    'column' => 22,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  60 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 14,
+    'content' => '    ',
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  61 =>
+  array (
+    'code' => 'BR_CLOSE',
+    'type' => 'BR_CLOSE',
+    'line' => 14,
+    'content' => '}',
+    'column' => 5,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  62 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 14,
+    'content' => '
+',
+    'column' => 6,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  63 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 15,
+    'content' => '    ',
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  64 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 15,
+    'content' => 'settings2',
+    'column' => 5,
+    'length' => 9,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'plugin.tx_example.settings2',
+  ),
+  65 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 15,
+    'content' => ' ',
+    'column' => 14,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  66 =>
+  array (
+    'code' => 'OP_ASSIGN',
+    'type' => 'OP_ASSIGN',
+    'line' => 15,
+    'content' => '=',
+    'column' => 15,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  67 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 15,
+    'content' => ' ',
+    'column' => 16,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  68 =>
+  array (
+    'code' => 'RVALUE',
+    'type' => 'RVALUE',
+    'line' => 15,
+    'content' => 'TEST',
+    'column' => 17,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  69 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 15,
+    'content' => '
+',
+    'column' => 21,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  70 =>
+  array (
+    'code' => 'BR_CLOSE',
+    'type' => 'BR_CLOSE',
+    'line' => 16,
+    'content' => '}',
+    'column' => 1,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  71 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 16,
+    'content' => '
+',
+    'column' => 2,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  72 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 17,
+    'content' => 'config',
+    'column' => 1,
+    'length' => 6,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'config',
+  ),
+  73 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 17,
+    'content' => ' ',
+    'column' => 7,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  74 =>
+  array (
+    'code' => 'BR_OPEN',
+    'type' => 'BR_OPEN',
+    'line' => 17,
+    'content' => '{',
+    'column' => 8,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  75 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 17,
+    'content' => '
+',
+    'column' => 9,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  76 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 18,
+    'content' => '    ',
+    'column' => 1,
+    'length' => 4,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  77 =>
+  array (
+    'code' => 'OBJ_IDENT',
+    'type' => 'OBJ_IDENT',
+    'line' => 18,
+    'content' => 'enable_realurl',
+    'column' => 5,
+    'length' => 14,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+    'fqObjectIdentifier' => 'config.enable_realurl',
+  ),
+  78 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 18,
+    'content' => ' ',
+    'column' => 19,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  79 =>
+  array (
+    'code' => 'OP_ASSIGN',
+    'type' => 'OP_ASSIGN',
+    'line' => 18,
+    'content' => '=',
+    'column' => 20,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  80 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 18,
+    'content' => ' ',
+    'column' => 21,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  81 =>
+  array (
+    'code' => 'RVALUE',
+    'type' => 'RVALUE',
+    'line' => 18,
+    'content' => '1',
+    'column' => 22,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  82 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 18,
+    'content' => '
+',
+    'column' => 23,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  83 =>
+  array (
+    'code' => 'BR_CLOSE',
+    'type' => 'BR_CLOSE',
+    'line' => 19,
+    'content' => '}',
+    'column' => 1,
+    'length' => 1,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
+  84 =>
+  array (
+    'code' => 'WS',
+    'type' => 'WS',
+    'line' => 19,
     'content' => '
 ',
-),
+    'column' => 2,
+    'length' => 0,
+    'level' => 0,
+    'conditions' =>
+    array (
+    ),
+  ),
 ];
diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json
index ff6e6bd..7c53401 100644
--- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json
+++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json
@@ -30,10 +30,19 @@
                     "source": "Typo3Update.Removed.TypoScript.styles-insertContent",
                     "type": "WARNING"
                 },
+                {
+                    "column": 9,
+                    "fixable": false,
+                    "line": 14,
+                    "message": "Legacy calls are not allowed; found mod.web_list.alternateBgColors. Removed in 7.0. Removed without substitution. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-53658-RemoveAlternateBgColorsOption.html",
+                    "severity": 5,
+                    "source": "Typo3Update.Removed.TypoScript.mod-web_list-alternateBgColors",
+                    "type": "WARNING"
+                },
                 {
                     "column": 1,
                     "fixable": false,
-                    "line": 13,
+                    "line": 17,
                     "message": "Legacy calls are not allowed; found mod.web_list.alternateBgColors. Removed in 7.0. Removed without substitution. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-53658-RemoveAlternateBgColorsOption.html",
                     "severity": 5,
                     "source": "Typo3Update.Removed.TypoScript.mod-web_list-alternateBgColors",
@@ -42,7 +51,7 @@
                 {
                     "column": 10,
                     "fixable": false,
-                    "line": 26,
+                    "line": 24,
                     "message": "Legacy calls are not allowed; found CLEARGIF. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html",
                     "severity": 5,
                     "source": "Typo3Update.Removed.TypoScript.CLEARGIF",
@@ -51,7 +60,7 @@
                 {
                     "column": 10,
                     "fixable": false,
-                    "line": 27,
+                    "line": 25,
                     "message": "Legacy calls are not allowed; found COLUMNS. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html",
                     "severity": 5,
                     "source": "Typo3Update.Removed.TypoScript.COLUMNS",
@@ -60,7 +69,7 @@
                 {
                     "column": 10,
                     "fixable": false,
-                    "line": 28,
+                    "line": 26,
                     "message": "Legacy calls are not allowed; found CTABLE. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html",
                     "severity": 5,
                     "source": "Typo3Update.Removed.TypoScript.CTABLE",
@@ -69,7 +78,7 @@
                 {
                     "column": 10,
                     "fixable": false,
-                    "line": 29,
+                    "line": 27,
                     "message": "Legacy calls are not allowed; found OTABLE. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html",
                     "severity": 5,
                     "source": "Typo3Update.Removed.TypoScript.OTABLE",
@@ -78,19 +87,19 @@
                 {
                     "column": 10,
                     "fixable": false,
-                    "line": 30,
+                    "line": 28,
                     "message": "Legacy calls are not allowed; found HRULER. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html",
                     "severity": 5,
                     "source": "Typo3Update.Removed.TypoScript.HRULER",
                     "type": "WARNING"
                 }
             ],
-            "warnings": 9
+            "warnings": 10
         }
     },
     "totals": {
         "errors": 0,
         "fixable": 0,
-        "warnings": 9
+        "warnings": 10
     }
 }
diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/InputFileForIssues.ts b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/InputFileForIssues.ts
index 3f9b94c..657b4a5 100644
--- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/InputFileForIssues.ts
+++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/InputFileForIssues.ts
@@ -9,14 +9,12 @@ styles.insertContent {
     }
 }
 
-# already covered
-mod.web_list.alternateBgColors = 1
-# Not covered yet
 mod {
     web_list {
         alternateBgColors = 1
     }
 }
+mod.web_list.alternateBgColors = 1
 
 page {
     CLEARGIF {
-- 
GitLab


From 31d66c17d07ba52ac522016a9b937f957d903686 Mon Sep 17 00:00:00 2001
From: Daniel Siepmann <coding@daniel-siepmann.de>
Date: Tue, 2 May 2017 10:52:53 +0200
Subject: [PATCH 2/3] TASK: Fix cgl

* Fix phpcs and phpmd issues.
---
 .../Typo3Update/Sniffs/Removed/TypoScriptSniff.php          | 6 +++---
 tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php
index 7ce75bb..a4cd3e4 100644
--- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php
+++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php
@@ -91,13 +91,13 @@ class Typo3Update_Sniffs_Removed_TypoScriptSniff extends AbstractGenericUsage
     {
         $tokens = $phpcsFile->getTokens();
         $token = $tokens[$stackPtr];
-        $objectIdentifiersToLoopUp = [$token['content']];
+        $identifiersToCheck = [$token['content']];
 
         if (isset($token[FQObjectIdentifier::IDENTIFIER]) && $token[FQObjectIdentifier::IDENTIFIER] !== $token['content']) {
-            $objectIdentifiersToLoopUp[] = $token[FQObjectIdentifier::IDENTIFIER];
+            $identifiersToCheck[] = $token[FQObjectIdentifier::IDENTIFIER];
         }
 
-        foreach ($objectIdentifiersToLoopUp as $objectIdentifier) {
+        foreach ($identifiersToCheck as $objectIdentifier) {
             if (isset($this->configured[$objectIdentifier]) && $token['type'] === $this->configured[$objectIdentifier]['type']) {
                 $this->removed = [
                     $this->configured[$objectIdentifier]
diff --git a/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php b/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php
index 805ec06..9115c7f 100644
--- a/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php
+++ b/tests/CodeSniffer/Tokenizers/FqObjectIdentifierTest.php
@@ -132,7 +132,7 @@ class FqObjectIdentifierTest extends TestCase
     /**
      * @test
      */
-    public function AddingPathSegmentAfterAnotherResetsPath()
+    public function addingPathSegmentAfterAnotherResetsPath()
     {
         $initialToken = [
             'type' => TokenInterface::TYPE_OBJECT_IDENTIFIER,
-- 
GitLab


From 3126004854a6013949a3f9644d745587ec68ed8c Mon Sep 17 00:00:00 2001
From: Daniel Siepmann <coding@daniel-siepmann.de>
Date: Tue, 2 May 2017 10:54:22 +0200
Subject: [PATCH 3/3] TASK: Remove unnecessary method call

---
 src/CodeSniffer/Tokenizers/FQObjectIdentifier.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php b/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php
index 6ebe8f9..90a9833 100644
--- a/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php
+++ b/src/CodeSniffer/Tokenizers/FQObjectIdentifier.php
@@ -91,7 +91,6 @@ class FQObjectIdentifier
     public function handleClosingBrace()
     {
         --$this->depth;
-        $this->syncPath();
     }
 
     /**
-- 
GitLab