Re: Mixed return type - boolean and array/resource/closure or object

From: Date: Thu, 06 Mar 2014 20:59:24 +0000
Subject: Re: Mixed return type - boolean and array/resource/closure or object
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-323048@lists.php.net to get a copy of this message
Robert Stoll wrote:
I think you wander off the subject. We were talking about built-in functions/methods and not about userland functions/methods. The original question was if a function/method exists which returns either a boolean or array/resource/closure/object and I got already helpful answers - thanks again :) And the last bit of the discussion was just if the documentation should have "mixed" as return type for such functions/methods or "array/resource/closure/a specific object"
My point(s) were that the documentation for built in functions is not has helpful as CAN be achieved by wrapping those functions in 'userland' methods :) 'mixed' is never the right hint for any of the internal functions, as 'values', 'boolean' and 'null' all provide particular states of result. While some people might prefer that errors are returned as exceptions, returning 'failure' in procedural programming is also how PHP works, and the documentation simply needs to identify those returns. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

« previous php.general (#323048) next »