PHPCompatibility icon indicating copy to clipboard operation
PHPCompatibility copied to clipboard

Consistent handling of features added/removed in multiple PHP minors

Open jrfnl opened this issue 8 years ago • 1 comments

As per the comments in #545 / #544:

Some functions/parameters/extensions/other features are added/removed in several different PHP versions, like the OCI functions discussed in #545, which were added in PHP 7.0.21/23, 7.1.7/9 and 7.2.0.

This is most often the case when it concerns a PHP extension - in contrast to PHP Core -.

We may want to take a principle decision (always use lowest/highest PHP version where the function first appeared/was deprecated in last) and verify that the logic is applied consistently throughout the PHPCompatibility sniffs.

Oh and add the decision taken to the contributors guidelines so it's documented.

Alternatively, we could try and find a way to check against minors - related #531 -, though in that case, we'd still need a principle decision as - taking the above example - PHP 7.0.25 would contain the functions, but PHP 7.1.3 would not, so what should be reported when a testVersion of 7.0.25- would have been provided ?

jrfnl avatar Dec 21 '17 22:12 jrfnl

what should be reported when a testVersion of 7.0.25- would have been provided ?

That is specifying that the user wants to check that their code works on all PHP versions numerically >= than 7.0.25, therefore it should report the test as failing, as it will affect users of PHP 7.1.0.

There may be a use-case for enhancing the testVersion parameter to allow for more sophisticated wildcarding, e.g. 7.0.21-7.0.99,7.1.7-7.1.99,7.2.0- but that's only worth doing if people in the real world are releasing code with that sort of detailed compatibility requirement. I suspect most people either go safe and indicate they require PHP >= 7.2, or else 'get it wrong' and specify PHP >=7.0.21, in which case it is good that we catch their error.

MarkMaldaba avatar Mar 25 '18 10:03 MarkMaldaba