protected function processReturnType(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        if (isset($tokens[($stackPtr - 1)]['code']) === false) {
            return;
        }

        $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);

        // Deal with namespaced class names.
        if ($tokens[$previous]['code'] === \T_NS_SEPARATOR) {
            $validTokens                  = Tokens::$emptyTokens;
            $validTokens[\T_STRING]       = true;
            $validTokens[\T_NS_SEPARATOR] = true;

            $stackPtr--;

            while (isset($validTokens[$tokens[($stackPtr - 1)]['code']]) === true) {
                $stackPtr--;
            }

            $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
        }

        // T_NULLABLE token was introduced in PHPCS 2.7.2. Before that it identified as T_INLINE_THEN.
        if ((\defined('T_NULLABLE') === true && $tokens[$previous]['type'] === 'T_NULLABLE')
            || (\defined('T_NULLABLE') === false && $tokens[$previous]['code'] === \T_INLINE_THEN)
        ) {
            $phpcsFile->addError(
                'Nullable return types are not supported in PHP 7.0 or earlier.',
                $stackPtr,
                'returnTypeFound'
            );
        }
    }