Repository navigation
PHP-Parser 3.0.0 Beta 2
Pre-release
Pre-release
This release primarily improves our support for error recovery.
The following changelog only lists changes relative to the beta 1 release. A description of backwards incompatible changes between version 2.x and 3.0 can be found in the upgrading guide.
Added
- Added
Node::setDocComment()method. - Added
Error::getMessageWithColumnInfo()method. - Added support for recovery from lexer errors.
- Added support for recovering from "special" errors (i.e. non-syntax parse errors).
- Added precise location information for lexer errors.
- Added
ErrorHandlerinterface, andErrorHandler\ThrowingandErrorHandler\Collectingas specific implementations. These provide a general mechanism for handling error recovery. - Added optional
ErrorHandlerargument toParser::parse(),Lexer::startLexing()andNameResolver::__construct(). - The
NameResolvernow adds anamespacedNameattribute on name nodes that cannot be statically resolved (unqualified unaliased function or constant names in namespaces).
Fixed
- Fixed attribute assignment for
GroupUseprefix and variables in interpolated strings.
Changed
- The constants on
NameTraverserInterfacehave been moved into theNameTraverserclass. - Due to the error handling changes, the
Parserinterface andLexerAPI have changed. - The emulative lexer now directly postprocesses tokens, instead of using
~__EMU__~sequences. This changes the protected API of the lexer. - The
Name::slice()method now returnsnullfor empty slices, previouslynew Name([])was used.Name::concat()now also supports concatenation withnull.
Removed
- Removed
Name::append()andName::prepend(). These mutable methods have been superseded by the immutableName::concat(). - Removed
Error::getRawLine()andError::setRawLine(). These methods have been superseded byError::getStartLine()andError::setStartLine(). - Removed support for node cloning in the
NodeTraverser. - Removed
$separatorargument fromName::toString(). - Removed
throw_on_errorparser option andParser::getErrors()method. Use theErrorHandlermechanism instead.