for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PHPCompatibility_Sniffs_PHP_NewGroupUseDeclarationsSniff.
*
* PHP version 7.0
* @category PHP
* @package PHPCompatibility
* @author Wim Godden <[email protected]>
*/
class PHPCompatibility_Sniffs_PHP_NewGroupUseDeclarationsSniff extends PHPCompatibility_Sniff
{
* Returns an array of tokens this test wants to listen for.
* @return array
public function register()
if (version_compare(PHP_CodeSniffer::VERSION, '2.3.4') >= 0) {
return array(T_OPEN_USE_GROUP);
} else {
return array();
}
}//end register()
* Processes this test, when one of its tokens is encountered.
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
* @return void
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
if (!$this->supportsAbove('7.0')) {
$phpcsFile->addError('Group use declarations are not allowed in PHP 5.6 or earlier', $stackPtr);
}//end process()
}//end class