You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8073569
Browse filesBrowse the repository at this point in the historyBrowse files
ConstExprParser, TypeParser and PhpDocParser are no longer written by hand.
tools/phplrt/build.php compiles doc/grammars/phpdoc.pp3 with phplrt and writes
every rule of the compiled grammar down as a method of
src/Parser/Generated/GeneratedParser.php, which reads exactly what the phplrt
runtime would read with the same tables and reports the same failures. The
AST is built by the reducers of AstBuilder, which extends the generated class.
The public API of the three parsers is unchanged. Some details of exceptions
thrown for invalid input differ, and a few public helper methods of
TypeParser are removed (see UPGRADING.md).
Amp-Thread-ID: https://ampcode.com/threads/T-01a17820-94d1-75c8-9206-2e802d9c0556
Copy file name to clipboardExpand all lines: UPGRADING.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,16 @@
1
+
Upgrading from phpstan/phpdoc-parser 2.x to 3.0
2
+
=================================
3
+
4
+
### The parser is generated from the grammars
5
+
6
+
`ConstExprParser`, `TypeParser` and `PhpDocParser` are no longer written by hand. The parser is generated from the grammars in [`doc/grammars`](doc/grammars) with [phplrt](https://github.com/phplrt/phplrt), and the AST is built by `PHPStan\PhpDocParser\Parser\AstBuilder`. The library now requires `ondrejmirtes/phplrt-runtime`.
7
+
8
+
Their constructors and `parse()` methods (and `PhpDocParser::parseTag()`, `PhpDocParser::parseTagValue()` and `ConstExprParser::parseDoctrineString()`) are the same, and so is the AST they build.
9
+
10
+
* Some details of a `ParserException` thrown for an invalid input may be different: the token the parser stopped at, and the token it says it expected there.
11
+
* These public methods of `TypeParser`, which were not meant to be called from the outside, are removed: `parseGeneric()`, `parseTemplateTagValue()`, `isHtml()` and `enrichWithAttributes()`.
12
+
* The `TypeParser` and `ConstExprParser` given to the constructors of `TypeParser` and `PhpDocParser` are not used anymore.
0 commit comments