Re: coding recommendations
| From: | Jan Schneider | Date: | Sun, 26 Jan 2003 13:50:20 +0000 |
| Subject: | Re: coding recommendations | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12758@lists.php.net to get a copy of this message | ||
Zitat von Mika Tuupola <tuupola@appelsiini.net>:
> On Sun, 26 Jan 2003, Krystof Slaby wrote:
>
> > 2)
> > why there's no recommendation for constructor to return error code
> (pear error)
> > based on successfullness of initialization ?
>
> Constructor can't return anything else than an instance of
> itself. Or actually it could, but that was considered a bug
> not a feature. IIRC this behaviour was fixed in PHP 4.3.0.
It still works (PHP 4.3.1-dev):
class Foo {
function Foo()
{
....
if ($error) {
$this = PEAR::raiseError('Foo has bared');
return;
}
}
}
Jan.
--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft