Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85168 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73615 invoked from network); 18 Mar 2015 07:46:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2015 07:46:34 -0000 Authentication-Results: pb1.pair.com header.from=davidkmuir@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=davidkmuir@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.177 as permitted sender) X-PHP-List-Original-Sender: davidkmuir@gmail.com X-Host-Fingerprint: 209.85.192.177 mail-pd0-f177.google.com Received: from [209.85.192.177] ([209.85.192.177:34297] helo=mail-pd0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/60-04215-85D29055 for ; Wed, 18 Mar 2015 02:46:33 -0500 Received: by pdbni2 with SMTP id ni2so35395771pdb.1 for ; Wed, 18 Mar 2015 00:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=Pctys0z1WQE7nUj1jV0mJZi9p7YUxwaTqU4xl4PB4Yw=; b=UiZr/dmS05BpnQ9rc6686HRgLF73pNV7M9CEzmjeUKt4APLo65azGDkHD9LdKEZVM/ a5PYuWs27rgZW2sL1z4LV/4NyueMoYxYoz+eZA20al5g76g0vvSey6Ia9YFqGNcB1/1F L56J9wlTsxKR6C3bQGFAFZSgj38qVfa1uH1cWsVzojEm9uPqm0T/SdXlOnU8WHWNGGH+ Gwb+0oMrFJF3XTdTRfTVXS9DcKZZ1aoVOyzihGxDD70IUcdTtclxRN87ksV2R2kUrq0l cCXGgRMglimmqpjugsS0dlpJOVLuF+DtGZl9UMyegDVQBjmDO+XQbo/lJvrwxdVro9cT Fg0A== X-Received: by 10.70.88.172 with SMTP id bh12mr140635306pdb.52.1426664790113; Wed, 18 Mar 2015 00:46:30 -0700 (PDT) Received: from [10.128.243.236] (pa49-199-3-207.pa.vic.optusnet.com.au. [49.199.3.207]) by mx.google.com with ESMTPSA id v5sm6434673pdc.41.2015.03.18.00.46.28 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 00:46:29 -0700 (PDT) References: <55079692.6050405@gmail.com> <5507E7DD.3010908@lsces.co.uk> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-ID: <2518BE21-5B44-4BAA-80E7-F358AF575C5A@gmail.com> Cc: Pierre Joye , PHP internals , Leigh , =?utf-8?Q?Andr=C3=A9_R=C3=B8mcke?= , Lester Caine X-Mailer: iPhone Mail (11D257) Date: Wed, 18 Mar 2015 18:46:22 +1100 To: Yasuo Ohgaki Subject: Re: [PHP-DEV] [RFC][Accepted] Scalar Type Declarations V0.5 From: davidkmuir@gmail.com (David Muir) > On 18 Mar 2015, at 3:44 pm, Yasuo Ohgaki wrote: >=20 > Hi Pierre, >=20 >> On Wed, Mar 18, 2015 at 1:35 PM, Pierre Joye wrote= : >>=20 >>> On Mar 18, 2015 11:26 AM, "Yasuo Ohgaki" wrote: >>>=20 >>> I didn't have my time to spent for the patch. So I don't verify this >>> by myself, but it seems common sense for this RFC. >>=20 >> So you voted against it without knowing how it actually works or aims to >> work? I suggest you to do it now then, before going further with this >> discussion :) > I know we are better to play with patch before vote. > I played with Zeev's patch and I was sure it's better ;) >=20 > How many of voters spend enough time for both patches before vote? >=20 > The reason I admit that I didn't spent time to play with the patch is > following behavior does not make sense to me much and I have > doubt for it. >=20 > lib.php: > declare(strict_types =3D 1); > function foo(int $a) { > // no function call here > } > ?> > The declare here does just nothing. Correct. There are no function calls in the file, so there's nothing for dec= lare strict to act on. >=20 > require "lib.php"; > foo("123"); // will work > ?> >=20 > declare(strict_types =3D 1); > require "lib.php"; > foo("123"); // will give an error > ?> >=20 > Could someone knowledgeable shed light on this? >=20 > Regards, >=20 > -- > Yasuo Ohgaki > yohgaki@ohgaki.net Shed light on what exactly? Why it behaves this way? The second file passes because it is in the default weak mode, so it will co= erce to an int, so the type hint is satisfied. The third file will error because you have asked it to error when you pass t= he wrong scalar type to a function. David=