File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
This project uses PSR-12 with consistent brace placement. This means that the opening brace is
4
4
always on the same line, even for class and method declarations.
5
+
6
+ ## Tools
7
+
8
+ This project uses PHP-CS-Fixer and PHPStan. You can invoke them using ` make ` :
9
+
10
+ ``` shell
11
+ make php-cs-fixer
12
+ make phpstan
13
+ ```
14
+
15
+ ## Adding support for new PHP syntax
16
+
17
+ 1 . If necessary, add emulation support for new tokens.
18
+ * Add a new subclass of ` Lexer\TokenEmulator ` . Take inspiration from existing classes.
19
+ * Add the new class to the array in ` Lexer\Emulative ` .
20
+ * Add tests for the emulation in ` Lexer\EmulativeTest ` . You'll want to modify
21
+ ` provideTestReplaceKeywords() ` for new reserved keywords and ` provideTestLexNewFeatures() ` for
22
+ other emulations.
23
+ 2 . Add any new node classes that are needed.
24
+ 3 . Add support for the new syntax in ` grammar/php.y ` . Regenerate the parser by running
25
+ ` php grammar/rebuildParsers.php ` . Use ` --debug ` if there are conflicts.
26
+ 4 . Add pretty-printing support by implementing a ` pFooBar() ` method in ` PrettyPrinter\Standard ` .
27
+ 5 . Add tests both in ` test/code/parser ` and ` test/code/prettyPrinter ` .
28
+ 6 . Add support for formatting-preserving pretty-printing. This is done by modifying the data tables
29
+ at the end of ` PrettyPrinterAbstract ` . Add a test in ` test/code/formatPreservation ` .
30
+ 7 . Does the new syntax feature namespaced names? If so, add support for name resolution in
31
+ ` NodeVisitor\NameResolver ` . Test it in ` NodeVisitor\NameResolverTest ` .
32
+ 8 . Does the new syntax require any changes to builders? Is so, make them :)
You can’t perform that action at this time.
0 commit comments