PHP 8.3 | ✨ New PHPCompatibility.Generators.NewYieldFromComment sniff#1792
Merged
PHP 8.3 | ✨ New PHPCompatibility.Generators.NewYieldFromComment sniff#1792
PHPCompatibility.Generators.NewYieldFromComment sniff#1792Conversation
> . In addition to whitespace characters, now comments are allowed between > `yield` and `from`. The whole "construct" (e.g. `yield /* comment */ from`) > is reported as a single `T_YIELD_FROM` token by the tokenizer. This commit adds a new sniff which detects this in a PHPCS cross-version compatible manner. Once support for PHPCS < 3.11.0 has been dropped, this sniff can be simplified, but IMO, this sniff alone is not enough reason to raise the minimum supported PHPCS version, especially as working around the different tokenizations isn't that complicated. Includes tests. Includes documentation. Refs: * php/php-src 14926 * https://github.com/php/php-src/blob/e4010fcf957c62ddb70f8d3296d52c5486a84d4d/UPGRADING#L48-L50 * php/php-src 10125 * php/php-src@f291d37 Related to 1589 Fixes 1720
Member
Author
I've just re-ran the tests after the merge of the upstream PR. The tests pass, so marking this PR ready for review/merge. |
wimg
approved these changes
Nov 29, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a new sniff which detects this in a PHPCS cross-version compatible manner.
Once support for PHPCS < 3.11.0 has been dropped, this sniff can be simplified, but IMO, this sniff alone is not enough reason to raise the minimum supported PHPCS version, especially as working around the different tokenizations isn't that complicated.
Includes tests.
Includes documentation.
Refs:
Related to #1589
Fixes #1720