PhpCodeSnifferTask

Extends \Task

A PHP code sniffer task. Checking the style of one or more PHP source files.

Use \Project#createTask to register a new Task.

author

Dirk Thomas dirk.thomas@4wdmedia.de

version

$Id: e635b2512b71e17b616bda5e66b412984c0718b0 $

package

phing.tasks.ext

Methods

Nested adder, adds a set of files (nested fileset attribute).

addFileSet(\FileSet $fs) : void

Arguments

$fs

\FileSet

Creates a config parameter for this task

createConfig() : \Parameter

Response

\Parameter

The created parameter

Create object for nested formatter element.

createFormatter() : \CodeSniffer_FormatterElement

Response

\CodeSniffer_FormatterElement

Returns the textual description of the task

getDescription() : string
inherited

Response

string

The text description of the task

Return the list of files to parse

getFilesToParse() : array<mixed,string>

Response

array<mixed,string>

list of absolute files to parse

Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

getLocation() : \Location
inherited

Response

\Location

The location object describing the position of this task within the buildfile.

Returns the owning target of this task.

getOwningTarget() : \Target
inherited

Response

\Target

The target object that owns this task

Returns a reference to current project

getProject() : \Project
inherited

Response

\Project

Reference to current porject object

Returns the name of the property to use

getPropertyName() 

Returns a name

getRegisterSlot(string $slotName) : \RegisterSlot
inherited

Arguments

$slotName

string

Response

\RegisterSlot

Returns the wrapper object for runtime configuration

getRuntimeConfigurableWrapper() : \RuntimeConfigurable
inherited

Response

\RuntimeConfigurable

The wrapper object used by this task

Returns the name of task, used only for log messages

getTaskName() : string
inherited

Response

string

Name of this task

Returns the name of the task under which it was invoked, usually the XML tagname

getTaskType() : string
inherited

Response

string

The type of this task (XML Tag)

Called by the parser to let the task initialize properly.

init() 
inherited

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

throws

Logs a message with the given priority.

log(string $msg, integer $level = \Project::MSG_INFO) : void
inherited

Arguments

$msg

string

The message to be logged.

$level

integer

The message's priority at this message should have

Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.

main() 
inherited abstract

Should throw a BuildException if someting goes wrong with the build

This is abstract here. Must be overloaded by real tasks.

Configure this task if it hasn't been done already.

maybeConfigure() 
inherited

Outputs the results with a custom format

outputCustomFormat(array $report) 

Arguments

$report

array

Packaged list of all errors in each file

Outputs the messages of a specific type for one file

outputCustomFormatMessages(array $messages, string $type) 

Arguments

$messages

array

$type

string

Perfrom this task

perform() 
inherited
throws

Prints the error report.

printErrorReport(\PHP_CodeSniffer $phpcs) 

Arguments

$phpcs

\PHP_CodeSniffer

The PHP_CodeSniffer object containing the errors.

Sets the allowed file extensions when using directories instead of specific files

setAllowedFileExtensions(array $extensions) 

Arguments

$extensions

array

Sets the allowed types for the PHP_CodeSniffer::suggestType()

setAllowedTypes(array $types) 

Arguments

$types

array

Whether to store last-modified times in cache

setCacheFile(\PhingFile $file) 

Arguments

$file

\PhingFile

Sets a textual description of the task

setDescription(string $desc) 
inherited

Arguments

$desc

string

The text describing the task

Sets the outfile for the documentation

setDocFile(\PhingFile $file) : void

Arguments

$file

\PhingFile

The outfile for the doc

Sets the type of the doc generator

setDocGenerator(string $generator) : void

Arguments

$generator

string

HTML or Text

Sets file encoding

setEncoding(string $encoding) 

Arguments

$encoding

string

File to be performed syntax check on

setFile(\PhingFile $file) 

Arguments

$file

\PhingFile

Sets the output format

setFormat(string $format) 

Arguments

$format

string

Sets the haltonerror flag

setHaltonerror(boolean $value) 

Arguments

$value

boolean

Sets the haltonwarning flag

setHaltonwarning(boolean $value) 

Arguments

$value

boolean

