Re: Re: PEAR Coding Standards

From: Date: Tue, 04 May 2004 00:07:39 +0000
Subject: Re: Re: PEAR Coding Standards
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-28747@lists.php.net to get a copy of this message
Sergio Carvalho wrote:
Thorsten Suckow-Homberg wrote:
b) You are not allowed to use the "@" for hiding error-messages in any way.
I'd rephrase that as: "Whenever you use @ for hiding error-messages, you must test the result and retrigger the error as a Pear Error when appropriate".
@ has considerable uses - and should have some guidelines: eg. ------ INCLUDING AND REQURING ---- @ should not generally be used infront of include/require, as it a) prevents user readable errors b) can hide fatal parse errors.. @include_once 'somefile.php'; .. if, like PEAR DB, people when first installing, often mess up the include path, and get 'DB_Failed' .... It would save everybody alot of time and effort if it was include_once 'somefile.php'; and emited an error could not find somefile.php in include_path ........ If failure to include the path is 'acceptable' - then the method call itself can be silenced. (however this tends to be very rare..) ------ GENERAL USAGE ------ there are times when checking variables where although it is minutely slower, it does aid readibility. if (@$options['dosomething'] == true) { is significantly clearer than if (isset($options['dosomething']) && ($options['dosomething'] == true)) { ..... ---------------------------------- @ is part of the language, and in some respects is just a short form of catch/try/throw.

« previous php.pear.dev (#28747) next »