Re: autoload, include_once naming conventions

From: Date: Fri, 18 Mar 2005 17:15:23 +0000
Subject: Re: autoload, include_once naming conventions
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36755@lists.php.net to get a copy of this message
Daniel Convissor wrote:
On Fri, Mar 18, 2005 at 08:30:05AM +0100, Lukas Smith wrote:
To me the naming convention is quite simple: Any public class needs to be in its own file that matches the "_" => "/" style.
It definitely is simple. Cleaning things up is a good idea. But, keep in mind the other hitch to auto-loading: the "one class per file" is not mandatory or completely implemented. Again, this is not insurmountable, but work must be done and BC must be maintained.
To avoid BC break there is a simple solution: 1. Move the class file in the proper folder for the class name
    according to naming convention,
2. Add a ghost file to simple include_once 'Class/in/proper/place.php'; Yes, it is a hack, but that's the only way to fix the class name <=> path problem without BC break. Of course, we don't want to do that for classes that would not normally be directly "instanced" by the user. That includes all the *_Result, *_Exception and other similar classes which are usually bundled in other class files. -Philippe

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