Re: Coding Standards

From: Date: Mon, 28 Jun 2004 01:05:45 +0000
Subject: Re: Coding Standards
References: 1  Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4518@lists.php.net to get a copy of this message
I assume this is okay to commit then? :P "Aidan Lister" <aidan@php.net> wrote in message news:20040627124748.73788.qmail@pb1.pair.com... > Hey, > > A couple of things I'd like added to the coding standards. > > ++ Casting: > $foo = (bool)$foo; > $foo = ( bool ) $foo; > $foo = (bool) $foo; > > etc. > > ++ Driver pattern > A massive number of pear classes use the driver design pattern to include > files. I think we should specify the method of including files. > Should it be done with a basename(__FILE__) approach, or by relying on the > include path. > > <?php > define ('CAT_PACK_BASE', basename(__FILE__)); > require_once CAT_PACK_BASE . 'Driver/mysql.php'; > > vs > > require_once 'Cat/Pack/Driver/mysql.php'; > ?> > > ++ Including files > The page on using include/require needs to be explained better. Require > should be used in all cases unless the script will run if the include fails > (ie optional include).

« previous php.pear.doc (#4518) next »