-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add PHP support using php-cs-fixer #26
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the following suggestions are based on my recent pull-request (#27) - which should be merged before this pr, otherwise things will break 😃
we can pass rules as an argument to make php-cs-fixer ignore our php_cs file
Thank you for your help! 👍 |
Hmm, I'm still getting an error with regards to the php-cs-fixer config/cache files:
Any idea why this is? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatter complains, because php-cs-fixer writes stuff to stderr,
I made some suggestions to fix this, but i have not tested them.
The fact that php-cs-fixer used its default config is good, because this means that it did not load our .php_cs file.
Forget what i said. php-cs-fixer does not support stdin/stdout fixing (using pipes). It supports file-content from stdin, but does not write the result to stdout ... it only supports "diff" ... Instead we could try the php formatter from prettier. |
Yeah, ok. I kind of suspected that already. For the future, it might be a good idea to support both ways of input/output - to a temp file as well as stdin/stdout using pipes. In #11, @wookiefriseur mentioned that Prettier plugins are way to slow which is why we decided not to use Prettier for formatting PHP. |
Since #39 was merged (🎉) we could take look at prettier-plugin-php again. |
Yep, I am going to work on that pretty soon. |
I think we are good to go. 😃 Prettier is significantly faster than before. |
Nice, this sounds very promising! |
Oops, merged it with the wrong title/description as we are not using |
This PR adds PHP support by making use of the formatting tool
php-cs-fixer
.Unfortunately, it does not work yet as
php-cs-fixer
automatically uses the config from.php_cs
.Because of that, the wanted file in
storage/code
is not formatted as the specified files from the config file have precedence over the given file in the execution command.At least, this is what I think is causing that the specified file is not formatted.
To fix this, I have tried to "docker-ignore"
.php_cs
. However, this does not work either.In general, it looks like
.dockerignore
has no effect on which files are copied into the container.Does anyone have an idea how to solve this or what is actually going on?