php-cfg
php-cfg copied to clipboard
Protobuf printer refactor
Added a protobuf printer. To do this, I had to slightly modify the base printer class and renderers:
- Everything specific to a "format" is now handled by the child classes. Rendering methods return a "low level structure" and it's up to the child class to format it according to the printer type. For instance, in
renderer/Operand/Temporary.php, we previously returned anidprefixed with#, this kind of transformation in now performed inPrinter/Text.php. - A bit out by laziness, but it's maybe not a bad thing, most of the
opare rendered in a similar way. In the past, we had specific style forPhi,AssertionorAttributesGroup, with this PR, we have the same style of rendering. That's why you'll see diff in code tests related to theseops. We lose a bit of readability for Text printer but I think we have a more generic rendering, and it could be ok? - I don't know exactly how to test this new protobuf printer class, I didn't want to duplicate all the "code tests" (but maybe we should?) so I took only two test code files for the moment.