From 640f85af7dd67bd13efe675457497ce0e4e930b3 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 9 May 2017 13:20:20 +0200 Subject: [PATCH] TASK: Update InheritanceSniff tests to reflect added removed extension Relates: #44 --- .../Sniffs/Classname/InheritanceSniff.php | 16 +++++++--- .../Classname/InheritanceSniff/Expected.json | 31 +++++++++++++++++-- .../InheritanceSniff/InputFileForIssues.php | 7 +++++ 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff.php b/src/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff.php index 2ce6d36..ffcf0ad 100644 --- a/src/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff.php @@ -72,11 +72,19 @@ class Typo3Update_Sniffs_Classname_InheritanceSniff extends AbstractClassnameChe return; } + $lastPosition = $phpcsFile->findNext(T_OPEN_CURLY_BRACKET, $stackPtr); + foreach ($interfaces as $interface) { - $position = $phpcsFile->findNext(T_STRING, $stackPtr, null, false, $interface); - if ($position === false) { - continue; - } + $interface = trim($interface, '\\'); + $position = $stackPtr; + + do { + try { + list($position, $classname) = $this->getAfter($phpcsFile, $position + 1); + } catch (\UnexpectedValueException $e) { + continue 2; + } + } while ($classname !== $interface && $position <= $lastPosition); $this->processFeatures($phpcsFile, $position, $interface); } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/Expected.json index e441162..a4d63d5 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/Expected.json +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/Expected.json @@ -56,14 +56,41 @@ "severity": 5, "source": "Typo3Update.Classname.Inheritance.legacyClassname", "type": "ERROR" + }, + { + "column": 35, + "fixable": false, + "line": 34, + "message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html", + "severity": 5, + "source": "Typo3Update.Classname.Inheritance.RemovedExtension.perm", + "type": "WARNING" + }, + { + "column": 6, + "fixable": false, + "line": 35, + "message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html", + "severity": 5, + "source": "Typo3Update.Classname.Inheritance.RemovedExtension.perm", + "type": "WARNING" + }, + { + "column": 5, + "fixable": false, + "line": 36, + "message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html", + "severity": 5, + "source": "Typo3Update.Classname.Inheritance.RemovedExtension.perm", + "type": "WARNING" } ], - "warnings": 0 + "warnings": 3 } }, "totals": { "errors": 6, "fixable": 6, - "warnings": 0 + "warnings": 3 } } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/InputFileForIssues.php index ee8fd0f..4eeafb3 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/InputFileForIssues.php +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InheritanceSniff/InputFileForIssues.php @@ -30,3 +30,10 @@ class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager i { } + +class InputFileForIssues extends \TYPO3\CMS\Perm\Controller\PermissionAjaxController implements + \TYPO3\CMS\Perm\Controller\PermissionAjaxController, + TYPO3\CMS\Perm\Controller\PermissionModuleController +{ + +}