Hi,
You may want to change the URL to PEAR coding style in
doc/README.coding from
http://www.php.net/manual/en/pear.standards.php
to
http://pear.php.net/manual/en/standards.php
Also, the current Vim tab settings for PEAR coding style is
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
which goes against the 'please use spaces and set tab width to 8' style
specified. Regardless, it should be easy enough to change to whatever
style is deemed appropriate for the project. Personally, I try to stay
consistent with a project's dominant style[1] but it rarely hurts to
explicitly spell it out.
A more rigorous standard is at
http://www.phpinfo.net/articles/article_php-coding-standard.html It's
probably overkill but it can't hurt to skim it for good ideas that don't
require a lot of investment.
Ideally, we could recommend a GPL'd cross-platform command-line PHP
source code formatter ("pretty-printer") and a config file. Something
like perltidy would be nice; all I can find are either online formatters
(no source, no CLI), source highlighters (only formats code for
presentation), commercial tools (no GPL), or Windows-only tools (not
cross-platform.) Maybe someone else can coax a better answer out of
Google.
Also, another nice resource I found was php_abb.vim, a set of Vim macros
that expand PHP functions, etc., from abbreviations. It doesn't help
with coding standards but it may simplify PHP coding for the
brain-damaged Vim users among us[2]. :)
Please don't take any of this as criticism of phpwiki development; I'm
just looking for ways to help people contribute legible code and to
clean up coding on my own projects.
hth,
-- Bob
[1] Except for the case of badly-formatted perl, in which case I run the
code through perltidy() and pray the maintainer has sense enough to
check in the reformatted code.
[2] No flames, please. Gads, I can still remember sitting in my Machine
Language Programming class, scowling at the terminal, asking my TA if
there was any other editor I could use besides vi. His answer: "Nope."
That was almost twenty years ago and I'm _still_ stuck using this crappy
editor. Every 2-3 years I try to get with the program and use emacs but
every time I do, I end up beating my head against the keyboard and
weeping uncontrollably because I accidentally hit
<alt><meta><esc><backspace>-Q which is mapped to "destabilize Bolivian
economy" or "cause mudslides in Orange County" or something, then I give
up, taking my vi-damaged brain back to my brain-damaged editor... :)
|