|
| 1 | +# Change Log for PHPCSUtils for PHP Codesniffer |
| 2 | + |
| 3 | +All notable changes to this project will be documented in this file. |
| 4 | + |
| 5 | +This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses [Semantic Versioning](http://semver.org/). |
| 6 | + |
| 7 | + |
| 8 | +## [Unreleased] |
| 9 | + |
| 10 | +_Nothing yet._ |
| 11 | + |
| 12 | + |
| 13 | +## [1.0.0-alpha2] - 2020-02-16 |
| 14 | + |
| 15 | +### Added |
| 16 | + |
| 17 | +* New `PHPCSUtils\Utils\ControlStructures` class: Utility functions for use when examining control structures. [#70](https://github.com/PHPCSStandards/PHPCSUtils/pull/70) |
| 18 | +* New `PHPCSUtils\Utils\FunctionDeclarations::isArrowFunction()` method. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 19 | +* New `PHPCSUtils\Utils\FunctionDeclarations::getArrowFunctionOpenClose()` method. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 20 | + |
| 21 | +#### PHPCS Backcompat |
| 22 | +* `BCFile::isReference()`: support for arrow functions returning by reference. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77) |
| 23 | +* `BCFile::getMethodParameters()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 24 | +* `BCFile::getMethodProperties()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79), [#89](https://github.com/PHPCSStandards/PHPCSUtils/pull/89) |
| 25 | +* `BCFile::getDeclarationName()`: allow functions to be called "fn". [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77) |
| 26 | +* `BCFile::findEndOfStatement()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 27 | +* `BCFile::findStartOfStatement()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77) |
| 28 | + |
| 29 | +#### Tokens |
| 30 | +* New `Collections::$alternativeControlStructureSyntaxTokens` property. [#70](https://github.com/PHPCSStandards/PHPCSUtils/pull/70) |
| 31 | +* New `Collections::$alternativeControlStructureSyntaxCloserTokens` property. [#68](https://github.com/PHPCSStandards/PHPCSUtils/pull/68), [#69](https://github.com/PHPCSStandards/PHPCSUtils/pull/69) |
| 32 | +* New `Collections::$controlStructureTokens` property. [#70](https://github.com/PHPCSStandards/PHPCSUtils/pull/70) |
| 33 | +* New `Collections::arrowFunctionTokensBC()` method. [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 34 | + |
| 35 | +#### Utils |
| 36 | +* `Arrays::getDoubleArrowPtr()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79), [#84](https://github.com/PHPCSStandards/PHPCSUtils/pull/84) |
| 37 | +* `FunctionDeclarations::getParameters()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 38 | +* `FunctionDeclarations::getProperties()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 39 | +* `Operators::isReference()`: support for arrow functions returning by reference. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77) |
| 40 | +* `Parentheses::getOwner()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77) |
| 41 | +* `Parentheses::isOwnerIn()`: support for arrow functions. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77), [#79](https://github.com/PHPCSStandards/PHPCSUtils/pull/79) |
| 42 | + |
| 43 | +#### Other |
| 44 | +* Documentation website at https://phpcsutils.com/ |
| 45 | + |
| 46 | +### Changed |
| 47 | + |
| 48 | +#### PHPCS Backcompat |
| 49 | +* `BCFile::getCondition()`: sync with PHPCS 3.5.4 - added support for new `$first` parameter. [#73](https://github.com/PHPCSStandards/PHPCSUtils/pull/73) |
| 50 | + |
| 51 | +#### Tokens |
| 52 | +* The `Collections::$returnTypeTokens` property now includes `T_ARRAY` to allow for supporting arrow functions in PHPCS < 3.5.3. [#77](https://github.com/PHPCSStandards/PHPCSUtils/pull/77) |
| 53 | + |
| 54 | +#### Utils |
| 55 | +* :warning: `Conditions::getCondition()`: sync with PHPCS 3.5.4 - renamed the existing `$reverse` parameter to `$first` and reversing the meaning of the boolean values, to stay in line with PHPCS itself. [#73](https://github.com/PHPCSStandards/PHPCSUtils/pull/73) |
| 56 | +* :warning: `Numbers`: the `$unsupportedPHPCSVersions` property has been replaced with an `UNSUPPORTED_PHPCS_VERSION` constant. |
| 57 | + |
| 58 | +#### Other |
| 59 | +* Various housekeeping. |
| 60 | + |
| 61 | + |
| 62 | +## 1.0.0-alpha1 - 2020-01-23 |
| 63 | + |
| 64 | +Initial alpha release containing: |
| 65 | +* 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. |
| 66 | +* A `PHPCSUtils` standard which contains generic utilities which can be used when writing sniffs. |
| 67 | + **_This standard does not contain any sniffs!_** |
| 68 | + To use these utilities in PHPCS 3.x, all that is needed is for this package to be installed and registered with PHPCS using `installed_paths`. If the package is requested via Composer, this will automatically be handled by the [DealerDirect Composer PHPCS plugin]. |
| 69 | + To use these utilities in PHPCS 2.x, make sure the external standard includes the `PHPCS23Utils` standard in the `ruleset.xml` file like so: `<rule ref="PHPCS23Utils"/>`. |
| 70 | + |
| 71 | +All utilities offered are compatible with PHP_CodeSniffer 2.6.0 up to the latest stable release. |
| 72 | + |
| 73 | +This initial alpha release contains the following utility classes: |
| 74 | + |
| 75 | +### Abstract Sniffs |
| 76 | +* `AbstractArrayDeclarationSniff`: to examine array declarations. |
| 77 | + |
| 78 | +### Backcompat |
| 79 | +* `BCFile`: Backport of the latest versions of PHPCS native utility functions from the `PHP_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. |
| 80 | +* `BCTokens`: Backport of the latest versions of PHPCS native token arrays from the `PHP_CodeSniffer\Util\Tokens` class to make them available in older PHPCS versions. |
| 81 | +* `Helper`: Utility methods to retrieve (configuration) information from PHP_CodeSniffer 2.x as well as 3.x. |
| 82 | + |
| 83 | +### Fixers |
| 84 | +* `SpacesFixer`: Utility to check and, if necessary, fix the whitespace between two tokens. |
| 85 | + |
| 86 | +### TestUtils |
| 87 | +* `UtilityMethodTestCase`: Base class for use when testing utility methods for PHP_CodeSniffer. |
| 88 | + Compatible with both PHPCS 2.x as well as 3.x. Supports PHPUnit 4.x up to 8.x. |
| 89 | + See the usage instructions in the class docblock. |
| 90 | + |
| 91 | +### Tokens |
| 92 | +* `Collections`: Collections of related tokens as often used and needed for sniffs. |
| 93 | + These are additional "token groups" to compliment the ones available through the PHPCS native `PHP_CodeSniffer\Util\Tokens` class. |
| 94 | + |
| 95 | +### Utils |
| 96 | +* `Arrays`: Utility functions for use when examining arrays. |
| 97 | +* `Conditions`: Utility functions for use when examining token conditions. |
| 98 | +* `FunctionDeclarations`: Utility functions for use when examining function declaration statements. |
| 99 | +* `GetTokensAsString`: Utility functions to retrieve the content of a set of tokens as a string. |
| 100 | +* `Lists`: Utility functions to retrieve information when working with lists. |
| 101 | +* `Namespaces`: Utility functions for use when examining T_NAMESPACE tokens and to determine the namespace of arbitrary tokens. |
| 102 | +* `Numbers`: Utility functions for working with integer/float tokens. |
| 103 | +* `ObjectDeclarations`: Utility functions for use when examining object declaration statements. |
| 104 | +* `Operators`: Utility functions for use when working with operators. |
| 105 | +* `Orthography`: Utility functions for checking the orthography of arbitrary text strings. |
| 106 | +* `Parentheses`: Utility functions for use when examining parenthesis tokens and arbitrary tokens wrapped in parentheses. |
| 107 | +* `PassedParameters`: Utility functions to retrieve information about parameters passed to function calls, array declarations, isset and unset constructs. |
| 108 | +* `Scopes`: Utility functions for use when examining token scopes. |
| 109 | +* `TextStrings`: Utility functions for working with text string tokens. |
| 110 | +* `UseStatements`: Utility functions for examining use statements. |
| 111 | +* `Variables`: Utility functions for use when examining variables. |
| 112 | + |
| 113 | + |
| 114 | +[DealerDirect Composer PHPCS plugin]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/ |
| 115 | + |
| 116 | + |
| 117 | +[Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.0-alpha2...HEAD |
| 118 | +[1.0.0-alpha2]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.0-alpha1...1.0.0-alpha2 |
| 119 | + |
0 commit comments