Skip to content

Integrate with php-code-formatter #23

@gossi

Description

@gossi

When generating code, the holy code-style (mine - of course!) is applied to the generated code, which is the most awesome default we can get. Yet, there are some other flavors around (especially brainless psr2-lemmings) which prefer different styles.

Interesstingly enough there is no good php code formatter around and that's why I created my php-code-formatter. It basically startet as an experiment, yet has grown but still lacks a good chunk of functionality to be considered usable.
There are many code styles around and they all have different options, that's why I implemented profiles to combine different options under one name.

So, here are some ideas how to integrate with the php-code-formatter:

  • Generators are given a code-style profile name (or path to one) and pass this on to code-generation
  • Light-weight-code-generation-and-formatting: The generator-visitor (which dumps the initially generated code from the generator) uses this options from the profile and applies them on writing (which doesn't affect method bodies).
  • Full-code-generation-and-formatting: The generated code is run through the code-formatter in the post-processing.

Technically spoken: code-formatter and code-generator would share some code, which could be extracted into it's own package to avoid duplication, which seems good and doable.

I'm wondering what you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions