Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89036 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73597 invoked from network); 2 Nov 2015 11:06:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Nov 2015 11:06:33 -0000 X-Host-Fingerprint: 178.62.40.5 ajf.me Received: from [178.62.40.5] ([178.62.40.5:12571] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/04-42726-8B347365 for ; Mon, 02 Nov 2015 06:06:32 -0500 Message-ID: To: internals@lists.php.net References: <56372B62.1000206@gmail.com> Date: Mon, 2 Nov 2015 11:06:28 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38 MIME-Version: 1.0 In-Reply-To: <56372B62.1000206@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 178.62.40.5 Subject: Re: [PHP-DEV] [Question] Variadic method signature compatibilitybetween 5.6 and 7.0 From: ajf@ajf.me (Andrea Faulds) Hi Rowan, Rowan Collins wrote: > Clearly, from the language's point of view, class Baz is missing the > parameters in its function signature that Foo specifies, so the warning > seems perfectly correct to me. In your example, you've replaced a single > optional parameter ($bar = null) with a specification of variadic > parameters (...$args); these are clearly not interchangeable, so again, > the signature is different. An extending method merely needs to be "compatible", not have an identical signature. The parent class required one optional parameter, the subclass requires zero or more parameters. Those sounds compatible to me. If you can call the parent class's method here, it would also work on the subclass's method. Thanks. -- Andrea Faulds http://ajf.me/