[Bug 389051] Re: Prototype inheritance enforced on __construct

Jesdisciple jesdisciple at gmail.com
Thu Jun 18 16:50:11 BST 2009


** Description changed:

  Binary package hint: php5
  
  Ubuntu 9.04
  PHP v5.2.6-3ubuntu4.1
  
  http://bugs.php.net/bug.php?id=34019
  > I think we should either disable __construct/__destruct enforcement or
  > ensure the interface rules apply since that is imho the only thing that
  > would make sense.
+ (Looking at this quote again, he wasn't proposing what I am; it is, however, the most relevant comment I found.)
  
  I request that the first option be chosen, or at least offered to users.
  Having identical arguments in constructors is much too restricting.  In
  my case, I have a very generic top-level class which takes two arrays,
  $options and $details.  In my more specific classes, I wanted to list
  the parameters explicitly and then pass them as arrays internally.  I
  think this is more intuitive, and it's certainly more convenient for the
  user of the specific classes (me, haha).
  
  I would welcome, in place of this rule, a requirement that the child
  class call the parent's constructor, using the normal calling rules.
+ 
+ Workaround:  On the most specific classes, provde a static
+ 'get_instance' function which calls the constructor.  If children of
+ these classes need to use yet another constructor prototype, they must
+ make a new method.

** Description changed:

  Binary package hint: php5
  
  Ubuntu 9.04
  PHP v5.2.6-3ubuntu4.1
  
  http://bugs.php.net/bug.php?id=34019
  > I think we should either disable __construct/__destruct enforcement or
  > ensure the interface rules apply since that is imho the only thing that
  > would make sense.
  (Looking at this quote again, he wasn't proposing what I am; it is, however, the most relevant comment I found.)
  
  I request that the first option be chosen, or at least offered to users.
  Having identical arguments in constructors is much too restricting.  In
- my case, I have a very generic top-level class which takes two arrays,
- $options and $details.  In my more specific classes, I wanted to list
- the parameters explicitly and then pass them as arrays internally.  I
- think this is more intuitive, and it's certainly more convenient for the
- user of the specific classes (me, haha).
+ my case, I have a very generic top-level class which takes two
+ associative arrays, $options and $details.  In my more specific classes,
+ I wanted to list the parameters explicitly and then pass them as arrays
+ internally.  I think this is more intuitive, and it's certainly more
+ convenient for the user of the specific classes (me, haha).
  
  I would welcome, in place of this rule, a requirement that the child
  class call the parent's constructor, using the normal calling rules.
  
  Workaround:  On the most specific classes, provde a static
  'get_instance' function which calls the constructor.  If children of
  these classes need to use yet another constructor prototype, they must
  make a new method.

-- 
Prototype inheritance enforced on __construct
https://bugs.launchpad.net/bugs/389051
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in ubuntu.



More information about the Ubuntu-server-bugs mailing list