From ff9aa3aca83b11bee99f08dc602f5d6fde274a67 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Feb 2023 08:12:20 +0100 Subject: [PATCH] CODING_STANDARDS.md: add rules for bool/zend_result return types @nikic mentioned this guideline on php-internals (https://news-web.php.net/php.internals/119573), but it appears to be undocumented. --- CODING_STANDARDS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CODING_STANDARDS.md b/CODING_STANDARDS.md index 25ecd75cb07bc..742f0c3178fae 100644 --- a/CODING_STANDARDS.md +++ b/CODING_STANDARDS.md @@ -74,6 +74,11 @@ rewritten to comply with these rules. may need to control or free the memory, or when the memory in question needs to survive between multiple requests. +1. The return type of "is" or "has" style functions should be `bool`, + which return a "yes"/"no" answer. `zend_result` is an appropriate + return value for functions that perform some operation that may + succeed or fail. + ## User functions/methods naming conventions 1. Function names for user-level functions should be enclosed with in the