Sets the location within the buildfile this task occurs. Called by the parser to set location information.

setLocation(\Location $location) 
inherited

Arguments

$location

\Location

The location object describing the position of this task within the buildfile.

Sets the flag if subdirectories should be skipped

setNoSubdirectories(boolean $subdirectories) 

Arguments

$subdirectories

boolean

Sets the owning target this task belongs to.

setOwningTarget(\Target $target) 
inherited

Arguments

$target

\Target

References the project to the current component.

setProject(\Project $project) : void
inherited

Arguments

$project

\Project

The reference to the current project

Sets the name of the property to use

setPropertyName( $propertyName) 

Arguments

$propertyName

Sets the width of the report

setReportWidth(integer $width) : void

Arguments

$width

integer

How wide the screen reports should be.

Sets the wrapper object this task should use for runtime configurable elements.

setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper) 
inherited

Arguments

$wrapper

\RuntimeConfigurable

The wrapper object this task should use

Sets the flag if the used sniffs should be listed

setShowSniffs(boolean $show) 

Arguments

$show

boolean

Sets the flag if sources should be shown

setShowSources(boolean $show) : void

Arguments

$show

boolean

Whether to show sources or not

Sets the flag if warnings should be shown

setShowWarnings(boolean $show) 

Arguments

$show

boolean

Sets the skipversioncheck flag

setSkipVersionCheck(boolean $value) 

Arguments

$value

boolean

Sets the sniffs which the standard should be restricted to

setSniffs(string $sniffs) 

Arguments

$sniffs

string

Sets the coding standard to test for

setStandard(string $standards) : void

Arguments

$standards

string

The coding standards

Sets the tab width to replace tabs with spaces

setTabWidth(integer $width) 

Arguments

$width

integer

Sets the name of this task for log messages

setTaskName(string $name) : string
inherited

Arguments

$name

string

Response

string

A string representing the name of this task for log

Sets the type of the task. Usually this is the name of the XML tag

setTaskType( $name) 
inherited

Arguments

$name

Sets the verbosity level

setVerbosity(integer $level) 

Arguments

$level

integer

Properties

A php source code filename or directory

file : \PhingFile
var

Type(s)

\PhingFile

All fileset objects assigned to this task

filesets : array<mixed,\FileSet>
var

Type(s)

array<mixed,\FileSet>

standards

standards : 

Type(s)

sniffs

sniffs : 

Type(s)

showWarnings

showWarnings : 

Type(s)

showSources

showSources : 

Type(s)

reportWidth

reportWidth : 

Type(s)

verbosity

verbosity : 

Type(s)

tabWidth

tabWidth : 

Type(s)

allowedFileExtensions

allowedFileExtensions : 

Type(s)

allowedTypes

allowedTypes : 

Type(s)

ignorePatterns

ignorePatterns : 

Type(s)

noSubdirectories

noSubdirectories : 

Type(s)

configData

configData : 

Type(s)

encoding

encoding : 

Type(s)

showSniffs

showSniffs : 

Type(s)

format

format : 

Type(s)

formatters

formatters : 

Type(s)

Holds the type of the doc generator

docGenerator : string
var

Type(s)

string

Holds the outfile for the documentation

docFile : \PhingFile
var

Type(s)

\PhingFile

haltonerror

haltonerror : 

Type(s)

haltonwarning

haltonwarning : 

Type(s)

skipversioncheck

skipversioncheck : 

Type(s)

propertyName

propertyName : 

Type(s)

Cache data storage

cache : \DataStore
var

Type(s)

\DataStore

Owning Target object

target : \Target
inherited
var

Type(s)

\Target

Description of the task

description : string
inherited
var

Type(s)

string

Internal taskname (req)

taskType : string
inherited
var

Type(s)

string

Taskname for logger

taskName : string
inherited
var

Type(s)

string

Stored buildfile location

location : \Location
inherited
var

Type(s)

\Location

Wrapper of the task

wrapper : \RuntimeConfigurable
inherited
var

Type(s)

\RuntimeConfigurable

Holds a reference to the project that a project component (a task, a target, etc.) belongs to

project : \Project
inherited
var

A reference to the current project instance

Type(s)

\Project