Re: [RFC] Default constructors

From: Date: Tue, 18 Nov 2014 21:40:19 +0000
Subject: Re: [RFC] Default constructors
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-78959@lists.php.net to get a copy of this message
On 18/11/2014 20:20, Alexander Kurilo wrote:
Does it *really* make sense for PHP? What if that parent class 'Animal' from your example introduces a constructor that accepts, say, both $owner and $what as mandatory arguments? parent::__construct() call in a descendant will appear broken (unintentionally, I suppose), won't it?
If you introduce a mandatory parameter to *any* function, method, or constructor, existing calls to that function, method, or constructor will be broken. A class with no defined constructor already behaves as if its constructor had no arguments when using "new", so introducing a constructor with mandatory arguments is already a breaking change. -- Rowan Collins [IMSoP]

« previous php.internals (#78959) next »