TASK: Add further test cases to GenericConstantUsageSniff

* To show what's also working and what will potentially provide non
  helpful warnings.

Relates: #64
This commit is contained in:
Daniel Siepmann 2017-04-13 12:02:44 +02:00
parent 9a905c492a
commit 6a3d18ecfc
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 35 additions and 2 deletions

View file

@ -20,14 +20,41 @@
"severity": 5,
"source": "Typo3Update.Removed.GenericConstantUsage.TYPO3_MOD_PATH",
"type": "WARNING"
},
{
"column": 75,
"fixable": false,
"line": 24,
"message": "Legacy calls are not allowed; found constant \\TYPO3\\CMS\\IndexedSearch\\Controller\\SearchFormController::WILDCARD_LEFT. Removed in 7.6. Use \\TYPO3\\CMS\\IndexedSearch\\Utility\\LikeWildcard::LEFT instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-69227-StringsForLikeAreNotProperlyEscaped.html",
"severity": 5,
"source": "Typo3Update.Removed.GenericConstantUsage.SearchFormController.WILDCARD_LEFT",
"type": "WARNING"
},
{
"column": 39,
"fixable": false,
"line": 27,
"message": "Legacy calls are not allowed; found constant \\TYPO3\\CMS\\IndexedSearch\\Controller\\SearchFormController::WILDCARD_LEFT. Removed in 7.6. Use \\TYPO3\\CMS\\IndexedSearch\\Utility\\LikeWildcard::LEFT instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-69227-StringsForLikeAreNotProperlyEscaped.html",
"severity": 5,
"source": "Typo3Update.Removed.GenericConstantUsage.SearchFormController.WILDCARD_LEFT",
"type": "WARNING"
},
{
"column": 66,
"fixable": false,
"line": 29,
"message": "Legacy calls are not allowed; found constant \\TYPO3\\CMS\\IndexedSearch\\Controller\\SearchFormController::WILDCARD_LEFT. Removed in 7.6. Use \\TYPO3\\CMS\\IndexedSearch\\Utility\\LikeWildcard::LEFT instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-69227-StringsForLikeAreNotProperlyEscaped.html",
"severity": 5,
"source": "Typo3Update.Removed.GenericConstantUsage.SearchFormController.WILDCARD_LEFT",
"type": "WARNING"
}
],
"warnings": 2
"warnings": 5
}
},
"totals": {
"errors": 0,
"fixable": 0,
"warnings": 2
"warnings": 5
}
}

View file

@ -21,3 +21,9 @@
$file = PATH_tslib . 'something.php';
$module = TYPO3_MOD_PATH . '/folder';
$someVariable = \TYPO3\CMS\IndexedSearch\Controller\SearchFormController::WILDCARD_LEFT . '/folder';
use \TYPO3\CMS\IndexedSearch\Controller\SearchFormController;
// Will work, as we only check last part of class name.
$someVariable = SearchFormController::WILDCARD_LEFT . '/folder';
// Also matches, as we don't check whole name for now, to enable the above check with imported name.
$someVariable = \Vendor\ExtName\Controller\SearchFormController::WILDCARD_LEFT . '/folder';