Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85629 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72230 invoked from network); 1 Apr 2015 08:14:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2015 08:14:59 -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.51 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.51 mail-yh0-f51.google.com Received: from [209.85.213.51] ([209.85.213.51:35675] helo=mail-yh0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/91-56894-209AB155 for ; Wed, 01 Apr 2015 03:14:59 -0500 Received: by yhfw71 with SMTP id w71so10488802yhf.2 for ; Wed, 01 Apr 2015 01:14:56 -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=x1ZNIoswSaxXB4oW9QrtU3NbXeybZofmADzUrKMmIwg=; b=YRDvL5l5AYmgas3FJIrXQlP5xDsADy5uhtNXB/XHnU2cQbkdDvaqxIf+CAP7DJMifR mxuhs7tVsjI/gZk2Z01eE5xibpO7svlMdQYRnl7woK3FqYZ1rbkyoIgwH+L29x1CwtIe ziWNhNrcQ6dXjUdg+hU0BMVc3KeNmyKoqv98iW3QDuhOAxJ4fvh/1G82ANDceeriT7wT Ap/H3zWySXl8CpNtor+QGQVcUYnA1l9WQRGKgy+JzWbcbXmfbpLmZV6DFy4HMcDkeiw7 A/Pe32pYwbUpbxT3M6MaaVu1hwqUAQG4TFLyA8gi5+Hw4ShCote60TvQRsdXO5ZtAvdx u3TQ== X-Gm-Message-State: ALoCoQlnjtHJab9XsN2aDQRRMSNtqEBpW1pMz+i4+mnDeJawAA5lpdHLeEqKvYWoHnN6TGxQzMtHUjUMHyO4LyJwl92YPtEmQRi6I4yV7bEvb3nbW6hv/dKB+AfQLUhY/bOR6o5X1UIOcslsu1A8EDRhJ7NM0d4rlw== MIME-Version: 1.0 X-Received: by 10.52.165.65 with SMTP id yw1mr41229155vdb.51.1427876095727; Wed, 01 Apr 2015 01:14:55 -0700 (PDT) Received: by 10.52.248.36 with HTTP; Wed, 1 Apr 2015 01:14:55 -0700 (PDT) In-Reply-To: References: Date: Wed, 1 Apr 2015 11:14:55 +0300 Message-ID: To: Dan Ackroyd Cc: Nikita Popov , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c29cc07836540512a54f94 Subject: Re: [PHP-DEV] [RFC][VOTE] Constructor behaviour of internal classes From: dmitry@zend.com (Dmitry Stogov) --001a11c29cc07836540512a54f94 Content-Type: text/plain; charset=UTF-8 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. > } > } > --001a11c29cc07836540512a54f94--