Keywords/NewKeywords: merge NewArrowFunctionSniff#1593
Conversation
The `NewArrowFunction` sniff was created prior to the decision to raise the minimum supported PHPCS version to 3.7.1. As for older PHPCS version, a lot of custom logic was needed to recognize arrow functions, it made sense to have a separate sniff for this. However, when support for PHPCS < 3.7.1 was dropped, the sniff was slimmed down to not contain any logic anymore, so we may as well merge the detection of arrow functions into the `NewKeywords` sniff. This is **not** a BC break as the `NewArrowFunctionSniff` was new to PHPCompatibility 10.0.0 anyway. Note: all tests from the original `NewArrowFunction` sniff have been moved over and merged into the `NewKeywords` test file. Related to 808
I'd be a little careful with that. We've been telling people to use the |
@MarkMaldaba You have point. All the same, anyone using I also don't think this BC break will actually have any real impact as - unlike functions/classes etc - the arrow function syntax is not something which can be polyfilled via userland code, The only impact it could possibly have is when projects have a mix of files for different PHP versions and would have Generally speaking, projects with different supported PHP versions for different files are not very common and as a general rule of thumb, they should run PHPCompatibility multiple times with different |
The
NewArrowFunctionsniff was created prior to the decision to raise the minimum supported PHPCS version to 3.7.1.As for older PHPCS versions, a lot of custom logic was needed to recognize arrow functions, it made sense to have a separate sniff for this.
However, when support for PHPCS < 3.7.1 was dropped, the sniff was slimmed down to not contain any logic anymore, so we may as well merge the detection of arrow functions into the
NewKeywordssniff.This is not a BC break as the
NewArrowFunctionSniffwas new to PHPCompatibility 10.0.0 anyway.Note: all tests from the original
NewArrowFunctionsniff have been moved over and merged into theNewKeywordstest file.Related to #808