Details
-
Improvement
-
Status: Closed
-
Low
-
Resolution: Done
-
None
Description
Policy: Type hints and return type declarations
Since 10th Sep 2020, this rule applies:
- The uses of type hints and return type declarations is required in PHP in all possible locations for all new code.
- There will be necessary exclusions, such as code extending existing non-compliant code and implementing things where it is not available.
- It's NOT required to change all current old-style occurrences in the codebase. We'll follow a progressive approach here (new code and modified code)
Type hints and return type declarations are available in all supported versions of PHP and we typically use them.
This issue is about formalising the requirement of their use in all possible locations for all new code.
To be clear, there will be necessary exclusions:
- code extending existing non-compliant code and implementing things where it is not available
- ... Hmm... maybe others too?
Voting
Option A
- Require them for the new methods (except for the previous exclusions).
Option B
- Leave things as they are: use type hints and return type declarations is recommended, but still optional.
Attachments
Issue Links
- blocks
-
MDLSITE-6216 Coding style: clarify class declaration docs
-
- Closed
-
- has a non-specific relationship to
-
MDLSITE-5667 Coding style ruling about function/method return types and nullables
-
- Closed
-
- has been marked as being related by
-
MDLSITE-5667 Coding style ruling about function/method return types and nullables
-
- Closed
-