Hi everyone,
since DokuWiki was created, the coding style [1] we use, evolved
somewhat but was never particularly strictly defined. It doesn't match
any well known styles and is more of a mix of everything. In addition,
many things aren't defined at all (eg. where to have spaces).
In the last years PSR-2 [2] has become the de-facto standard of modern
PHP. PSR-12 [3] is currently in proposal state and will refine the
styles of PSR-2.
There isn't much difference between what we're doing already and PSR-2
except for where class and method braces go (on a separate newline)
and I would like to move DokuWiki to use PSR-2 (and once ratified, to
PSR-12).
The advantages would be:
* we can easily implement automatic code style checks as part of our test suite
* more familiarity for new developers
* a much better worded and defined standard than what we can come up
The changes can be done largely automatic (using php-cs) but will
reformat nearly every file we have. We will have a few cases that will
not match PSR-2 but will have to stay as is (Plugin class names for
example) and we probably will define exceptions for 3rd party files
not managed through composer.
I believe it make most sense to make this switch shortly after the new
release is out. One side-effect of the change though will be that all
open pull requests will most likely no longer apply without
modifications. I propose to have one of our bug hunting events [4]
shortly after, with a strong focus of going through the open PRs and
either fix and merge or close them.
Proposed rough timeline:
* release of Greebo
* +2 weeks: PSR-2 adoption and automatic style fixes
* implementation of automatic style testing
* manual adjustments to style checks and code
* +2 weeks: bug hunting aka. PR management
* +X weeks: PSR-12 released
* adoption of PSR-12
* living happily ever after
If you have any objections, comments or amendments, please let me know.
Andi
[1] https://www.dokuwiki.org/devel:coding_style
[2] https://www.php-fig.org/psr/psr-2/
[3]
https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md
[4] https://www.dokuwiki.org/devel:bughunting
--
splitbrain.org
--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist