Coding Standards

From: Date: Sun, 27 Jun 2004 12:47:51 +0000
Subject: Coding Standards
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4507@lists.php.net to get a copy of this message
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 (#4507) next »