Access level constrains in php5 really suck

posted: January 4th, 2006 · by: Sven

in: Programming · tagged as: , , ·  2 comments »

I can’t understand why I’m being forced to keep the access level of a class’s method when I extend it.

class SomeFactory extends PEAR_Delegator {    
    protected function __construct() {
    }    
    public static function instance() {
    }
}

... would make perfectly sense IVHMO. But it throws …

"Fatal error: Access level to ActivePdo_Relation::__construct() 
must be public (as in class PEAR_Delegator)" 

What’s the reasoning behind this?

That’s because I’m “doing something terribly wrong”, is it? Not the “php way”? Boy, this sucks.

Leave a comment

2 Comments

  1. Interested Party said January 12th, 2007 at 10:41 AM  

    What are your opinions of PEAR_Delegator?

  2. Sven said January 26th, 2007 at 08:51 AM  

    I believe it's a highly useful package. :)

    I've been talking to the developer at that time and came to the opinion that he really knows what he's doing.

    Unfortunately the package doesn't seem to be maintained that active - "0.1.0 (alpha) was released on 2005-04-10" according to http://pear.php.net/package/PEAR_Delegator

    So there doesn't seem to be that much demand either.

Leave a comment

Name required
E-Mail and Website optional

If you can read this, you don't use a typical webbrowser that plays nice with CSS.
Please do not fill in anything here!

Hint: Markdown will be applied to your comment. If you post any code, be sure to escape underscores (like so: \_) if you do not want them to be converted to an <em>phasis.

artweb design
Sven Fuchs
Grünberger Str. 65
10245 Berlin, Germany


http://www.artweb-design.de

Fon +49 (30) 47 98 69 96
Fax +49 (30) 47 98 69 97