Re: [PHP-DEV] __constructor parameter limitations.

2011-09-23 Thread Kalle Sommer Nielsen
Hi 2011/9/23 Ferenc Kovacs : > A little bit off-topic, but maybe we could also discuss/fix this: > https://bugs.php.net/bug.php?id=43200 > http://groups.google.com/group/symfony-devs/browse_thread/thread/3fc16ba601045551 I don't see the bug in that matter, because the interface defines the protot

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-23 Thread Ferenc Kovacs
On Tue, Sep 20, 2011 at 9:35 PM, Stas Malyshev wrote: > Hi! > > On 9/20/11 12:07 PM, Reindl Harald wrote: >> >> but it is not logical >> >> foo() in B can do anything with $a before or after parent::foo() >> and the caller does not need to know at any point that B >> has anything to do with the cl

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Stas Malyshev
Hi! On 9/20/11 12:07 PM, Reindl Harald wrote: but it is not logical foo() in B can do anything with $a before or after parent::foo() and the caller does not need to know at any point that B has anything to do with the class A Consider this code: function doFoo(A $a) { $a->foo(); } It's fi

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Reindl Harald
but it is not logical foo() in B can do anything with $a before or after parent::foo() and the caller does not need to know at any point that B has anything to do with the class A Am 20.09.2011 19:40, schrieb Stas Malyshev:Hi! On 9/19/11 2:32 AM, Gustavo Lopes wrote: > The thing if you introduce

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Stas Malyshev
Hi! On 9/19/11 8:34 AM, Etienne Kneuss wrote: Sure, you can do it. But if you do, you're lying about the interface. You're telling the callers that you expect no arguments, but then all of a sudden you error out. Well, we have no way of declaring that we accept an undefined number of argu

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Stas Malyshev
Hi! On 9/19/11 7:26 AM, Anthony Ferrara wrote: that point, why even bother with interfaces? The interface defines what should be accepted, and any method that implements it should accept exactly that (no more, no less, no different). Otherwise Here you lost me. Why exactly you can not accept

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Stas Malyshev
Hi! On 9/19/11 3:20 AM, Pierre Joye wrote: If we talk about implementing the abstract concept and we use the interface model to do it, then we do it wrong. I'm out of other arguments, or maybe one new one, if we implement abstract like interface, then let kill abstract support, we don't need tha

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Stas Malyshev
Hi! On 9/19/11 2:50 AM, Gustavo Lopes wrote: * It had to be case that the parameters you want to ignore are the last Of course, but that's a very common scenario - important parameters go first, unimportant go last. Or, if I wanted, I could just have blank signature foo() and figure it out i

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-20 Thread Stas Malyshev
Hi! On 9/19/11 2:32 AM, Gustavo Lopes wrote: The thing if you introduce func_get_args() to the argument, any discussion about enforcing signatures becomes meaningless. One could argue this should be allowed: class A { function foo() {} } class B extends A { function foo($a) {} } No, this can

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Tjerk Meesters
On Sep 20, 2011 2:10 AM, wrote: > > Hi! > > I followed the whole discussion, still it is not clear which one is > considered good and which bad practice... > > In ZF 1 and 2, ZendRegistry::__construct() has the following signature with > 2 parameters: > > function __construct($array = array(), $fl

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread devis
Hi! I followed the whole discussion, still it is not clear which one is considered good and which bad practice... In ZF 1 and 2, ZendRegistry::__construct() has the following signature with 2 parameters: function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS) while SPL ArrayObje

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
First of all, Anthony, thanks for joining into the discussion! >> With respect to the func_get_args argument, I see that as a non-issue. >>  Sure, you can do it.  But if you do, you're lying about the >> interface.  You're telling the callers that you expect no arguments, >> but then all of a sudd

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 16:26, Anthony Ferrara wrote: > Hello all, > > I purposely tried to stay out of this conversation, but seeing as > there's a lot of information flying around I think I'll give my > $0.02... > > As far as the Square-Rectangle example, that is a classic violation of > t

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Anthony Ferrara
Hello all, I purposely tried to stay out of this conversation, but seeing as there's a lot of information flying around I think I'll give my $0.02... As far as the Square-Rectangle example, that is a classic violation of the LSP. In fact, it's unsolvable using inheritance. For information as to

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Laruence
2011/9/19 Etienne Kneuss : > Hi, > > On Mon, Sep 19, 2011 at 12:40, Etienne Kneuss wrote: > >> Hi, >> >> On Mon, Sep 19, 2011 at 12:18, Gustavo Lopes wrote: >> >>> Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss >>> escreveu: >>> >>> >>> Apparently you guys are speaking about the initial

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 12:40, Etienne Kneuss wrote: > Hi, > > On Mon, Sep 19, 2011 at 12:18, Gustavo Lopes wrote: > >> Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss >> escreveu: >> >> >> >>> Apparently you guys are speaking about the initial implementation of an >>> abstract method, w

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 12:18, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss > escreveu: > > > >> Apparently you guys are speaking about the initial implementation of an >> abstract method, while I was talking about overriding a method, which is >> not the relly

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 11:20:56 +0100, Pierre Joye escreveu: On Mon, Sep 19, 2011 at 12:18 PM, Gustavo Lopes wrote: http://www.google.com/codesearch#HmA4mAI_aLc/src/main/java/terrastore/server/impl/support/JsonBucketsProvider.java&q=implements%5C%20MessageBodyWriter&type=cs&l=36 This is the

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
On Mon, Sep 19, 2011 at 11:50, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev > escreveu: > > On 9/19/11 2:12 AM, Gustavo Lopes wrote: >> >>> Arbitrary as it may be, it's nevertheless reasonably arbitrated given how >>> little useful it is to just ignore arguments and

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 12:20 PM, Pierre Joye wrote: > On Mon, Sep 19, 2011 at 12:18 PM, Gustavo Lopes > wrote: > http://www.google.com/codesearch#HmA4mAI_aLc/src/main/java/terrastore/server/impl/support/JsonBucketsProvider.java&q=implements%5C%20MessageBodyWriter&type=cs&l=36 >> >> This is the

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 12:18 PM, Gustavo Lopes wrote: http://www.google.com/codesearch#HmA4mAI_aLc/src/main/java/terrastore/server/impl/support/JsonBucketsProvider.java&q=implements%5C%20MessageBodyWriter&type=cs&l=36 > > This is the most common scenario for implementations of this interface (see

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss escreveu: Apparently you guys are speaking about the initial implementation of an abstract method, while I was talking about overriding a method, which is not the relly same. So the above doesn't really apply. The initial implementation

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, 2011/9/19 Frédéric Hardy > Hi ! > > >> You misunderstand what LSP means. It does not mean "overriding methods >> should have same signatures", it means "overriding methods should accept any >> data that base method accepts". It never says it can not accept any other >> data. >> > Idem. > So

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Frédéric Hardy
Hi ! You misunderstand what LSP means. It does not mean "overriding methods should have same signatures", it means "overriding methods should accept any data that base method accepts". It never says it can not accept any other data. Idem. So you can have : class A { public function f($a) {

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 11:55 AM, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:35:47 +0100, Ferenc Kovacs > escreveu: > >> could you check my second(lengthy) mail on this thread? >> I also tried to come up with the valid, and invalid signature changes. >> I forget to take references into account

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 11:56 AM, Etienne Kneuss wrote: >> There is a precondition that the abstract method enforces in such >> prototypes, and it is: >> - I will require at least X arguments >> if a method implements this and defines the prototype with: >> - I will require at least Y arguments w

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 11:28, Etienne Kneuss wrote: > Hi, > > On Mon, Sep 19, 2011 at 11:19, Pierre Joye wrote: > >> On Mon, Sep 19, 2011 at 11:12 AM, Stas Malyshev >> wrote: >> > Hi! >> > >> > On 9/19/11 2:02 AM, Pierre Joye wrote: >> >> >> >> Sorry but your constantly rejecting any logi

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Richard Quadling
On 19 September 2011 10:17, Etienne Kneuss wrote: > Hi, > > 2011/9/19 Frédéric Hardy > >> Hi ! >> >> What is the utility of abstract method if implementation can not follow >> the signature (constraints ?) of the abstract method ? >> > In this case, abstract methods are totaly useless ! >> Moreov

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 11:32 AM, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev > escreveu: > >> On 9/19/11 2:12 AM, Gustavo Lopes wrote: >>> >>> Arbitrary as it may be, it's nevertheless reasonably arbitrated given how >>> little useful it is to just ignore arguments a

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev escreveu: On 9/19/11 2:12 AM, Gustavo Lopes wrote: Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a mistake. It is not little useful and it is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 10:40 AM, Gustavo Lopes wrote: > Em Sun, 18 Sep 2011 20:06:31 +0100, Stas Malyshev > escreveu: > >> On 9/18/11 11:23 AM, Nikita Popov wrote: >>> >>> to tell you: I need this and that method accepting these and these >>> arguments to work correctly. If the signature isn't e

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev escreveu: On 9/19/11 2:12 AM, Gustavo Lopes wrote: Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a mistake. It is not little useful and it is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 11:12 AM, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:01:32 +0100, Etienne Kneuss > escreveu: > >> Sure, but you mix two things here, references would have to be handled >> specifically, and we would not allow to specify less args by ref. >> >> There is simply no reason

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 11:19, Pierre Joye wrote: > On Mon, Sep 19, 2011 at 11:12 AM, Stas Malyshev > wrote: > > Hi! > > > > On 9/19/11 2:02 AM, Pierre Joye wrote: > >> > >> Sorry but your constantly rejecting any logical, documented, known > >> principles for the abstract concept is killin

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 11:12 AM, Stas Malyshev wrote: > Hi! > > On 9/19/11 2:02 AM, Pierre Joye wrote: >> >> Sorry but your constantly rejecting any logical, documented, known >> principles for the abstract concept is killing me. > > I didn't see any documented principle that say the code I cited

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 2:12 AM, Gustavo Lopes wrote: Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a mistake. It is not little useful and it is not likely to make such mistake without immediately being no

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, 2011/9/19 Frédéric Hardy > Hi ! > > What is the utility of abstract method if implementation can not follow > the signature (constraints ?) of the abstract method ? > In this case, abstract methods are totaly useless ! > Moreover, i think that it's not compatible with Liskov substitution > p

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 2:05 AM, Frédéric Hardy wrote: What is the utility of abstract method if implementation can not follow the signature (constraints ?) of the abstract method ? In this case, abstract methods are totaly useless ! Moreover, i think that it's not compatible with Liskov substitution pri

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Frédéric Hardy
Hi ! What is the utility of abstract method if implementation can not follow the signature (constraints ?) of the abstract method ? In this case, abstract methods are totaly useless ! Moreover, i think that it's not compatible with Liskov substitution principle. Best regards, Fred -- ==

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:01:32 +0100, Etienne Kneuss escreveu: Sure, but you mix two things here, references would have to be handled specifically, and we would not allow to specify less args by ref. There is simply no reason for disallowing this with nornal args though. Imagine the following

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 2:02 AM, Pierre Joye wrote: Sorry but your constantly rejecting any logical, documented, known principles for the abstract concept is killing me. I didn't see any documented principle that say the code I cited is prohibited. Only example you brought so far is C function declara

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Frédéric Hardy
Hi ! What is the utility of abstract method if implementation can not follow the signature (constraints ?) of the abstract method ? In this case, abstract methods are totaly useless ! Moreover, i think that it's not compatible with Liskov substitution principle (http://en.wikipedia.org/wiki/Li

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 1:40 AM, Gustavo Lopes wrote: If the subclass method specifies less parameters, it is very likely a mistake. It's not usual (certainly it's not more frequent than a mistake Why would it always be? I had code where overriding class had methods that need less arguments and substi

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 10:46 AM, Stas Malyshev wrote: > Please do not assume I disagree with you because I am unable to understand > you. I understand you perfectly well and you are wrong. Sorry but your constantly rejecting any logical, documented, known principles for the abstract concept is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 10:40, Gustavo Lopes wrote: > Em Sun, 18 Sep 2011 20:06:31 +0100, Stas Malyshev > escreveu: > > On 9/18/11 11:23 AM, Nikita Popov wrote: >> >>> to tell you: I need this and that method accepting these and these >>> arguments to work correctly. If the signature isn't

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 1:33 AM, Pierre Joye wrote: It is the same in C. A class extending an abstract class (or method) does not extend it per se but implement it. Just like the foo(int a, float b); is the declaration (abstract) and foo(int a, float b) { return a * b;= the extended class. This is the ba

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Sun, 18 Sep 2011 20:06:31 +0100, Stas Malyshev escreveu: On 9/18/11 11:23 AM, Nikita Popov wrote: to tell you: I need this and that method accepting these and these arguments to work correctly. If the signature isn't enforced, this doesn't make sense anymore. You could just as well drop t

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 3:00 AM, Stas Malyshev wrote: > Hi! > > On 9/18/11 5:42 PM, Pierre Joye wrote: >> >> But this exact example works, only the similar case using abstract >> will fail, and it makes to fail here as an abstract method is only the > > It produces E_STRICT for regular functions,

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Reindl Harald
Am 19.09.2011 03:00, schrieb Stas Malyshev: > The example without abstract works, but produces E_STRICT which is useless too right - because the following code is totally valid and reasonable even if "my_function" will later get a fourth param $d='default' and the strict warnings here forcing y

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Stas Malyshev
Hi! On 9/18/11 5:42 PM, Pierre Joye wrote: But this exact example works, only the similar case using abstract will fail, and it makes to fail here as an abstract method is only the It produces E_STRICT for regular functions, but for some reason not for ctors, but fatal error for abstract ctor

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Pierre Joye
On Mon, Sep 19, 2011 at 2:42 AM, Pierre Joye wrote: > But this exact example works, only the similar case using abstract > will fail, and it makes to fail here as an abstract method is only the > declaration, the implementation being done in the child class (bar > extends foo). This is the concep

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Pierre Joye
On Mon, Sep 19, 2011 at 2:27 AM, Stas Malyshev wrote: > Hi! > > On 9/18/11 5:24 PM, Pierre Joye wrote: >> >> class foo{ >>  function __construct(){} >> } >> class bar extends foo{ >>   function__construct($a, $b){} >> } > > Come on. This is not my example. My example was: > > class foo{ >  functio

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 2:24 AM, Pierre Joye wrote: > On Mon, Sep 19, 2011 at 1:59 AM, Stas Malyshev wrote: > >> foo() is compatible with foo($a, $b) - since anywhere you can call function >> declared as foo($a, $b) you can also successfully call one declared as >> foo(), it'd just ignore extra p

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Stas Malyshev
Hi! On 9/18/11 5:24 PM, Pierre Joye wrote: class foo{ function __construct(){} } class bar extends foo{ function__construct($a, $b){} } Come on. This is not my example. My example was: class foo{ function __construct($a, $b){} } class bar extends foo{ function__construct(){} } I woul

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Pierre Joye
On Mon, Sep 19, 2011 at 1:59 AM, Stas Malyshev wrote: > foo() is compatible with foo($a, $b) - since anywhere you can call function > declared as foo($a, $b) you can also successfully call one declared as > foo(), it'd just ignore extra parameters -  but it is not allowed (I gave an > example). I

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Stas Malyshev
Hi! On 9/18/11 4:21 PM, Pierre Joye wrote: The key word missing here is "compatible". We enforce (or should) compatible signatures. And that makes totally sense. foo() is compatible with foo($a, $b) - since anywhere you can call function declared as foo($a, $b) you can also successfully call

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 1:21 AM, Pierre Joye wrote: > hi, > > On Sun, Sep 18, 2011 at 9:06 PM, Stas Malyshev wrote: > >> There's no matter of "breaking BC" - there's no BC issues with dropping >> error messages, nobody's code relies on generating fatal errors for specific >> code. > > Btw, afair

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Pierre Joye
hi, On Sun, Sep 18, 2011 at 9:06 PM, Stas Malyshev wrote: > There's no matter of "breaking BC" - there's no BC issues with dropping > error messages, nobody's code relies on generating fatal errors for specific > code. Btw, afair there is and was no BC as it was introduced with the abstract sup

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Stas Malyshev
Hi! On 9/18/11 11:23 AM, Nikita Popov wrote: I didn't see any complaints about this "feature", so I don't really see a reason why we should break BC with 5.3 here and drop the error message. There's no matter of "breaking BC" - there's no BC issues with dropping error messages, nobody's code

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Nikita Popov
On Sun, Sep 18, 2011 at 8:01 PM, Stas Malyshev wrote: > 3. Some of them aren't actually a warnings but fatal errors. Example: > > abstract class BaseClass { >    abstract public function foo(Type1 $foo, Type2 $bar); > } > > class ExtendedClass extends BaseClass { >   public function foo() { >   }

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Stas Malyshev
Hi! On 9/18/11 8:09 AM, Derick Rethans wrote: If you don't want those warnings, turn them off! That's why there is a specific error level for it. 1. It's not possible to turn these specific warnings off. The error level turns off all warnings on the level, not just specific ones. 2. These w

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Pierre Joye
On Sun, Sep 18, 2011 at 5:09 PM, Derick Rethans wrote: > On Sat, 17 Sep 2011, Stas Malyshev wrote: > >> On 9/17/11 6:27 AM, Richard Quadling wrote: >> > With the recent BC with regard the locking of the constructor's >> > signature for subclasses, what is the expected mechanism for allowing >> > a

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Derick Rethans
On Sat, 17 Sep 2011, Stas Malyshev wrote: > On 9/17/11 6:27 AM, Richard Quadling wrote: > > With the recent BC with regard the locking of the constructor's > > signature for subclasses, what is the expected mechanism for allowing > > a subclass to have additional parameters? > > I think the whole

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Laruence
Hi: if this change will not revert, I will ask a more clearly error message for this, I report a req, https://bugs.php.net/bug.php?id=55719, which is, the error message should told user what the correct argument list is. and also submitted a patch for this req. thanks 2011/9/1

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Frédéric Hardy
Hi ! > For one I do think that enforcing strictness, or as I see it, clean > code and implementation, should be done in php. We did not do that in > the past and it has created more issues than anything else in the long > run. +1. > One solution to solve the need of having different methods or >

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-18 Thread Pierre Joye
hi, My two cents: For one I do think that enforcing strictness, or as I see it, clean code and implementation, should be done in php. We did not do that in the past and it has created more issues than anything else in the long run. One solution to solve the need of having different methods or co

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Stas Malyshev
Hi! On 9/17/11 2:39 PM, Richard Quadling wrote: An interface is the absolute here. Sub classes (the super class being abstract or otherwise), should be able to define MORE parameters (with or without default values). Otherwise they aren't extending, but implementing - and for me that's the role

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Nikita Popov
On Sat, Sep 17, 2011 at 11:39 PM, Richard Quadling wrote: > My question was due to the documentation commit > http://news.php.net/php.doc.cvs/8818 and > http://news.php.net/php.doc.cvs/8819. Just to clarify (as I'm not sure you got that change right): PHP has enforced signatures for methods define

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Richard Quadling
On 17 September 2011 15:52, Ferenc Kovacs wrote: > maybe Richard referring to https://bugs.php.net/bug.php?id=55085 ? > but those change only affects the abstract classes. > > Tyrael > > On Sat, Sep 17, 2011 at 3:43 PM, Nikita Popov > wrote: >> Hi Richard! >> >> Which change are you talking abou

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Etienne Kneuss
On Sat, Sep 17, 2011 at 20:08, Stas Malyshev wrote: > Hi! > > On Sat, Sep 17, 2011 at 17:08, Laruence wrote: >> >>> class A { public function init($a, $b) { } } class B extends A { public function init($a) { } } => PHP Strict Standards: Declaration of B::init() s

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Stas Malyshev
Hi! On 9/17/11 6:27 AM, Richard Quadling wrote: With the recent BC with regard the locking of the constructor's signature for subclasses, what is the expected mechanism for allowing a subclass to have additional parameters? I think the whole "strict parameters" thing has gone into somewhat wro

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Reindl Harald
Am 17.09.2011 20:08, schrieb Stas Malyshev: > Hi! > >> On Sat, Sep 17, 2011 at 17:08, Laruence wrote: class A { public function init($a, $b) { } } class B extends A { public function init($a) { } } => PHP Strict Standards: Declaration of B::init() should be compa

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Stas Malyshev
Hi! On Sat, Sep 17, 2011 at 17:08, Laruence wrote: class A { public function init($a, $b) { } } class B extends A { public function init($a) { } } => PHP Strict Standards: Declaration of B::init() should be compatible with that of A::init() do you know any reason for this?

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Ferenc Kovacs
>>  do you know any reason for this? >> > > The reason for this is simply that B must act like A since every B object is > also an object of A. > > The reason for restricting the method signature in the Subclass is to guarantee that an instance of a Subclass should work where an instance of the Su

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Laruence
2011/9/17 Etienne Kneuss : > > > On Sat, Sep 17, 2011 at 17:15, Laruence wrote: >> >> Hi: >>  this is really a big bc break...(fatal error) >>  is there any reason for us to really change this?   In Yaf, there >> are a lot of Abstract classes,  the subclass only need declared there >> argument whe

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Etienne Kneuss
On Sat, Sep 17, 2011 at 17:15, Laruence wrote: > Hi: > this is really a big bc break...(fatal error) > is there any reason for us to really change this? In Yaf, there > are a lot of Abstract classes, the subclass only need declared there > argument when they really need it. > Well, that is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Laruence
2011/9/17 Etienne Kneuss : > > > On Sat, Sep 17, 2011 at 17:08, Laruence wrote: >> >> 2011/9/17  : >> > Hi, >> > >> > I think Richards intended other methods often used in combination with >> > __construct: >> > >> > class A           { public function init($a, $b) { } } >> > class B extends A { p

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Etienne Kneuss
On Sat, Sep 17, 2011 at 17:08, Laruence wrote: > 2011/9/17 : > > Hi, > > > > I think Richards intended other methods often used in combination with > > __construct: > > > > class A { public function init($a, $b) { } } > > class B extends A { public function init($a) { } } > > > > => PH

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Laruence
Hi: this is really a big bc break...(fatal error) is there any reason for us to really change this? In Yaf, there are a lot of Abstract classes, the subclass only need declared there argument when they really need it. and I really not think this change is good one, the Intenal class can

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Laruence
2011/9/17 : > Hi, > > I think Richards intended other methods often used in combination with > __construct: > > class A           { public function init($a, $b) { } } > class B extends A { public function init($a) { } } > > => PHP Strict Standards:  Declaration of B::init() should be compatible wi

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Ferenc Kovacs
maybe Richard referring to https://bugs.php.net/bug.php?id=55085 ? but those change only affects the abstract classes. Tyrael On Sat, Sep 17, 2011 at 3:43 PM, Nikita Popov wrote: > Hi Richard! > > Which change are you talking about? I just tried doing: >        class A           { public functio

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread devis
Hi, I think Richards intended other methods often used in combination with __construct: class A { public function init($a, $b) { } } class B extends A { public function init($a) { } } => PHP Strict Standards: Declaration of B::init() should be compatible with that of A::init() The ex

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Nikita Popov
Hi Richard! Which change are you talking about? I just tried doing: wrote: > Hi. > > With the recent BC with regard the locking of the constructor's > signature for subclasses, what is the expected mechanism for allowing > a subclass to have additional parameters? > > You can always supply th

[PHP-DEV] __constructor parameter limitations.

2011-09-17 Thread Richard Quadling
Hi. With the recent BC with regard the locking of the constructor's signature for subclasses, what is the expected mechanism for allowing a subclass to have additional parameters? You can always supply them and use func_get_args() / func_num_args() / etc. to read them. It would seem that the lim