Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with php-code-formatter #23

Closed
gossi opened this issue Jan 1, 2016 · 2 comments
Closed

Integrate with php-code-formatter #23

gossi opened this issue Jan 1, 2016 · 2 comments

Comments

@gossi
Copy link
Collaborator

gossi commented Jan 1, 2016

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?

@gossi
Copy link
Collaborator Author

gossi commented Jul 1, 2017

First step would be to extract shared code into its own package (including profiles).

Regarding the strategy. What would make most sense to me is the code formatting in post processing. It would affect the whole code (including method bodies) and not just partials of it.

A combined effort could also work: Pass the profile to writer and second add an option to allow code-formatting in post-processing with the selected profile. That would also be progressive effort to post-processing ;)

@gossi
Copy link
Collaborator Author

gossi commented Aug 4, 2018

See #54

@gossi gossi closed this as completed Aug 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant