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

        $value = $tokens[$stackPtr]['content'];
        if (isset(Tokens::$stringTokens[$tokens[$stackPtr]['code']]) === true) {
            $value = $this->stripQuotes($value);
        }

        $isError = false;
        if (isset($this->newDirectives[$directive]['valid_values'])) {
            if (\in_array($value, $this->newDirectives[$directive]['valid_values']) === false) {
                $isError = true;
            }
        } elseif (isset($this->newDirectives[$directive]['valid_value_callback'])) {
            $valid = \call_user_func(array($this, $this->newDirectives[$directive]['valid_value_callback']), $value);
            if ($valid === false) {
                $isError = true;
            }
        }

        if ($isError === true) {
            $error     = 'The execution directive %s does not seem to have a valid value. Please review. Found: %s';
            $errorCode = $this->stringToErrorCode($directive) . 'InvalidValueFound';
            $data      = array(
                $directive,
                $value,
            );

            $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
        }
    }
protected function addWarningOnInvalidValue(File $phpcsFile, $stackPtr, $directive)
    {
        $tokens = $phpcsFile->getTokens();

        $value = $tokens[$stackPtr]['content'];
        if (isset(Tokens::$stringTokens[$tokens[$stackPtr]['code']]) === true) {
            $value = $this->stripQuotes($value);
        }

        $isError = false;
        if (isset($this->newDirectives[$directive]['valid_values'])) {
            if (\in_array($value, $this->newDirectives[$directive]['valid_values']) === false) {
                $isError = true;
            }
        } elseif (isset($this->newDirectives[$directive]['valid_value_callback'])) {
            $valid = \call_user_func(array($this, $this->newDirectives[$directive]['valid_value_callback']), $value);
            if ($valid === false) {
                $isError = true;
            }
        }

        if ($isError === true) {
            $error     = 'The execution directive %s does not seem to have a valid value. Please review. Found: %s';
            $errorCode = $this->stringToErrorCode($directive) . 'InvalidValueFound';
            $data      = array(
                $directive,
                $value,
            );

            $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
        }
    }
protected function addWarningOnInvalidValue ( File $ phpcsFile , $ stackPtr , $ directive ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ value = $ tokens [ $ stackPtr ] [ 'content' ] ; if ( isset ( Tokens :: $ stringTokens [ $ tokens [ $ stackPtr ] [ 'code' ] ] ) === true ) { $ value = $ this -> stripQuotes ( $ value ) ; } $ isError = false ; if ( isset ( $ this -> newDirectives [ $ directive ] [ 'valid_values' ] ) ) { if ( \ in_array ( $ value , $ this -> newDirectives [ $ directive ] [ 'valid_values' ] ) === false ) { $ isError = true ; } } elseif ( isset ( $ this -> newDirectives [ $ directive ] [ 'valid_value_callback' ] ) ) { $ valid = \ call_user_func ( array ( $ this , $ this -> newDirectives [ $ directive ] [ 'valid_value_callback' ] ) , $ value ) ; if ( $ valid === false ) { $ isError = true ; } } if ( $ isError === true ) { $ error = 'The execution directive %s does not seem to have a valid value. Please review. Found: %s' ; $ errorCode = $ this -> stringToErrorCode ( $ directive ) . 'InvalidValueFound' ; $ data = array ( $ directive , $ value , ) ; $ phpcsFile -> addWarning ( $ error , $ stackPtr , $ errorCode , $ data ) ; } }
Generates a error or warning for this sniff.

@param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int                   $stackPtr  The position of the execution directive value
in the token array.
@param string                $directive The directive.

@return void
Generates a error or warning for this sniff .