Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DummyFile.php

class DummyFile

Hierarchy

  • class \PHP_CodeSniffer\Files\File
    • class \PHP_CodeSniffer\Files\DummyFile extends \PHP_CodeSniffer\Files\File

Expanded class hierarchy of DummyFile

1 file declares its use of DummyFile
Runner.php in vendor/squizlabs/php_codesniffer/src/Runner.php

File

vendor/squizlabs/php_codesniffer/src/Files/DummyFile.php, line 20

Namespace

PHP_CodeSniffer\Files
View source
class DummyFile extends File {
    
    /**
     * Creates a DummyFile object and sets the content.
     *
     * @param string                   $content The content of the file.
     * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
     * @param \PHP_CodeSniffer\Config  $config  The config data for the run.
     *
     * @return void
     */
    public function __construct($content, Ruleset $ruleset, Config $config) {
        $this->setContent($content);
        // See if a filename was defined in the content.
        // This is done by including: phpcs_input_file: [file path]
        // as the first line of content.
        $path = 'STDIN';
        if ($content !== '') {
            if (substr($content, 0, 17) === 'phpcs_input_file:') {
                $eolPos = strpos($content, $this->eolChar);
                $filename = trim(substr($content, 17, $eolPos - 17));
                $content = substr($content, $eolPos + strlen($this->eolChar));
                $path = $filename;
                $this->setContent($content);
            }
        }
        // The CLI arg overrides anything passed in the content.
        if ($config->stdinPath !== null) {
            $path = $config->stdinPath;
        }
        parent::__construct($path, $ruleset, $config);
    }
    
    //end __construct()
    
    /**
     * Set the error, warning, and fixable counts for the file.
     *
     * @param int $errorCount   The number of errors found.
     * @param int $warningCount The number of warnings found.
     * @param int $fixableCount The number of fixable errors found.
     * @param int $fixedCount   The number of errors that were fixed.
     *
     * @return void
     */
    public function setErrorCounts($errorCount, $warningCount, $fixableCount, $fixedCount) {
        $this->errorCount = $errorCount;
        $this->warningCount = $warningCount;
        $this->fixableCount = $fixableCount;
        $this->fixedCount = $fixedCount;
    }
    
    //end setErrorCounts()

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DummyFile::setErrorCounts public function Set the error, warning, and fixable counts for the file.
DummyFile::__construct public function Creates a DummyFile object and sets the content. Overrides File::__construct
File::$activeListener protected property The class name of the sniff currently processing the file.
File::$config public property The config data for the run.
File::$configCache protected property A cache of often used config settings to improve performance.
File::$content protected property The content of the file.
File::$eolChar public property The EOL character this file uses.
File::$errorCount protected property The total number of errors raised.
File::$errors protected property The errors raised from sniffs.
File::$fixableCount protected property The total number of errors and warnings that can be fixed.
File::$fixedCount protected property The total number of errors and warnings that were fixed.
File::$fixer public property The Fixer object to control fixing errors.
File::$fromCache public property Was the file loaded from cache?
File::$ignored public property If TRUE, the entire file is being ignored.
File::$ignoredCodes protected property An array of message codes that are being ignored.
File::$ignoredListeners protected property An array of sniffs that are being ignored.
File::$listeners protected property An array of sniffs listening to this file's processing.
File::$listenerTimes protected property An array of sniffs being processed and how long they took.
File::$metrics protected property The metrics recorded by sniffs.
File::$metricTokens private property The metrics recorded for each token.
File::$numTokens public property The number of tokens in this file.
File::$path public property The absolute path to the file associated with this object.
File::$replayingErrors protected property TRUE if errors are being replayed from the cache.
File::$ruleset public property The ruleset used for the run.
File::$tokenizer public property The tokenizer being used for this file.
File::$tokenizerType public property The name of the tokenizer being used for this file.
File::$tokens protected property The tokens stack map.
File::$warningCount protected property The total number of warnings raised.
File::$warnings protected property The warnings raised from sniffs.
File::addError public function Records an error against a specific token in the file.
File::addErrorOnLine public function Records an error against a specific line in the file.
File::addFixableError public function Records a fixable error against a specific token in the file.
File::addFixableWarning public function Records a fixable warning against a specific token in the file.
File::addMessage protected function Adds an error to the error stack.
File::addWarning public function Records a warning against a specific token in the file.
File::addWarningOnLine public function Records a warning against a specific line in the file.
File::cleanUp public function Remove vars stored in this file that are no longer required.
File::disableCaching public function Disables caching of this file.
File::findEndOfStatement public function Returns the position of the last non-whitespace token in a statement.
File::findExtendedClassName public function Returns the name of the class that the specified class extends.
(works for classes, anonymous classes and interfaces)
File::findFirstOnLine public function Returns the position of the first token on a line, matching given type.
File::findImplementedInterfaceNames public function Returns the names of the interfaces that the specified class or enum implements.
File::findNext public function Returns the position of the next specified token(s).
File::findPrevious public function Returns the position of the previous specified token(s).
File::findStartOfStatement public function Returns the position of the first non-whitespace token in a statement.
File::getClassProperties public function Returns the visibility and implementation properties of a class.
File::getCondition public function Return the position of the condition for the passed token.
File::getDeclarationName public function Returns the declaration name for classes, interfaces, traits, enums, and functions.
File::getErrorCount public function Returns the number of errors raised.
File::getErrors public function Returns the errors raised from processing this file.
File::getFilename public function Returns the absolute filename of this file.
File::getFixableCount public function Returns the number of fixable errors/warnings raised.
File::getFixedCount public function Returns the number of fixed errors/warnings.
File::getIgnoredLines public function Returns the list of ignored lines.
File::getListenerTimes public function Returns the time taken processing this file for each invoked sniff.
File::getMemberProperties public function Returns the visibility and implementation properties of a class member var.
File::getMethodParameters public function Returns the method parameters for the specified function token.
File::getMethodProperties public function Returns the visibility and implementation properties of a method.
File::getMetrics public function Returns the metrics found while processing this file.
File::getTokens public function Returns the token stack for this file.
File::getTokensAsString public function Returns the content of the tokens from the specified start position in
the token stack for the specified length.
File::getWarningCount public function Returns the number of warnings raised.
File::getWarnings public function Returns the warnings raised from processing this file.
File::hasCondition public function Determine if the passed token has a condition of one of the passed types.
File::isReference public function Determine if the passed token is a reference operator.
File::parse public function Tokenizes the file and prepares it for the test run.
File::process public function Starts the stack traversal and tells listeners when tokens are found. 1
File::recordMetric public function Record a metric about the file being examined.
File::reloadContent public function Reloads the content of the file. 1
File::setContent public function Set the content of the file.
RSS feed
Powered by Drupal