Свойство | Тип | Описание | |
---|---|---|---|
$allowedFileExtensions | array | An array of extensions for files we will check. | |
$allowedTypes | array(string) | An array of variable types for param/var we will check. | |
$cli | PHP_CodeSniffer_CLI | The CLI object controlling the run. | |
$defaultFileExtensions | array | If no extensions are set, these will be used as the defaults. If extensions are set, these will be used when the correct tokenizer can not be determined, such as when checking a passed filename instead of files in a directory. | |
$reporting | PHP_CodeSniffer_Reporting | The Reporting object controlling report generation. | |
$sniffCodes | The key is the sniff code and the value is the fully qualified name of the sniff class. |
Свойство | Тип | Описание | |
---|---|---|---|
$file | string | The file or directory that is currently being processed. | |
$ignorePatterns | array | An array of patterns to use for skipping files. | |
$listeners | array(PHP_CodeSniffer_Sniff) | An array of sniff objects that are being used to check files. | |
$ruleset | array | It may be empty, indicating that the ruleset does not override any of the default sniff settings. | |
$rulesetDirs | string | This is declared static because it is also used in the autoloader to look for sniffs outside the PHPCS install. This way, standards designed to be installed inside PHPCS can also be used from outside the PHPCS Standards directory. | |
$sniffs | array(string) | An array of sniffs that are being used to check files. |
Метод | Описание | |
---|---|---|
__construct ( integer $verbosity, integer $tabWidth, string $encoding = 'iso-8859-1', boolean $interactive = false ) | Constructs a PHP_CodeSniffer object. | |
autoload ( string $className ) : void | Autoload static method for loading classes and interfaces. | |
chdir ( string $path ) : void | CodeSniffer alternative for chdir(). | |
generateDocs ( string $standard, array $sniffs = [], string $generator = 'Text' ) : void | Generates documentation for a coding standard. | |
getAllConfigData ( ) : array |
Get all config data in an array. | |
getConfigData ( string $key ) : string | null | Get a single config value. | |
getFilesToProcess ( string $paths, boolean $local = false ) : array | Get a list of files that will be processed. | |
getIgnorePatterns ( string $listener = null ) : array | Gets the array of ignore patterns. | |
getInstalledStandardPath ( string $standard ) : string | null | Return the path of an installed coding standard. | |
getInstalledStandardPaths ( ) : array | Get a list paths where standards are installed. | |
getInstalledStandards ( boolean $includeGeneric = false, string $standardsDir = '' ) : array | Get a list of all coding standards installed. | |
getSniffs ( ) : PHP_CodeSniffer_Sniff[] | Gets the array of PHP_CodeSniffer_Sniff's. | |
getTokenSniffs ( ) : array | Gets the array of PHP_CodeSniffer_Sniff's indexed by token type. | |
initStandard ( string | array $standards, array $restrictions = [], array $exclusions = [] ) : void | Initialise the standard that the run will use. | |
isCamelCaps ( string $string, boolean $classFormat = false, boolean $public = true, boolean $strict = true ) : boolean | Returns true if the specified string is in the camel caps format. | |
isInstalledStandard ( string $standard ) : boolean | Determine if a standard is installed. | |
isPharFile ( string $path ) : mixed | Return TRUE, if the path is a phar file. | |
isUnderscoreName ( string $string ) : boolean | Returns true if the specified string is in the underscore caps format. | |
populateTokenListeners ( ) : void | Populates the array of PHP_CodeSniffer_Sniff's for this file. | |
prepareForOutput ( string $content ) : string | Prepares token content for output to screen. | |
process ( string | array $files, string | array $standards, array $restrictions = [], boolean $local = false ) : void | Start a PHP_CodeSniffer run. | |
processFile ( string $file, string $contents = null ) : PHP_CodeSniffer_File | Run the code sniffs over a single given file. | |
processFiles ( string | array $files, boolean $local = false ) : void | Processes the files/directories that PHP_CodeSniffer was constructed with. | |
processRuleset ( string $rulesetPath, integer $depth ) : array | Processes a single ruleset and returns a list of the sniffs it represents. | |
realpath ( string $path ) : mixed | CodeSniffer alternative for realpath. | |
registerSniffs ( array $files, array $restrictions, array $exclusions ) : void | Loads and stores sniffs objects used for sniffing files. | |
setAllowedFileExtensions ( array $extensions ) : void | Sets an array of file extensions that we will allow checking of. | |
setCli ( object $cli ) : void | Sets the internal CLI object. | |
setConfigData ( string $key, string | null $value, boolean $temp = false ) : boolean | Set a single config value. | |
setEncoding ( string $encoding ) : void | Sets the encoding. | |
setIgnorePatterns ( array $patterns ) : void | Sets an array of ignore patterns that we use to skip files and folders. | |
setInteractive ( boolean $interactive ) : void | Sets the interactive flag. | |
setSniffProperty ( string $listenerClass, string $name, string $value ) : void | Set a single property for a sniff. | |
setTabWidth ( integer $tabWidth ) : void | Sets the tab width. | |
setVerbosity ( integer $verbosity ) : void | Sets the verbosity level. | |
shouldIgnoreFile ( string $path, string $basedir ) : boolean | Checks filtering rules to see if a file should be ignored. | |
shouldProcessFile ( string $path, string $basedir ) : boolean | Checks filtering rules to see if a file should be checked. | |
suggestType ( string $varType ) : string | Returns a valid variable type for param/var tag. |
Метод | Описание | |
---|---|---|
_expandRulesetReference ( string $ref, string $rulesetDir, integer $depth ) : array | Expands a ruleset reference into a list of sniff files. | |
_expandSniffDirectory ( string $directory, integer $depth ) : array | Expands a directory into a list of sniff files within. | |
_processFile ( string $file, string $contents ) : PHP_CodeSniffer_File | Process the sniffs for a single file. | |
_processRule ( SimpleXMLElement $rule, integer $depth ) : void | Processes a rule from a ruleset XML file, overriding built-in defaults. | |
_shouldProcessElement ( SimpleXMLElement $element, integer $depth ) : boolean | Determine if an element should be processed or ignored. |
public __construct ( integer $verbosity, integer $tabWidth, string $encoding = 'iso-8859-1', boolean $interactive = false ) | ||
$verbosity | integer | The verbosity level. 1: Print progress information. 2: Print tokenizer debug information. 3: Print sniff debug information. |
$tabWidth | integer | The number of spaces each tab represents. If greater than zero, tabs will be replaced by spaces before testing each file. |
$encoding | string | The charset of the sniffed files. This is important for some reports that output with utf-8 encoding as you don't want it double encoding messages. |
$interactive | boolean | If TRUE, will stop after each file with errors and wait for user input. |
public static getAllConfigData ( ) : array |
||
Результат | array |
public getIgnorePatterns ( string $listener = null ) : array | ||
$listener | string | The listener to get patterns for. If NULL, all patterns are returned. |
Результат | array |
public static getInstalledStandardPaths ( ) : array | ||
Результат | array |
public static getInstalledStandards ( boolean $includeGeneric = false, string $standardsDir = '' ) : array | ||
$includeGeneric | boolean | If true, the special "Generic" coding standard will be included if installed. |
$standardsDir | string | A specific directory to look for standards in. If not specified, PHP_CodeSniffer will look in its default locations. |
Результат | array |
public getSniffs ( ) : PHP_CodeSniffer_Sniff[] | ||
Результат | PHP_CodeSniffer_Sniff[] |
public getTokenSniffs ( ) : array | ||
Результат | array |
public initStandard ( string | array $standards, array $restrictions = [], array $exclusions = [] ) : void | ||
$standards | string | array | The set of code sniffs we are testing against. |
$restrictions | array | The sniff codes to restrict the testing to. |
$exclusions | array | The sniff codes to exclude from testing. |
Результат | void |
public static isCamelCaps ( string $string, boolean $classFormat = false, boolean $public = true, boolean $strict = true ) : boolean | ||
$string | string | The string the verify. |
$classFormat | boolean | If true, check to see if the string is in the class format. Class format strings must start with a capital letter and contain no underscores. |
$public | boolean | If true, the first character in the string must be an a-z character. If false, the character must be an underscore. This argument is only applicable if $classFormat is false. |
$strict | boolean | If true, the string must not have two capital letters next to each other. If false, a relaxed camel caps policy is used to allow for acronyms. |
Результат | boolean |
public static isInstalledStandard ( string $standard ) : boolean | ||
$standard | string | The name of the coding standard. |
Результат | boolean |
public static isPharFile ( string $path ) : mixed | ||
$path | string | The path to use. |
Результат | mixed |
public static isUnderscoreName ( string $string ) : boolean | ||
$string | string | The string to verify. |
Результат | boolean |
public populateTokenListeners ( ) : void | ||
Результат | void |
public static prepareForOutput ( string $content ) : string | ||
$content | string | The content to prepare. |
Результат | string |
public process ( string | array $files, string | array $standards, array $restrictions = [], boolean $local = false ) : void | ||
$files | string | array | The files and directories to process. For directories, each sub directory will also be traversed for source files. |
$standards | string | array | The set of code sniffs we are testing against. |
$restrictions | array | The sniff codes to restrict the violations to. |
$local | boolean | If true, don't recurse into directories. |
Результат | void |
public processFile ( string $file, string $contents = null ) : PHP_CodeSniffer_File | ||
$file | string | The file to process. |
$contents | string | The contents to parse. If NULL, the content is taken from the file system. |
Результат | PHP_CodeSniffer_File |
public registerSniffs ( array $files, array $restrictions, array $exclusions ) : void | ||
$files | array | Paths to the sniff files to register. |
$restrictions | array | The sniff class names to restrict the allowed listeners to. |
$exclusions | array | The sniff class names to exclude from the listeners list. |
Результат | void |
public setAllowedFileExtensions ( array $extensions ) : void | ||
$extensions | array | An array of file extensions. |
Результат | void |
public static setConfigData ( string $key, string | null $value, boolean $temp = false ) : boolean | ||
$key | string | The name of the config value. |
$value | string | null | The value to set. If null, the config entry is deleted, reverting it to the default value. |
$temp | boolean | Set this config data temporarily for this script run. This will not write the config data to the config file. |
Результат | boolean |
public setEncoding ( string $encoding ) : void | ||
$encoding | string | The charset of the sniffed files. This is important for some reports that output with utf-8 encoding as you don't want it double encoding messages. |
Результат | void |
public setIgnorePatterns ( array $patterns ) : void | ||
$patterns | array | An array of ignore patterns. The pattern is the key and the value is either "absolute" or "relative", depending on how the pattern should be applied to a file path. |
Результат | void |
public setInteractive ( boolean $interactive ) : void | ||
$interactive | boolean | If TRUE, will stop after each file with errors and wait for user input. |
Результат | void |
public setTabWidth ( integer $tabWidth ) : void | ||
$tabWidth | integer | The number of spaces each tab represents. If greater than zero, tabs will be replaced by spaces before testing each file. |
Результат | void |
public setVerbosity ( integer $verbosity ) : void | ||
$verbosity | integer | The verbosity level. 1: Print progress information. 2: Print tokenizer debug information. 3: Print sniff debug information. |
Результат | void |
public static suggestType ( string $varType ) : string | ||
$varType | string | The variable type to process. |
Результат | string |
public array $allowedFileExtensions | ||
Результат | array |
public static array(string) $allowedTypes | ||
Результат | array(string) |
public PHP_CodeSniffer_CLI $cli | ||
Результат | PHP_CodeSniffer_CLI |
public array $defaultFileExtensions | ||
Результат | array |
protected string $file | ||
Результат | string |
protected array $ignorePatterns | ||
Результат | array |
protected array(PHP_CodeSniffer_Sniff) $listeners | ||
Результат | array(PHP_CodeSniffer_Sniff) |
public PHP_CodeSniffer_Reporting $reporting | ||
Результат | PHP_CodeSniffer_Reporting |
protected array $ruleset | ||
Результат | array |
protected static string $rulesetDirs | ||
Результат | string |
public $sniffCodes |