zubr
zubr copied to clipboard
Style guide?
We should use a consistent coding style. I think that we should stick to PSR-2 style guides.
It can be validated using composer run-script phpcs
$ composer run-script phpcs
> ./vendor/bin/phpcs --standard=PSR2 src
FILE: zubr/src/array_column.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
10 | WARNING | Line exceeds 120 characters; contains 292 characters
11 | WARNING | Line exceeds 120 characters; contains 187 characters
----------------------------------------------------------------------
The second thing is the format of PHPDocs. I've used simplified doc blocks however, I see that @ddziaduch literally copied docs blocks from PHP source (or IDE stub :)). Which format should we use?
Ah, and one more thing - should we use camel case or snake case for function parameters?
@radmen yeap I have copied PHPDocs from PhpStorm stubs
For me it's fine - I can do the same for other functions. It would be good to use the same format.
Should we use PhpStorm stubs?
Ah, and one more thing - should we use camel case or snake case for function parameters?
I vote always snake case for parameters, as it seems to be more common.
We should use a consistent coding style. I think that we should stick to PSR-2 style guides.
I will add more stuff to CONTRIBUTING.md, including a style guide and more detailed instructions.
What about new PSR coding standard? It is not "official" yet but it will be soon
https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md
Very nice. I vote yes.
Also, of course we would need to change some code, but even if the spec changed we would still be consistent in that we're using the same standard.
Do you know how final the code is? Will there be pretty much no changes before the official release?
@ddziaduch looks nice. Is this supported by phpcs
? We could automate code style validation.
@nkkollaw @radmen don't know :<
I looked today somewhat briefly, they don't seem to even mention it.
What are the new specs called, do you know? Perhaps PSR-9? That would ease searching...
It does not have number yet. Seems that it is still a draft http://www.php-fig.org/psr/
Damn.
The only solution would be to configure phpcs manually, so that we used its configuration for PSR-2 and configured everything else found in the draft manually.
I don't know.