Skip to content

Commit 52b49e4

Browse files
committed
chore: adds contributing details about lists
1 parent a4260b6 commit 52b49e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,24 @@ The following naming conventions must be followed for consistency and autoloadin
2323
All code must be properly documented with PHPDoc blocks following these standards:
2424

2525
### General rules
26+
2627
- All descriptions must end with a period.
2728
- Use `@since n.e.x.t` for new code (will be replaced with actual version on release).
2829
- Place `@since` tags below the description and above `@param` tags, with blank comment lines around it.
2930

3031
### Method documentation
32+
3133
- Method descriptions must start with a third-person verb (e.g., "Creates", "Returns", "Checks").
3234
- Exceptions: Constructors and magic methods may use different phrasing.
3335
- All `@return` annotations must include a description.
3436

3537
### Interface implementations
38+
3639
- Use `{@inheritDoc}` instead of duplicating descriptions when implementing interface methods.
3740
- Only provide a unique description if it adds value beyond the interface documentation.
3841

3942
### Example
43+
4044
```php
4145
/**
4246
* Class for handling user authentication requests.
@@ -61,6 +65,12 @@ class AuthHandler
6165
}
6266
```
6367

68+
### Array Lists
69+
70+
When an array is a list — that is, an array where the keys are sequential, starting at 0 — use the `list` generic type within the docblock. For example, a parameter that is a list of strings would be documented as `@param list<string> $variable`.
71+
72+
Note that `list<string>` and `string[]` _are not_ the same. The latter is an alias for `array<int, string>` which does not enforce that the keys are sequential. That particular syntax, therefore, will rarely be used.
73+
6474
## PHP Compatibility
6575

6676
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)