1.0.0-alpha1 - 2020-01-23
Pre-release
Pre-release
Initial alpha release containing:
- A
PHPCS23Utils
standard which can be used to allow an external PHPCS standard to be compatible with both PHPCS 2.x as well as 3.x. - A
PHPCSUtils
standard which contains generic utilities which can be used when writing sniffs.
This standard does not contain any sniffs!
To use these utilities in PHPCS 3.x, all that is needed is for this package to be installed and registered with PHPCS usinginstalled_paths
. If the package is requested via Composer, this will automatically be handled by the DealerDirect Composer PHPCS plugin.
To use these utilities in PHPCS 2.x, make sure the external standard includes thePHPCS23Utils
standard in theruleset.xml
file like so:<rule ref="PHPCS23Utils"/>
.
All utilities offered are compatible with PHP_CodeSniffer 2.6.0 up to the latest stable release.
This initial alpha release contains the following utility classes:
Abstract Sniffs
AbstractArrayDeclarationSniff
: to examine array declarations.
Backcompat
BCFile
: Backport of the latest versions of PHPCS native utility functions from thePHP_CodeSniffer\Files\File
class to make them available in older PHPCS versions without the bugs and other quirks that the older versions of the native functions had.BCTokens
: Backport of the latest versions of PHPCS native token arrays from thePHP_CodeSniffer\Util\Tokens
class to make them available in older PHPCS versions.Helper
: Utility methods to retrieve (configuration) information from PHP_CodeSniffer 2.x as well as 3.x.
Fixers
SpacesFixer
: Utility to check and, if necessary, fix the whitespace between two tokens.
TestUtils
UtilityMethodTestCase
: Base class for use when testing utility methods for PHP_CodeSniffer.
Compatible with both PHPCS 2.x as well as 3.x. Supports PHPUnit 4.x up to 8.x.
See the usage instructions in the class docblock.
Tokens
Collections
: Collections of related tokens as often used and needed for sniffs.
These are additional "token groups" to compliment the ones available through the PHPCS nativePHP_CodeSniffer\Util\Tokens
class.
Utils
Arrays
: Utility functions for use when examining arrays.Conditions
: Utility functions for use when examining token conditions.FunctionDeclarations
: Utility functions for use when examining function declaration statements.GetTokensAsString
: Utility functions to retrieve the content of a set of tokens as a string.Lists
: Utility functions to retrieve information when working with lists.Namespaces
: Utility functions for use when examining T_NAMESPACE tokens and to determine the namespace of arbitrary tokens.Numbers
: Utility functions for working with integer/float tokens.ObjectDeclarations
: Utility functions for use when examining object declaration statements.Operators
: Utility functions for use when working with operators.Orthography
: Utility functions for checking the orthography of arbitrary text strings.Parentheses
: Utility functions for use when examining parenthesis tokens and arbitrary tokens wrapped in parentheses.PassedParameters
: Utility functions to retrieve information about parameters passed to function calls, array declarations, isset and unset constructs.Scopes
: Utility functions for use when examining token scopes.TextStrings
: Utility functions for working with text string tokens.UseStatements
: Utility functions for examining use statements.Variables
: Utility functions for use when examining variables.