- Class names need to be prefixed with phpbb_
- eval should not be used in any form
- there should be newlines at the end of file
- the closing php tag should be ommited
- array elements should always have a trailing comma
- the phpBB VCS is now git
- removed the coding guidelines changelog
[RFC|Accepted] Coding Guideline Modifications
[RFC|Accepted] Coding Guideline Modifications
So we've already been operating with slightly modified coding guidelines but we should formalise those. I have created a patch of the coding-guidelines.html file which you can find here. The changes are:
Re: [RFC] Coding Guideline Modifications
Looks pretty good. But what about the class naming proposal, which also includes things like "there should only be one class per file"?
You might want to add a trailing full stop there for consistency.+ <p>If an array is defined with each element on its own line, you still have to modify the previous line to add a comma when appending a new element. PHP allows for trailing (useless) commas in array definitions. These should always be used so each element including the comma can be appended with a single line</p>
Maybe "sanitise"? Not that I'd really care.sanitize
I'd omit that or at least make clear that it is dead. "stable" implies otherwise.+ <li><code>master-phpbb2</code><br />A branch containing all stable phpBB2 release points</li>
Are tags merged into a branch? The wording seems a bit off to me.+ <li><strong>tags</strong><br />Released versions. Merged into the master if it is a stable release.
I'd rather use Z than using Y twice. Might be worth mentioning PLs too.+ <li><code>release-3.Y.X-RCY</code><br />Release candidate Y of the stable 3.Y.X release.</li>
- bantu
- 3.0 Release Manager
- Posts: 557
- Joined: Thu Sep 07, 2006 11:22 am
- Location: Karlsruhe, Germany
- Contact:
Re: [RFC] Coding Guideline Modifications
- "public, private, protected" should be used for class properties instead of "var"
- Methods that are called statically should have the "static" keyword
- Use "static public function foo()" instead of "public static function foo()"
- Prefer class constants over define().
Re: [RFC] Coding Guideline Modifications
I know, it was discussed, but problem was not solved
What about MODs dependent on it? <?php and ?> was only stable elements in sources, which will never be modified by developers and other mods? Now only <?php which is unusable.the closing php tag should be ommited
- bantu
- 3.0 Release Manager
- Posts: 557
- Joined: Thu Sep 07, 2006 11:22 am
- Location: Karlsruhe, Germany
- Contact:
Re: [RFC] Coding Guideline Modifications
Discussion was here: viewtopic.php?f=3&t=32589FeyFre wrote:I know, it was discussed, but problem was not solvedWhat about MODs dependent on it? <?php and ?> was only stable elements in sources, which will never be modified by developers and other mods? Now only <?php which is unusable.the closing php tag should be ommited
Related ticket: http://tracker.phpbb.com/browse/PHPBB3-9556
Re: [RFC] Coding Guideline Modifications
I have posted a suggestion in that topic, please comment.bantu wrote:Discussion was here: viewtopic.php?f=3&t=32589FeyFre wrote:I know, it was discussed, but problem was not solvedWhat about MODs dependent on it? <?php and ?> was only stable elements in sources, which will never be modified by developers and other mods? Now only <?php which is unusable.the closing php tag should be ommited
Related ticket: http://tracker.phpbb.com/browse/PHPBB3-9556
Re: [RFC] Coding Guideline Modifications
The ommited ?> would ONLY be at end of file, I'm sure detection can be easily done too.FeyFre wrote:I know, it was discussed, but problem was not solvedWhat about MODs dependent on it? <?php and ?> was only stable elements in sources, which will never be modified by developers and other mods? Now only <?php which is unusable.the closing php tag should be ommited
I like these updates, cant see any faults apart from evil's sugestion of one class per fil which is as important.
Re: [RFC] Coding Guideline Modifications
Added that. Including the singular/plural thing.eviL3 wrote:Looks pretty good. But what about the class naming proposal, which also includes things like "there should only be one class per file"?
Trailing full stops are a syntax error, so I don't quite see the point?eviL3 wrote:You might want to add a trailing full stop there for consistency.+ <p>If an array is defined with each element on its own line, you still have to modify the previous line to add a comma when appending a new element. PHP allows for trailing (useless) commas in array definitions. These should always be used so each element including the comma can be appended with a single line</p>
Used all over the document, don't really see the need to change that.evil3 wrote:Maybe "sanitise"? Not that I'd really care.sanitize
Removed it.evil3 wrote:I'd omit that or at least make clear that it is dead. "stable" implies otherwise.+ <li><code>master-phpbb2</code><br />A branch containing all stable phpBB2 release points</li>
Yes, the tags are merged into a branch. Rephrased it anyway.evil3 wrote:Are tags merged into a branch? The wording seems a bit off to me.+ <li><strong>tags</strong><br />Released versions. Merged into the master if it is a stable release.
That was a mistake, fixed.evil3 wrote:I'd rather use Z than using Y twice. Might be worth mentioning PLs too.+ <li><code>release-3.Y.X-RCY</code><br />Release candidate Y of the stable 3.Y.X release.</li>
Re: [RFC] Coding Guideline Modifications
What I meant was adding a full stop after "These should always be used so each element including the comma can be appended with a single line".naderman wrote:Trailing full stops are a syntax error, so I don't quite see the point?
Looks good.