This project uses PSR-12 with consistent brace placement. This means that the opening brace is always on the same line, even for class and method declarations.
This project uses PHP-CS-Fixer and PHPStan. You can invoke them using make:
make php-cs-fixer
make phpstan- If necessary, add emulation support for new tokens.
- Add a new subclass of
Lexer\TokenEmulator. Take inspiration from existing classes. - Add the new class to the array in
Lexer\Emulative. - Add tests for the emulation in
Lexer\EmulativeTest. You'll want to modifyprovideTestReplaceKeywords()for new reserved keywords andprovideTestLexNewFeatures()for other emulations.
- Add a new subclass of
- Add any new node classes that are needed.
- Add support for the new syntax in
grammar/php.y. Regenerate the parser by runningphp grammar/rebuildParsers.php. Use--debugif there are conflicts. - Add pretty-printing support by implementing a
pFooBar()method inPrettyPrinter\Standard. - Add tests both in
test/code/parserandtest/code/prettyPrinter. - Add support for formatting-preserving pretty-printing. This is done by modifying the data tables
at the end of
PrettyPrinterAbstract. Add a test intest/code/formatPreservation. - Does the new syntax feature namespaced names? If so, add support for name resolution in
NodeVisitor\NameResolver. Test it inNodeVisitor\NameResolverTest. - Does the new syntax require any changes to builders? Is so, make them :)