You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During a routine call with @jrfnl, we discussed #1683. This is a class of bug / possible improvement that should be applied to all affected sniffs.
What needs to be done?
Each sniff in this repository (all of which are listed in the table below) should be reviewed. Most sniffs will not require any changes. The sniffs that need closer review are those that identify issues in attributes - such as new syntax introduced after PHP 8.0. As attributes are treated as comments before PHP 8.0, any new syntax being used in these "comments" should not be flagged as problematic if the code is not expected to run on PHP versions 8.0+.
Tracker
This issue is intended to be a tracker. Individual pull requests should be opened for each sniff requiring changes.
If you would like to claim a sniff, please update the "status" column for the relevant sniff; if you are not able to edit this issue description directly, please add a comment to this issue and someone with sufficient permissions will update the table accordingly.
@fredden Thanks for opening the issue. I've taken the liberty to edit the table and to add a status to a lot of sniffs for which this is irrelevant (as the syntax cannot be used in attributes). Hoping that will allow people to focus on the sniffs which do need to be reviewed.
The sniffs that need closer review are those that identify issues in attributes - such as new syntax introduced after PHP 8.0. As attributes are treated as comments before PHP 8.0, any new syntax being used in these "comments" should not be flagged as problematic if the code is not expected to run on PHP versions 8.0+.
If the code is not expected to run on PHP 8.0, why would the code contain an attribute ?
I think this is slightly more nuanced.
Change introduced in PHP < 8.0
Change introduced in PHP 8.0+
Sniffs detecting new features
sniff needs update if syntax can be used in attributes [1]
No update needed [2]
Sniffs detecting deprecated/removed features
No update needed [3]
No update needed [3]
[1] When a "new" feature was introduced before PHP 8.0 and the feature is used in an attribute, it should not be flagged, as the attribute will be ignored as a comment in PHP < 8.0, so the use of the "new" feature will not cause problems if the code is run on PHP < 8.0 and when running the code on PHP 8.0+, the new syntax is supported anyway.
* Note: this applies to single-line attributes, but individual sniffs should not have to worry about whether the attribute itself is compatible with PHP < 8.0, that's for the NewAttributes sniff to handle.
[2] When a "new" feature was introduced in or after PHP 8.0 and the feature is used in an attribute, it should be flagged if the code under scan needs to support PHP 8.0 < PHP introduction version, but it doesn't need to be flagged if the code under scan does not need to support PHP 8.0+
Having said that, why would code which doesn't need to run on PHP 8.0+ contain attributes ?
So, yes, these sniffs could be updated, but in my opinion don't really need to be as the use of attributes alone means the code within the attribute should be able to run and if it can't be, it should be flagged.
[3] When a PHP feature was deprecated/removed, the sniff detecting this does not need an update as whether it is used in an attribute or not isn't really relevant, the feature should still be flagged as deprecated/removed when the codebase under scan needs to support the PHP version in which the feature was deprecated/removed.
Background
During a routine call with @jrfnl, we discussed #1683. This is a class of bug / possible improvement that should be applied to all affected sniffs.
What needs to be done?
Each sniff in this repository (all of which are listed in the table below) should be reviewed. Most sniffs will not require any changes. The sniffs that need closer review are those that identify issues in attributes - such as new syntax introduced after PHP 8.0. As attributes are treated as comments before PHP 8.0, any new syntax being used in these "comments" should not be flagged as problematic if the code is not expected to run on PHP versions 8.0+.
Tracker
This issue is intended to be a tracker. Individual pull requests should be opened for each sniff requiring changes.
If you would like to claim a sniff, please update the "status" column for the relevant sniff; if you are not able to edit this issue description directly, please add a comment to this issue and someone with sufficient permissions will update the table accordingly.
The text was updated successfully, but these errors were encountered: