Skip to content

Commit 5d37cd9

Browse files
committed
Improve documentation for contributors
1 parent 0d6358f commit 5d37cd9

File tree

2 files changed

+23
-42
lines changed

2 files changed

+23
-42
lines changed

CODING_STANDARDS.md

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
# PHP coding standards
22

3-
This file lists several standards that any programmer adding or changing code in
4-
PHP should follow. Since this file was added at a very late stage of the
5-
development of PHP v3.0, the code base does not fully follow it, but new
6-
features are going in that general direction. Many sections have been rewritten to
7-
use these rules.
3+
This file lists standards that any programmer adding or changing code in
4+
PHP should follow. The code base does not yet fully follow it, but new
5+
features are going in that general direction. Many sections have been
6+
rewritten to comply with these rules.
87

98
## Code implementation
109

1110
1. Document your code in source files and the manual. (tm)
1211

1312
2. Functions that are given pointers to resources should not free them.
1413

15-
For instance, `function int mail(char *to, char *from)` should NOT free to
16-
and/or from.
14+
For instance, `function int mail(char *to, char *from)` should NOT free `to`
15+
and/or `from`.
1716

1817
Exceptions:
1918

2019
* The function's designated behavior is freeing that resource. E.g.
2120
`efree()`
2221

2322
* The function is given a boolean argument, that controls whether or not the
24-
function may free its arguments (if true - the function must free its
25-
arguments, if false - it must not)
23+
function may free its arguments (if true, the function must free its
24+
arguments; if false, it must not)
2625

2726
* Low-level parser routines, that are tightly integrated with the token
2827
cache and the bison code for minimum memory copying overhead.
2928

3029
3. Functions that are tightly integrated with other functions within the same
31-
module, and rely on each other non-trivial behavior, should be documented as
30+
module, and rely on each other's non-trivial behavior, should be documented as
3231
such and declared `static`. They should be avoided if possible.
3332

3433
4. Use definitions and macros whenever possible, so that constants have
35-
meaningful names and can be easily manipulated. The only exceptions to this
36-
rule are 0 and 1, when used as `false` and `true` (respectively). Any other
37-
use of a numeric constant to specify different behavior or actions should be
38-
done through a `#define`.
34+
meaningful names and can be easily manipulated. Any use of a numeric
35+
constant to specify different behavior or actions should be done through
36+
a `#define`.
3937

4038
5. When writing functions that deal with strings, be sure to remember that PHP
4139
holds the length property of each string, and that it shouldn't be
@@ -260,35 +258,18 @@ use these rules.
260258
```
261259

262260
4. When indenting, use the tab character. A tab is expected to represent four
263-
spaces. It is important to maintain consistency in indenture so that
261+
spaces. It is important to maintain consistency in indentation so that
264262
definitions, comments, and control structures line up correctly.
265263

266264
5. Preprocessor statements (`#if` and such) MUST start at column one. To indent
267265
preprocessor directives you should put the `#` at the beginning of a line,
268-
followed by any number of whitespace.
266+
followed by any number of spaces.
269267

270268
## Testing
271269

272-
1. Extensions should be well tested using `*.phpt` tests. Read about that at
270+
1. Extensions should be well tested using `*.phpt` tests. Read more at
273271
[qa.php.net](https://qa.php.net/write-test.php) documentation.
274272

275-
## Folding hooks
276-
277-
Use `{{{` symbols for the folding mode in Emacs and vim (`set fdm=marker`).
278-
Folding is very useful when dealing with large files because you can scroll
279-
through the file quickly and just unfold the function you wish to work on.
280-
The `}}}` at the end of each function marks the end of the fold, and should
281-
be on a separate line.
282-
283-
```c
284-
/* {{{ Returns the absolute value of the number */
285-
PHP_FUNCTION(abs)
286-
{
287-
...
288-
}
289-
/* }}} */
290-
```
291-
292273
## New and experimental functions
293274

294275
To reduce the problems normally associated with the first public implementation
@@ -302,8 +283,8 @@ The file labelled `EXPERIMENTAL` should include the following information:
302283
* Any authoring information (known bugs, future directions of the module).
303284
* Ongoing status notes which may not be appropriate for Git comments.
304285

305-
In general new features should go to PECL or experimental branches until there
306-
are specific reasons for directly adding it to the core distribution.
286+
In general, new features should go to PECL or experimental branches until there
287+
are specific reasons for directly adding them to the core distribution.
307288

308289
## Aliases & legacy documentation
309290

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Anybody who programs in PHP can be a contributing member of the community that
44
develops and deploys it; the task of deploying PHP, documentation and associated
5-
websites is a never ending one. With every release, or release candidate comes a
5+
websites is a never-ending one. With every release or release candidate comes a
66
wave of work, which takes a lot of organization and co-ordination.
77

88
You don't need any special access to download, build, debug and begin submitting
@@ -85,7 +85,7 @@ for additional notes on the best way to approach submitting an RFC.
8585

8686
## Writing tests
8787

88-
We love getting new tests! PHP is a huge project and improving code coverage is
88+
We love getting new tests! PHP is a huge project and improving test coverage is
8989
a huge win for every PHP user.
9090

9191
[Our QA site includes a page detailing how to write test cases.](https://qa.php.net/write-test.php)
@@ -255,30 +255,30 @@ included.
255255

256256
- Read [Coding standards](/CODING_STANDARDS.md) before you start working.
257257
- Update git source just before running your final `diff` and before testing.
258-
- Add in-line comments and/or have external documentation ready. Use only
258+
- Add inline comments and/or have external documentation ready. Use only
259259
`/* */` style comments, not `//`.
260260
- Create test scripts for use with `make test`.
261261
- Run `make test` to check your change doesn't break other features.
262262
- Rebuild PHP with `--enable-debug` which will show some kinds of memory errors
263263
and check the PHP and web server error logs after running your PHP tests.
264264
- Rebuild PHP with `--enable-zts` to check your change compiles and operates
265-
correctly in a thread safe PHP.
265+
correctly in a thread-safe PHP.
266266
- Review the change once more just before submitting it.
267267

268268
## What happens after submitting contribution?
269269

270270
If your change is easy to review and obviously has no side-effects, it might be
271271
committed relatively quickly.
272272

273-
Because PHP is a volunteer-driven effort more complex changes will require
273+
Because PHP is a volunteer-driven effort, more complex changes will require
274274
patience on your side. If you do not receive feedback in a few days, consider
275275
bumping. Before doing this think about these questions:
276276

277277
- Did I send the patch to the right mailing list?
278278
- Did I review the mailing list archives to see if these kind of changes had
279279
been discussed before?
280280
- Did I explain my change clearly?
281-
- Is my change too hard to review? Because of what factors?
281+
- Is my change too hard to review? If so, why?
282282

283283
## What happens when your contribution is applied?
284284

0 commit comments

Comments
 (0)