PHPCompatibility is ready for PHP 7.0

It took a while to get it finished, but I finally managed to finish writing the changes for PHPCompatibility to include PHP 7.0 support.

Thanks to financial support from the cool people at WPEngine, the complete set of sniffs for PHP 7.0 is now available on Github through the usual link.

As always, tests include both forward and backward compatibility. It is advisable to run PHPCompatibility on PHP 7.0, as some sniffs can not be run on older versions. You can use the ‘–runtime-set testVersion 5.x’ parameter (replacing the x with the number of your chosing) to test your code for older versions.

The sniff includes support for all of these changes :

  • Deprecated functionality :
    • PHP4 style constructors
    • password_hash salt option
  • Older version check (using –runtime-set testVersion)
    • scalar type declaration
    • return type declaration
    • null coalescing operator
    • spaceship operator
    • constant arrays in define
    • anonymous classes
    • unserialize filter variable
    • IntlChar class
    • Group use declaration
    • intdiv function
    • session_start options
    • preg_replace_callback_array function
    • random_bytes and random_int functions
  • Backward incompatibilities
    • Empty list assignments
    • global keyword with variable variables no longer allowed
    • Function parenthesis warning
    • Negative bitshifts
    • Removed functions call_user_method, call_user_method_array, mcrypt_generic_end, mcrypt_ecb(), mcrypt_cbc, mcrypt_cfb, mcrypt_ofb, datefmt_set_timezone_id, IntlDateFormatter::setTimeZoneID, set_magic_quotes_runtime, magic_quotes_runtime, set_socket_blocking, imagepsbbox, imagepsencodefont, imagepsextendfont, imagepsfreefont, imagepsloadfont, imagepsslantfont, imagepstext
    • Removed INI directives always_populate_raw_post_data, asp_tags and xsl.security_prefs
    • New objects assigned by reference removed
    • New reserved keywords bool, int, float, string, NULL, TRUE, FALSE, resource, object, mixed and numeric
    • Functions with multiple parameters with same name not allowed
    • Switch statements with multiple defaults not allowed
    • $HTTP_RAW_POST_DATA removed
    • mktime and gmmktime no longer support is_dst parameter
    • preg_replace no longer supports \e
  • Several new built-in functions, classes, interfaces and exceptions
  • Many new global constants
  • Many removed extensions
  • Loosening reserved word restrictions (in some places)

2 thoughts on “PHPCompatibility is ready for PHP 7.0”

  1. I was wondering – when I use “–runtime-set testVersion 7.0”, does this mean the latest version of PHP, i.e. 7.0.14 (at the moment)?

    Not sure if the 7.0.x will introduce anything that PHPCompatibility would need to be concerned with?

    1. –runtime-set testVersion 7.0 will indeed test for any changes for upgrading towards the latest 7.0 release.

      If you do not use –runtime-set it will currently test for 7.1, soon 7.2

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.