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
ErrorHandler
interface, andErrorHandler\Throwing
andErrorHandler\Collecting
as specific implementations. These provide a general mechanism for handling error recovery. - Added optional
ErrorHandler
argument toParser::parse()
,Lexer::startLexing()
andNameResolver::__construct()
. - The
NameResolver
now adds anamespacedName
attribute on name nodes that cannot be statically resolved (unqualified unaliased function or constant names in namespaces).
Fixed
- Fixed attribute assignment for
GroupUse
prefix and variables in interpolated strings.
Changed
- The constants on
NameTraverserInterface
have been moved into theNameTraverser
class. - Due to the error handling changes, the
Parser
interface andLexer
API 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 returnsnull
for 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
$separator
argument fromName::toString()
. - Removed
throw_on_error
parser option andParser::getErrors()
method. Use theErrorHandler
mechanism instead.