Hello everyone, we agreed some time ago, that we would use PSR-2 code style for xRes development. http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do. https://symfony.com/doc/3.3/contributing/code/standards.html Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ]) - Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real); - Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used. These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know. Best regards Viktoras Bezaras -- Mit freundlichen Grüßen Viktoras Bezaras - Entwickler - ________________________________________________________ TraSo GmbH Nonnenstraße 42 D-04229 Leipzig Tel.: +49 341 355 740 44 E-Mail: v.bezaras@traso.de Internet: http://www.traso.de ________________________________________________________ Geschäftsführer: Haiko Gerdes Handelsregister: Amtsgericht Leipzig, HRB 21850
Hello again, I would like to remind you about the mail. Does anybody has anything agaisnt the list below? If no, I will update wiki Codestyle page to include these as well. On 07/19/17 11:48, Viktoras Bezaras wrote:
Hello everyone,
we agreed some time ago, that we would use PSR-2 code style for xRes development.
http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles
PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do.
https://symfony.com/doc/3.3/contributing/code/standards.html
Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ])
- Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
- Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used.
These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know.
Best regards Viktoras Bezaras
-- Mit freundlichen Grüßen Viktoras Bezaras - Entwickler - ________________________________________________________ TraSo GmbH Nonnenstraße 42 D-04229 Leipzig Tel.: +49 341 355 740 44 E-Mail: v.bezaras@traso.de Internet: http://www.traso.de ________________________________________________________ Geschäftsführer: Haiko Gerdes Handelsregister: Amtsgericht Leipzig, HRB 21850
Hi Viktoras, nothinmg to complain. Viele liebe Grüße Stefan Wieden - JustTheOldGuy Am 23.08.2017 um 12:17 schrieb Viktoras Bezaras:
Hello again,
I would like to remind you about the mail. Does anybody has anything agaisnt the list below? If no, I will update wiki Codestyle page to include these as well.
On 07/19/17 11:48, Viktoras Bezaras wrote:
Hello everyone,
we agreed some time ago, that we would use PSR-2 code style for xRes development.
http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles
PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do.
https://symfony.com/doc/3.3/contributing/code/standards.html
Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ])
- Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
- Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used.
These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know.
Best regards Viktoras Bezaras
hi, to update the wiki will not be enough(most like me will read it and forgot some part), that should also be added in the style check 1. i started it some months ago, but no feedback yet. so you can maybe add these parts in the PR http://stash.app.infra.gs.xtrav.de/projects/PHP/repos/xres/pull-requests/873... 2. http://editorconfig.org/ that can also be helpful 3. in readme a link to the code style 4. https://github.com/zendframework/maintainers there are also some usefull parts Am 23.08.2017 um 12:17 schrieb Viktoras Bezaras:
Hello again,
I would like to remind you about the mail. Does anybody has anything agaisnt the list below? If no, I will update wiki Codestyle page to include these as well.
On 07/19/17 11:48, Viktoras Bezaras wrote:
Hello everyone,
we agreed some time ago, that we would use PSR-2 code style for xRes development.
http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles
PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do.
https://symfony.com/doc/3.3/contributing/code/standards.html
Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ])
- Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
- Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used.
These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know.
Best regards Viktoras Bezaras
-- Mit freundlichen Grüßen Oliver Horn - Entwicklung - ________________________________________________________ TraSo GmbH Nonnenstraße 42 D-04229 Leipzig Tel.: +49 341 90 987 45 E-Mail: o.horn@traso.de Internet: http://www.traso.de ________________________________________________________ Geschäftsführer: Haiko Gerdes Handelsregister: Amtsgericht Leipzig, HRB 21850
Hello Olli, you are right, just Wiki will not be enough. But it's just a first step. I specifically selected those, that should not produce any conflicts and problems. We already mostly do everything this way. This is why I suggest to start with these and continue on having that already as a basis. When it's accepted, we can continue with more specific things. On 08/23/17 12:48, Oliver Horn wrote:
hi,
to update the wiki will not be enough(most like me will read it and forgot some part), that should also be added in the style check
1. i started it some months ago, but no feedback yet.
so you can maybe add these parts in the PR
http://stash.app.infra.gs.xtrav.de/projects/PHP/repos/xres/pull-requests/873...
2. http://editorconfig.org/ that can also be helpful
3. in readme a link to the code style
4. https://github.com/zendframework/maintainers there are also some usefull parts
Am 23.08.2017 um 12:17 schrieb Viktoras Bezaras:
Hello again,
I would like to remind you about the mail. Does anybody has anything agaisnt the list below? If no, I will update wiki Codestyle page to include these as well.
On 07/19/17 11:48, Viktoras Bezaras wrote:
Hello everyone,
we agreed some time ago, that we would use PSR-2 code style for xRes development.
http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles
PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do.
https://symfony.com/doc/3.3/contributing/code/standards.html
Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ])
- Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
- Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used.
These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know.
Best regards Viktoras Bezaras
-- Mit freundlichen Grüßen Viktoras Bezaras - Entwickler - ________________________________________________________ TraSo GmbH Nonnenstraße 42 D-04229 Leipzig Tel.: +49 341 355 740 44 E-Mail: v.bezaras@traso.de Internet: http://www.traso.de ________________________________________________________ Geschäftsführer: Haiko Gerdes Handelsregister: Amtsgericht Leipzig, HRB 21850
In addition to previous Email. I've looked through ZF Maintainers guide and can suggest two new rules: - Use only LF for new line. Do not use carriage returns (CR) as is the convention in Apple OS's (0x0D) or the carriage return - linefeed combination (CRLF) as is standard for the Windows OS (0x0D, 0x0A). - Lines MUST NOT have whitespace characters preceding the linefeed character. There are some that I find good as well, but those are not as straightforward and require a discussion. On 08/23/17 12:54, Viktoras Bezaras wrote:
Hello Olli,
you are right, just Wiki will not be enough. But it's just a first step. I specifically selected those, that should not produce any conflicts and problems. We already mostly do everything this way. This is why I suggest to start with these and continue on having that already as a basis. When it's accepted, we can continue with more specific things.
On 08/23/17 12:48, Oliver Horn wrote:
hi,
to update the wiki will not be enough(most like me will read it and forgot some part), that should also be added in the style check
1. i started it some months ago, but no feedback yet.
so you can maybe add these parts in the PR
http://stash.app.infra.gs.xtrav.de/projects/PHP/repos/xres/pull-requests/873...
2. http://editorconfig.org/ that can also be helpful
3. in readme a link to the code style
4. https://github.com/zendframework/maintainers there are also some usefull parts
Am 23.08.2017 um 12:17 schrieb Viktoras Bezaras:
Hello again,
I would like to remind you about the mail. Does anybody has anything agaisnt the list below? If no, I will update wiki Codestyle page to include these as well.
On 07/19/17 11:48, Viktoras Bezaras wrote:
Hello everyone,
we agreed some time ago, that we would use PSR-2 code style for xRes development.
http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles
PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do.
https://symfony.com/doc/3.3/contributing/code/standards.html
Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ])
- Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
- Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used.
These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know.
Best regards Viktoras Bezaras
-- Mit freundlichen Grüßen Viktoras Bezaras - Entwickler - ________________________________________________________ TraSo GmbH Nonnenstraße 42 D-04229 Leipzig Tel.: +49 341 355 740 44 E-Mail: v.bezaras@traso.de Internet: http://www.traso.de ________________________________________________________ Geschäftsführer: Haiko Gerdes Handelsregister: Amtsgericht Leipzig, HRB 21850
Hello everyone once again :) Since I've not received any strongly negative responses I will add these rules into the Wiki. We will try them out in a Beta-testing phase. You can report people in PRs, that their code is not conform to these rules. But please, DO NOT block PRs because of this. This will be a test to see if we encounter any problems. If you feel, that some rule does not fit into your world - please let me know! It's all based on a free will. There will be no forcing to use something you don't like. If we, as a team agree, that we all like it this way, then it will be the way we do it. Best regards Viktoras Bezaras On 08/23/17 13:02, Viktoras Bezaras wrote:
In addition to previous Email. I've looked through ZF Maintainers guide and can suggest two new rules:
- Use only LF for new line. Do not use carriage returns (CR) as is the convention in Apple OS's (0x0D) or the carriage return - linefeed combination (CRLF) as is standard for the Windows OS (0x0D, 0x0A). - Lines MUST NOT have whitespace characters preceding the linefeed character.
There are some that I find good as well, but those are not as straightforward and require a discussion.
On 08/23/17 12:54, Viktoras Bezaras wrote:
Hello Olli,
you are right, just Wiki will not be enough. But it's just a first step. I specifically selected those, that should not produce any conflicts and problems. We already mostly do everything this way. This is why I suggest to start with these and continue on having that already as a basis. When it's accepted, we can continue with more specific things.
On 08/23/17 12:48, Oliver Horn wrote:
hi,
to update the wiki will not be enough(most like me will read it and forgot some part), that should also be added in the style check
1. i started it some months ago, but no feedback yet.
so you can maybe add these parts in the PR
http://stash.app.infra.gs.xtrav.de/projects/PHP/repos/xres/pull-requests/873...
2. http://editorconfig.org/ that can also be helpful
3. in readme a link to the code style
4. https://github.com/zendframework/maintainers there are also some usefull parts
Am 23.08.2017 um 12:17 schrieb Viktoras Bezaras:
Hello again,
I would like to remind you about the mail. Does anybody has anything agaisnt the list below? If no, I will update wiki Codestyle page to include these as well.
On 07/19/17 11:48, Viktoras Bezaras wrote:
Hello everyone,
we agreed some time ago, that we would use PSR-2 code style for xRes development.
http://confluence.app.infra.gs.xtrav.de/display/Entwicklung/Codestyles
PSR-2 however is a very general recommendation. Many things we do intuitively, I believe it's time to extend a little bit a list of our rules, to make them more clear. My proposal is to partially adopt Symfony Framework Coding Stadard, since it shares a lot of rules with what we already do.
https://symfony.com/doc/3.3/contributing/code/standards.html
Specifically: - Follow the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents. - Add a single space after each comma delimiter (E.g. func($a, $b, $c); or [$a, $b, $c]) - Add a single space around binary operators (==, &&, ...). I suggest always use spaces around concatenation as well. (E.g. $a . $b, $a == $b) - Place unary operators (!, --, ...) adjacent to the affected variable (E.g. !$a, not ! $a) - Use braces to indicate control structure body regardless of the number of statements it contains; (E.g. if ($a) { doThis(); }) - Declare class properties before methods; - Use parentheses when instantiating classes regardless of the number of arguments the constructor has; (E.g. new Obj(); not new Obj;) - Do not use spaces around [ offset accessor and before ] offset accessor. (E.g. $a[$b[1]], not $a[ $b[1] ])
- Use camelCase, not underscores, for variable, function and method names, arguments; - Prefix abstract classes with Abstract - Suffix interfaces with Interface - Suffix traits with Trait - Suffix exceptions with Exception - Use alphanumeric characters and underscores for file names (Letters and numbers, no special characters) - For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
- Omit the @return tag if the method does not return anything; - The @package and @subpackage annotations are not used.
These are just, what I believe we can easily agree on without much discussion. There are more rules in the Symfony document. If you feel some other should also be included - please let everyone know.
Best regards Viktoras Bezaras
-- Mit freundlichen Grüßen Viktoras Bezaras - Entwickler - ________________________________________________________ TraSo GmbH Nonnenstraße 42 D-04229 Leipzig Tel.: +49 341 355 740 44 E-Mail: v.bezaras@traso.de Internet: http://www.traso.de ________________________________________________________ Geschäftsführer: Haiko Gerdes Handelsregister: Amtsgericht Leipzig, HRB 21850
participants (3)
-
Oliver Horn -
Stefan Wieden -
Viktoras Bezaras