Chris@0: getTokens(); Chris@0: if ($tokens[$stackPtr]['content'] === 't') { Chris@0: $argument = $this->getArgument(2); Chris@0: } else { Chris@0: // For watchdog() the placeholders are in the third argument. Chris@0: $argument = $this->getArgument(3); Chris@0: } Chris@0: Chris@0: if ($argument === false) { Chris@0: return; Chris@0: } Chris@0: Chris@0: if ($tokens[$argument['start']]['code'] !== T_ARRAY) { Chris@0: return; Chris@0: } Chris@0: Chris@0: $checkPlain = $argument['start']; Chris@0: while (($checkPlain = $phpcsFile->findNext(T_STRING, ($checkPlain + 1), $tokens[$argument['start']]['parenthesis_closer'])) !== false) { Chris@0: if ($tokens[$checkPlain]['content'] === 'check_plain') { Chris@0: // The check_plain() could be embedded with string concatenation, Chris@0: // which we want to allow. Chris@0: $previous = $phpcsFile->findPrevious(T_WHITESPACE, ($checkPlain - 1), $argument['start'], true); Chris@0: if ($previous === false || $tokens[$previous]['code'] !== T_STRING_CONCAT) { Chris@0: $warning = 'The extra check_plain() is not necessary for placeholders, "@" and "%" will automatically run check_plain()'; Chris@0: $phpcsFile->addWarning($warning, $checkPlain, 'CheckPlain'); Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: }//end processFunctionCall() Chris@0: Chris@0: Chris@0: }//end class