@@ -18,6 +18,49 @@ The following naming conventions must be followed for consistency and autoloadin
18
18
- File names are the same as the class, trait, and interface name for PSR-4 autoloading.
19
19
- Classes, interfaces, and traits, and namespaces are not prefixed with ` Ai ` , exluding the root namespace.
20
20
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
+
21
64
## PHP Compatibility
22
65
23
66
All code must be backward compatible with PHP 7.4, which is the minimum required PHP version for this project.
0 commit comments