1.0.0-alpha3 - 2020-06-29
Pre-release
Pre-release
Notes:
- While still in alpha, some BC-breaks may be introduced. These are clearly indicated in the changelog with the
⚠️ symbol. - Until PHPCS 4.x has been released, PHPCSUtils does not formally support it, though an effort is made to keep up with the changes and anticipate potential compatibility issues.
For testing purposes, the composer configuration allows for PHPCSUtils to be installed with PHPCS 4.x. - Until PHP 8.0 has been released, PHPCSUtils does not formally support it, though an effort is made to keep up with the changes and anticipate potential compatibility issues.
For testing purposes, the composer configuration allows for PHPCSUtils to be installed with PHP 8.
Added
- New
PHPCSUtils\Utils\NamingConventions
class: Utility functions for working with identifier names (namespace names, class/trait/interface names, function names, variable and constant names). #119 - New
PHPCSUtils\BackCompat\Helper::getEncoding()
method. #118 - New
PHPCSUtils\Utils\ControlStructures::getCaughtExceptions()
method. #114, #138 - New
PHPCSUtils\Utils\UseStatements::splitAndMergeImportUseStatement()
method. #117
PHPCS Backcompat
BCFile::getMethodProperties()
: support for "static" as a return type (PHP 8). #134 PHPCS#2952
TestUtils
UtilityMethodTestCase
: new public$phpcsVersion
property for use in tests. #107
Note: if the PHPCS version is needed within a data provider method for a test,Helper::getVersion()
still needs to be used as the data providers are run before thesetUpBeforeClass()
-like methods which set the property.
Tokens
- New
Collections::$incrementDecrementOperators
property. #130 - New
Collections::$magicConstants
property. #106 - New
Collections::$objectOperators
property. #130 - New
Collections::$OOHierarchyKeywords
property representing the keywords to access properties or methods from inside a class definition, i.eself
,parent
andstatic
. #115 - New
Collections::$OONameTokens
property containing tokens which can be part of a partially/fully qualified name when used in inline code. #113 - New
Collections::functionDeclarationTokens()
method to retrieve the tokens which represent a keyword starting a function declaration. #133
This method is compatible with PHPCS 3.5.3 and higher. - New
Collections::functionDeclarationTokensBC()
method to retrieve the tokens which represent a keyword starting a function declaration (cross-version compatible). #133
This method is compatible with PHPCS 2.6.0 and higher. - New
Collections::parameterTypeTokensBC()
method to retrieve the tokens which need to be recognized for parameter types cross-version. #109
Use this method when the implementing standard needs to support PHPCS < 3.3.0. - New
Collections::propertyTypeTokensBC()
method to retrieve the tokens which need to be recognized for property types cross-version. #109
Use this method when the implementing standard needs to support PHPCS < 3.3.0. - New
Collections::returnTypeTokensBC()
method to retrieve the tokens which need to be recognized for return types cross-version. #109
Use this method when the implementing standard needs to support PHPCS < 3.5.4. Collections::$returnTypeTokens
: support for "static" as a return type (PHP 8). #134
Utils
FunctionDeclarations::getProperties()
: support for "static" as a return type (PHP 8). #134
Changed
PHPCS Backcompat
BCFile::getDeclarationName()
: has been made compatible with PHPCS 4.x. #110BCFile::getMethodProperties()
: has been made compatible with PHPCS 4.x. #109BCFile::getMemberProperties()
: has been made compatible with PHPCS 4.x. #109BCTokens
:⚠️ The visibility of theBCTokens::$phpcsCommentTokensTypes
,BCTokens::$ooScopeTokens
,BCTokens::$textStringTokens
properties has changed fromprotected
toprivate
. #139Helper::setConfigData()
: has been made compatible with PHPCS 4.x. #137
A new$config
parameter has been added to the method. This parameter is a required parameter when the method is used with PHPCS 4.x.
TestUtils
UtilityMethodTestCase
: tests for JS/CSS will now automatically be skipped when run in combination with PHPCS 4.x (which drops JS/CSS support). #111- Confirmed that the currently available test utils are compatible with PHPUnit 9.x. #103
Tokens
Collections::$parameterTypeTokens
: has been made compatible with PHPCS 4.x. #109
⚠️ This removes support for PHPCS < 3.3.0 from the property. Use theCollections::parameterTypeTokensBC()
method instead if PHPCS < 3.3.0 needs to be supported.Collections::$propertyTypeTokens
: has been made compatible with PHPCS 4.x. #109
⚠️ This removes support for PHPCS < 3.3.0 from the property. Use theCollections::propertyTypeTokensBC()
method instead if PHPCS < 3.3.0 needs to be supported.Collections::$returnTypeTokens
: has been made compatible with PHPCS 4.x. #109
⚠️ This removes support for PHPCS < 3.5.4 from the property. Use theCollections::returnTypeTokensBC()
method instead if PHPCS < 3.5.4 needs to be supported.
Utils
FunctionDeclarations::getArrowFunctionOpenClose()
: has been made compatible with PHPCS 4.x. #109FunctionDeclarations::getProperties()
: has been made compatible with PHPCS 4.x. #109⚠️ Lists::getAssignments()
: the return value of the method has been consolidated to be less fiddly to work with. #129⚠️ Thenested_list
index key in the return value has been renamed tois_nested_list
.
ObjectDeclarations::getName()
: has been made compatible with PHPCS 4.x. #110Variables::getMemberProperties()
: has been made compatible with PHPCS 4.x. #109
Other
- Composer: PHPCSUtils can now be installed in combination with PHPCS
4.0.x-dev@dev
for testing purposes. - Composer: The version requirements for the DealerDirect Composer PHPCS plugin have been widened to allow for version 0.7.0 which supports Composer 2.0.0.
- Readme/website homepage: textual improvements. Props @GaryJones. #121
- Readme/website homepage: added additional FAQ question & answers. #157
- The website homepage is now generated using the GitHub Pages gem with Jekyll, making maintenance easier. #141
- Significant improvements to the docblock documentation and by extension the generated API documentation. #145, #146, #147, #148, #149, #150, #151, #152, #153, 154, #155, #156
- Various housekeeping.
Fixed
Abstract Sniffs
AbstractArrayDeclarationSniff
: improved parse error handling. #99
PHPCS Backcompat
BCFile::findEndOfStatement()
: now supports arrow functions when used as a function argument, in line with the same change made in PHPCS 3.5.5. #143BcFile::isReference()
: bug fix, the reference operator was not recognized as such for closures declared to return by reference. #160 PHPCS#2977
Utils
FunctionDeclarations::getArrowFunctionOpenClose()
: now supports arrow functions when used as a function argument, in line with the same change made in PHPCS 3.5.5. #143FunctionDeclarations::getArrowFunctionOpenClose()
: now supports for arrow functions returning heredoc/nowdocs, in line with the same change made in PHPCSmaster
and expected to be released in PHPCS 3.5.6. #143FunctionDeclarations::getName()
: bug fix for functions declared to return by reference. #131FunctionDeclarations::isMagicFunction()
: bug fix for nested functions. #127Operators::isReference()
: bug fix, the reference operator was not recognized as such for closures declared to return by reference. #142Namespaces::getType()
: improved type detection for when thenamespace
keyword is used as an operator in the global namespace. #132TextStrings::getCompleteTextString()
: will now remove the newline at the end of a heredoc/nowdoc. #136
PHP itself does not include the last new line in a heredoc/nowdoc text string when handling it, so the method shouldn't either.