Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Conversation

stephanvierkant
Copy link
Collaborator

@stephanvierkant stephanvierkant commented Aug 22, 2019

I've added a php-cs-fixer configuration to create (and keep) a consistent coding style, so we don't have to argue about spaces, indenting, etc. at every single PR.

Some type hinting is added, but only on private methods, because of BC.

I've used the@Symfony ruleset, but with some additional rules. Coding style is always a matter of personal preferences, so please let me know what you think.

Fixes #907

…ent to `SlevomatCodingStandard.Commenting.forbiddenCommentPatterns`)
@mwansinck
Copy link
Contributor

+1 four using a standaard code style and updating the code base. At our company we use the PSR1/PSR2 code style (from PhpStorm iDEA) instead of the Symfony one.

Personally I don't prefer the backslash for native PHP functions (if (\count($actions) and adding a dot in a DocBlock doesn't always feel logic * Default: '#FFFF80'.

@stephanvierkant
Copy link
Collaborator Author

I prefer the Doctrine coding style (and I prefer phpcs), but since this is a bundle I think it's better to stick to the @Symfony rules.

I've read that it is (slightly) faster to either use a slash or use use count;, but I've no idea if that's (still) true. Nevermind, in this case I was lazy and sticked to the Symfony guidelines without really having an opinion about this.

The trailing dot doesn't really make sense indeed. Maybe because it enforces you to write sentences instead of some random words if a comment has to end with a dot? In case of the default '#FFFF80': some extra information would have been nice, because where is that default set? It doesn't say 'protected $highlight = '#FFFF80';

@mwansinck
Copy link
Contributor

mwansinck commented Aug 23, 2019

In the end I don't mind which style is being used, using à style is a good idea anyway.
Maybe instructions for other contributors should be added to the README.md

@Seb33300
Copy link
Collaborator

I've used the@Symfony ruleset, but with some additional rules.
Can you list the additional rules you added?

@stephanvierkant
Copy link
Collaborator Author

I've used the@Symfony ruleset, but with some additional rules.
Can you list the additional rules you added?

The rules are in .php_cs.dist. I just removed some duplicate rules so it's clear which are added by me.

@stephanvierkant stephanvierkant merged commit 1422aa2 into stwe:master Aug 26, 2019
@stephanvierkant stephanvierkant deleted the dev-codingstyle branch August 26, 2019 13:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coding style
3 participants