packagist nikic/php-parser v2.0.0alpha1
PHP-Parser 2.0.0 Alpha 1

latest releases: dev-master, v5.3.1, v4.19.4...
9 years ago

A more detailed description of backwards incompatible changes can be found in the upgrading guide.

Removed

  • Removed support for running on PHP 5.4. It is however still possible to parse PHP 5.2 and PHP 5.3 code while running on a newer version.
  • Removed legacy class name aliases. This includes the old non-namespaced class names and the old names for classes that were renamed for PHP 7 compatibility.
  • Removed support for legacy node format. All nodes must have a getSubNodeNames() method now.

Added

  • Added support for remaining PHP 7 features that were not present in 1.x:
    • Group use declarations. These are represented using Stmt\GroupUse nodes. Furthermore a type attribute was added to Stmt\UseUse to handle mixed group use declarations.
    • Uniform variable syntax.
    • Generalized yield operator.
    • Scalar type declarations. These are presented using 'bool', 'int', 'float' and 'string' as the type. The PHP 5 parser also accepts these, however they'll be Name instances there.
    • Unicode escape sequences.
  • Added PhpParser\ParserFactory class, which should be used to create parser instances.
  • Added Name::concat() which concatenates two names.
  • Added Name->slice() which takes a subslice of a name.

Changed

  • PhpParser\Parser is now an interface, implemented by Parser\Php5, Parser\Php7 and Parser\Multiple. The Multiple parser will try multiple parsers, until one succeeds.
  • Token constants are now defined on PhpParser\Parser\Tokens rather than PhpParser\Parser.
  • The Name->set(), Name->append(), Name->prepend() and Name->setFirst() methods are deprecated in favor of Name::concat() and Name->slice().
  • The NodeTraverser no longer clones nodes by default. The old behavior can be restored by passing true to the constructor.
  • The constructor for Scalar nodes no longer has a default value. E.g. new LNumber() should now be written as new LNumber(0).

Don't miss a new php-parser release

NewReleases is sending notifications on new releases.