*/ public function register() { return [\T_ANON_CLASS]; } /** * Processes this test, when one of its tokens is encountered. * * @since 7.0.0 * * @param \PHP_CodeSniffer\Files\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(File $phpcsFile, $stackPtr) { if (ScannedCode::shouldRunOnOrBelow('5.6') === false) { return; } $phpcsFile->addError( 'Anonymous classes are not supported in PHP 5.6 or earlier', $stackPtr, 'Found' ); } }