mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Added additional styleguide rules for method names and type hints.
This commit is contained in:
parent
38192a4297
commit
0f81afab74
@ -101,6 +101,23 @@ Namespaces and classes
|
||||
- Class methods and properties MUST have visibility declarations (i.e.
|
||||
`public`, `private` or `protected`).
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
To maintain consistency between core classes the following method names
|
||||
MUST be used where applicable:
|
||||
|
||||
- `getX()` when the method returns returns a property value, or null if not set
|
||||
- `setX(value)` changes a property value, doesn't return anything, and can
|
||||
throw exceptions
|
||||
- `hasX()` returns a boolean to if a property exists
|
||||
- `newX()` creates an instance of a/the component object and returns it,
|
||||
and can throw exceptions
|
||||
- `isX()` returns true/false for boolean properties
|
||||
|
||||
- Methods SHOULD use type hints and return type hints
|
||||
|
||||
|
||||
Procedural code
|
||||
===============
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user