Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85632 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83636 invoked from network); 1 Apr 2015 09:12:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2015 09:12:51 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.44 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.44 mail-yh0-f44.google.com Received: from [209.85.213.44] ([209.85.213.44:33962] helo=mail-yh0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/A0-12231-296BB155 for ; Wed, 01 Apr 2015 04:12:51 -0500 Received: by yhch68 with SMTP id h68so10776329yhc.1 for ; Wed, 01 Apr 2015 02:12:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=MZkd2HMuTn8Qm4pUS9DG1c7ETt2JP7/3mk+AbhD2zBM=; b=XQz6FCnWhJDldsiGfr5V/vtuaSUH/2c/eSRkO4pn2/7md4DQCjTf2Dh2edOS3leLvc 9g+mr7AI5JuwU+LUlwWW3bmNhPQquRH5nOIPDXHfamLZ6I1VlQRbBEA3v7qjCP50OPq/ Rk+vRqHDDCJ+HwPL913/wNBp0dzK5d6c6+9N9yAtKOnQwf+3gk7LjAq8zvkmAUUi12p7 JwM4wyeFfm3tgZucH005WrhCEqPJjLH/7o+X/MLJbeOhPLlsKttrBPTq4x4Cm8nzP2BK Yxk9v1c3gwxeJ1iPeOuVAoWZa40AIUTcB6bpKeBX5Hdg6HE/tgm2UzeJqR6uJmSf6Zwy CcOg== X-Gm-Message-State: ALoCoQk3L4vIKpP8D3mVUQlGOTxoB5fqccqv+aIkIc0gl1rVx4U1ZvfBl7tV/OXJnMYh1F6HreC11F7vV/DyO+qtIYbXorICV3QK13Q2CBsjmw/DBRmpnCwmu9YjwtkevenAAY7XmM070IQm7SBvwVoPfXi1AE+tPg== MIME-Version: 1.0 X-Received: by 10.52.61.137 with SMTP id p9mr41675561vdr.68.1427879566115; Wed, 01 Apr 2015 02:12:46 -0700 (PDT) Received: by 10.52.248.36 with HTTP; Wed, 1 Apr 2015 02:12:46 -0700 (PDT) In-Reply-To: References: Date: Wed, 1 Apr 2015 12:12:46 +0300 Message-ID: To: Dan Ackroyd Cc: Nikita Popov , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1136b57452ae2f0512a61e46 Subject: Re: [PHP-DEV] [RFC][VOTE] Constructor behaviour of internal classes From: dmitry@zend.com (Dmitry Stogov) --001a1136b57452ae2f0512a61e46 Content-Type: text/plain; charset=UTF-8 committed into master. Dan, please update the RFC accordingly. Thanks. Dmitry. On Wed, Apr 1, 2015 at 11:14 AM, Dmitry Stogov wrote: > > > On Wed, Apr 1, 2015 at 4:31 AM, Dan Ackroyd > wrote: > >> Hi Dmitry, >> >> Your approach is definitely a better one, and I have no objection to >> it whatsoever. >> > > Your patch was quite good. You just didn't know what this NULL return > required a hack in the PHP core :) > > >> >> Sorry, I was too busy to look deeply at each class but I can't see any >> problems. >> > > Great. > > Nikita, do you like me to commit this PR or will you take care about it? > > Thanks. Dmitry. > > >> >> 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. >> } >> } >> > > --001a1136b57452ae2f0512a61e46--