1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-27 12:24:39 +01:00
PHP-Parser/UPGRADE-4.0.md
2017-04-27 18:28:10 +02:00

1.5 KiB

Upgrading from PHP-Parser 3.x to 4.0

PHP version requirements

PHP-Parser now requires PHP 7.0 or newer to run. It is however still possible to parse PHP 5.2-5.6 source code, while running on a newer version.

Changes to the node structure

  • Expression statements (expr;) are now represented using a Stmt\Expression node. Previously these statements were directly represented as their constituent expression.
  • The name subnode of Param has been renamed to var and now contains a Variable rather than a plain string.
  • The name subnode of StaticVar has been renamed to var and now contains a Variable rather than a plain string.
  • The var subnode of ClosureUse now contains a Variable rather than a plain string.
  • The var subnode of Catch now contains a Variable rather than a plain string.

Removed functionality

  • Removed type subnode on Class, ClassMethod and Property nodes. Use flags instead.
  • The ClassConst::isStatic() method has been removed. Constants cannot have a static modifier.
  • The NodeTraverser no longer accepts false as a return value from a leaveNode() method. NodeTraverser::REMOVE_NODE should be returned instead.
  • The misspelled Class_::VISIBILITY_MODIFER_MASK constant has been dropped in favor of Class_::VISIBILITY_MODIFIER_MASK.
  • The XML serializer has been removed. As such, the classes Serializer\XML, and Unserializer\XML, as well as the interfaces Serializer and Unserializer no longer exist.