-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
These are preliminary roadmap notes for future PHPCSUtils versions
PHPCSUtils 1.1.0 (released)
- Add utility method to retrieve an array with stack pointers + names of all constants declared in an OO structure. - PR ✨ New ObjectDeclarations::getDeclared*() utility methods #592
- Add utility method to retrieve an array with stack pointers + names of all properties declared in an OO structure. - PR ✨ New ObjectDeclarations::getDeclared*() utility methods #592
- Add utililty method to retrieve an array with stack pointers + names of all methods declared in an OO structure. - PR ✨ New ObjectDeclarations::getDeclared*() utility methods #592
- Add utililty method to retrieve an array with stack pointers + names of all cases declared in an enum. - PR ✨ New ObjectDeclarations::getDeclared*() utility methods #592
-
Add utililty method to retrieve an array with stack pointers + names of all functions declared in a file in the current namespace (outside OO).(see Trackers) - Add utility class
Constantsfor working with (OO) constant declarations. - PR ✨ New PHPCSUtils\Utils\Constants class + associated token collection #562
Initial list of methods:getMemberProperties(File $phpcsFile, int $stackPtr): arrayto retrieve the modifier information for an OO constant declaration, i.e. returns an array withis_final,final_token,visibility,visibility_tokenkeys (can befalseif visibility is not explicitly specified).
- Add utility class
TypeStringfor working with type declaration strings. - ✨ New TypeString utility class #588
Preliminary list of methods:isSingularType(string $typeString): boolisComplexType(string $typeString): boolisUnionType(string $typeString): boolisIntersectionType(string $typeString): boolisDNFType(string $typeString): bool(PHP 8.2+ disjunctive normal form)getTypes(string $typeString): arrayto split a type string into its individual parts
(Note to self: mind whitespace (and comments) within types! - Confirmed thatBCFile,FunctionDeclarationsandVariablesmethods return a type string without comments and whitespace)getOOTypes(string $typeString): arrayto get only the OO names from a type string
PHPCSUtils 1.2.0 (released)
- Add various utilities around PHP attributes. - ✨ New
*::getAttributeOpeners()methods #719, ✨ NewPHPCSUtils\Utils\AttributeBlockclass #720, ✨ New PHPCSUtils\Utils\AttributeBlock::appliesTo() method #729
PHPCSUtils 1.3.0 (or later)
- Add
isUseOfGlobalConstant()method to determine whether an arbitrary name token (in PHPCS 3.x alwaysT_STRING) is the use of a "global" constant, with the caveats that unless the constant is declared in the current file or imported via ause conststatement, the method will not be able to distinguish between a global and a namespaced token when the constant is declared in the current namespace. - Add utililty class for resolving inline names to fully qualified names.
- Add a number of "tracker" classes which keep track of certain information seen in a file, like seen namespaces, current namespace, seen use statements etc
- NamespaceTracker
- ImportUseTracker
- DeclaredFunctionsTracker (non-OO)
- Add abstract sniff classes for a couple of frequently occurring situations, like:
- Detecting all places a certain class name is used (
extends,new,instanceof,catch, use statements, type declarations etc). - Detecting all places a certain interface name is used (
extends(for interface declarations),implements,instanceof, use statements, type declarations etc). - Detecting all places a certain function name is used (function calls,
use functionstatements, maybe callbacks). - Detecting all places a certain constant name is used (constant use,
use conststatements). - Examining the parameters of function calls to a limited list of functions.
- Detecting all places a certain class name is used (
PHPCSUtils 1.4.0 (or later)
- Add utililty class to find the docblock for a construct, supporting all typical constructs which take docblocks (file, OO, function, constant, property, enum case, etc)
- Add utililty class to work with docblock tags and their descriptions
- Add utility class to work with inline comments
Future scope (version to be determined)
- Improved version of the PHPCS native
AbstractScopeSniff, i.e. more akin toAbstractDirectScopeto allow for sniffs to run certain code for tokens in the global scope and other code for tokens in an OO/function scope. - Add abstract base test class for use by external standards:
- Fully compatible with the functionality in the PHPCS native
PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest. - Allow for running sniff class tests on PHPUnit 4.x - 9.x.
- Allow for verifying that the correct error code(s) are being shown on each line expecting errors/warnings.
- Allow for testing the error/warning messages.
- Allow for testing the metrics.
- Runs with a clean
Configfor each test class to prevent configuration directives set for one sniff influencing the tests for another.
- Fully compatible with the functionality in the PHPCS native
-
NamingConventions: a set of methods to verify a "label name" (class, function etc) complies with certain naming conventions and methods to convert a label to a certain convention - Add abstract sniff class to examine callbacks
- Add helper method to parse an enum declaration statement ?
- Add
TypeString::isValid(string $typeString): boolto verify that a type string is valid ?
This could potentially check for things like:
- Duplicate names/types in the type string
- Nullability operator?being used with complex types (should use|null)
- Invalid types likeresourcebeing used ?