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
<?php
if (PHP_VERSION >= '5') {
md5('foo', true);
}
The second parameter to md5() is only available as of PHP 5.0.0, but the call is guarded by a respective check based on PHP_VERSION. Unfortunately, phpcompatinfo-4.2.0.phar analyser:run . reports:
Requires PHP 5.0.0 (min), PHP 5.0.0 (all)
In my opinion, checking for PHP_VERSION should be generally avoided (preferring a feature test instead), but when it comes to newly introduced parameters there might not be an alternative. It would be great if PHP CompatInfo could catch at least those cases where PHP_VERSION is compared to a literal (most likely comparing to a variable isn't possible to check at all).
The text was updated successfully, but these errors were encountered:
Detecting conditional code is not so easy.
Consider not just your user case, but more generally what to do when a condition is found, and what to do with code below the condition.
if (condition)
code_1;
code_2;
endif
Actually PHP CompatInfo 4.x is not able to handle it, and I dont' think its possible with monolith compatibility analyser.
Last week, I've begun to write a new migration analyser that checks for forbidden and deprecated elements (functions, constants, ini directives). It works pretty well, but I've in mind to refactor it with Sniff like PHP_CodeSniffer.
I'll open a new RFC (Request For Comments) to know point of you of all users, and see if it's usefull to write a such reloaded project.
Consider the following script:
The second parameter to md5() is only available as of PHP 5.0.0, but the call is guarded by a respective check based on PHP_VERSION. Unfortunately,
phpcompatinfo-4.2.0.phar analyser:run .
reports:In my opinion, checking for PHP_VERSION should be generally avoided (preferring a feature test instead), but when it comes to newly introduced parameters there might not be an alternative. It would be great if PHP CompatInfo could catch at least those cases where PHP_VERSION is compared to a literal (most likely comparing to a variable isn't possible to check at all).
The text was updated successfully, but these errors were encountered: