Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85714 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47861 invoked from network); 3 Apr 2015 18:48:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2015 18:48:39 -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.43 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.43 mail-yh0-f43.google.com Received: from [209.85.213.43] ([209.85.213.43:33866] helo=mail-yh0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/92-23347-680EE155 for ; Fri, 03 Apr 2015 13:48:38 -0500 Received: by yhla23 with SMTP id a23so15118610yhl.1 for ; Fri, 03 Apr 2015 11:48:34 -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=sXa91XEaFRBG/fZRFKJgN0dW2WnacSAMsdmfxZPRDEQ=; b=k2XLMb0B8Fny54OvWDTG0RbHc3JtYNO1TGWcQpBCLtUbIS38i56/eASWKBPiYvT3ud jujrEjm1a8N+dmOlWeNvCm+pJrWuJq+3gh21/dLqrd7J6VgB/Rx23YiqX2WU/ir/aZWK n2pbYYHrB3N5rzPyICRAiC4eliZ95hMfD1XuzBoKqlPUv1m/wnGt08mrpjPbKQSBeAgI 8fP+6MB5JWe0Y49/I/MJlycHRxBNny+PIu438mWSkTQCkcwRrDCK/vWfVQ+Q79X3hGkN PO8gy9SAwbUFPV3EpBekHWSG4EOLYf6NSl6NIH1zXbjDBxyiYdqxGqC94rPfYsqhrSXR uQaw== X-Gm-Message-State: ALoCoQkVkBr7USGdq04vkhb9mAmofOB3JbWXjMXvLtmrV3me5qyWILjyk7D6Av3AF4bJPuH97k/zEoeNmD7GK2wqU48tIlAhehDc26fCnwHq50wMNilpil9B3KuEm6nKVuzgmx01IulnKNxi7hgRfQcVI1/njGemmA== MIME-Version: 1.0 X-Received: by 10.52.78.35 with SMTP id y3mr2082307vdw.5.1428086914838; Fri, 03 Apr 2015 11:48:34 -0700 (PDT) Received: by 10.52.248.36 with HTTP; Fri, 3 Apr 2015 11:48:34 -0700 (PDT) In-Reply-To: References: Date: Fri, 3 Apr 2015 21:48:34 +0300 Message-ID: To: Nikita Popov Cc: Dan Ackroyd , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11340382448be00512d6654e Subject: Re: [PHP-DEV] [RFC][VOTE] Constructor behaviour of internal classes From: dmitry@zend.com (Dmitry Stogov) --001a11340382448be00512d6654e Content-Type: text/plain; charset=UTF-8 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 > --001a11340382448be00512d6654e--