Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85732 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40555 invoked from network); 4 Apr 2015 18:16:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2015 18:16:54 -0000 Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:47899] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/B0-27430-49A20255 for ; Sat, 04 Apr 2015 13:16:53 -0500 Received: from dslb-092-078-029-076.092.078.pools.vodafone-ip.de ([92.78.29.76] helo=[192.168.178.30]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1YeScj-0002v7-4i; Sat, 04 Apr 2015 20:16:49 +0200 Message-ID: <55202A90.2070800@mabe.berlin> Date: Sat, 04 Apr 2015 20:16:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Dmitry Stogov , Nikita Popov CC: Dan Ackroyd , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1428171413;7d99570b; Subject: Re: [PHP-DEV] [RFC][VOTE] Constructor behaviour of internal classes From: dev@mabe.berlin (Marc Bennewitz) Hi Nikita, Dmitry, I think it's a mistake to throw a TypeException on invalid argument count as in this case it has nothing to do with a type. Marc Am 03.04.2015 um 20:48 schrieb Dmitry Stogov: > I don' t see any problems. > > Thanks. Dmitry. > > On Fri, Apr 3, 2015 at 6:31 PM, Nikita Popov wrote: > >> On Wed, Apr 1, 2015 at 3:31 AM, Dan Ackroyd >> wrote: >> >>> Hi Dmitry, >>> >>> Your approach is definitely a better one, and I have no objection to >>> it whatsoever. >>> >>> Sorry, I was too busy to look deeply at each class but I can't see any >>> problems. >>> >>> Nikita Popov wrote: >>>> does that mean that the same code using strict_types=1 mode will start >>>> throwing TypeException instead of whatever exception type is passed >>>> to replace_error_handling? >>> That's going to affect everything isn't it - not just this RFC? >>> >>> However I think that is the correct behaviour. It more closely >>> resembles the behaviour that will be seen in userland code, and is >>> more 'semantically' meaningful i.e. it allows people to tell the cases >>> between the two types of errors apart. >>> >>> It probably bears more thinking about though. >>> >>> cheers >>> Dan >>> >>> >>> >>> $formatInfoList = [ >>> ["en_US", "{0,number,integer} monkeys on {1,number,integer} trees >>> make {2,number} monkeys per tree"], >>> ["en_US", '{this was made intentionally incorrect}'], //valid type >>> but wrong value >>> ["en_US", new StdClass] //wrong type >>> ] >>> >>> >>> foreach ($formatInfoList as $formatInfo) { >>> list($locale, $pattern) = formatInfo; >>> try { >>> $mf = new MessageFormatter($locale, $pattern); >>> echo $mf->format(array(4560, 123, 4560/123)); >>> } >>> catch(IntlException $ie) { >>> // A strict type-est person would not want this to catch the >>> case where >>> // the wrong type has been passed, as it's not an exception >>> related to Intl >>> // it's an exception related to the type being wrong. >>> } >>> } >>> >> PR for throwing TypeException (independently of strict mode) for zpp >> failures in constructors is here: https://github.com/php/php-src/pull/1215 >> Will apply it if nobody sees a problem with it. >> >> Nikita >>