Skip to content

Commit df19a41

Browse files
Merge pull request #29 from WordPress/chore/contributing-updates
Adds documetation standards to contributing doc
2 parents 3b2daf3 + b20dd07 commit df19a41

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,49 @@ The following naming conventions must be followed for consistency and autoloadin
1818
- File names are the same as the class, trait, and interface name for PSR-4 autoloading.
1919
- Classes, interfaces, and traits, and namespaces are not prefixed with `Ai`, exluding the root namespace.
2020

21+
## Documentation standards
22+
23+
All code must be properly documented with PHPDoc blocks following these standards:
24+
25+
### General rules
26+
- All descriptions must end with a period.
27+
- Use `@since n.e.x.t` for new code (will be replaced with actual version on release).
28+
- Place `@since` tags below the description and above `@param` tags, with blank comment lines around it.
29+
30+
### Method documentation
31+
- Method descriptions must start with a third-person verb (e.g., "Creates", "Returns", "Checks").
32+
- Exceptions: Constructors and magic methods may use different phrasing.
33+
- All `@return` annotations must include a description.
34+
35+
### Interface implementations
36+
- Use `{@inheritDoc}` instead of duplicating descriptions when implementing interface methods.
37+
- Only provide a unique description if it adds value beyond the interface documentation.
38+
39+
### Example
40+
```php
41+
/**
42+
* Class for handling user authentication requests.
43+
*
44+
* @since n.e.x.t
45+
*/
46+
class AuthHandler
47+
{
48+
/**
49+
* Validates user credentials against the database.
50+
*
51+
* @since n.e.x.t
52+
*
53+
* @param string $username The username to validate.
54+
* @param string $password The password to validate.
55+
* @return bool True if credentials are valid, false otherwise.
56+
*/
57+
public function validate(string $username, string $password): bool
58+
{
59+
// Implementation
60+
}
61+
}
62+
```
63+
2164
## PHP Compatibility
2265

2366
All code must be backward compatible with PHP 7.4, which is the minimum required PHP version for this project.

0 commit comments

Comments
 (0)