psliwa / image-optimizer

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.
MIT License
910 stars 141 forks source link

Code styling suggestion #37

Closed freekmurze closed 6 years ago

freekmurze commented 7 years ago

Hi, this package seems awesome.

However, when looking at the source code I see many inconsistencies in how to code is formatted.

Here's a friendly suggestion: use a service like Style CI to automatically make and keep the code style consistent. I've used the service on many packages before and quite happy with it.

If you're happy with how the code is now feel free to ignore this issue.

psliwa commented 7 years ago

Any examples of inconsistency? I've just browsed the source code and it looks more or less consistent.

freekmurze commented 7 years ago

For example the amount of new lines before and after the declaration of the name space seems to be varying from file to file. And little things like the amount of spaces in certain statements.

A service like StyleCI could fix that automatically without breaking any code. Here's an example of a PR that StyleCI can send (I used a fork of your package): https://github.com/freekmurze/image-optimizer/pull/1/files

Imho a consistant code style makes it easier to contribute to your package. StyleCI is free for open source stuff, so there's really no downsides.

If you're not a fan of using that service you could manually fix code styles issues with php-cs-fixer: https://github.com/FriendsOfPHP/PHP-CS-Fixer