*/ public function register() { return [\T_INLINE_THEN]; } /** * Processes this test, when one of its tokens is encountered. * * @since 1.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 (Operators::isShortTernary($phpcsFile, $stackPtr) === false) { $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'long'); return; } $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'short'); $phpcsFile->addError( 'Using short ternaries is not allowed as they are rarely used correctly', $stackPtr, 'Found' ); } }