Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83779 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36354 invoked from network); 25 Feb 2015 12:54:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 12:54:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=shashankkumar.me@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=shashankkumar.me@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.182 as permitted sender) X-PHP-List-Original-Sender: shashankkumar.me@gmail.com X-Host-Fingerprint: 209.85.220.182 mail-vc0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:52124] helo=mail-vc0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/4F-62407-616CDE45 for ; Wed, 25 Feb 2015 07:54:47 -0500 Received: by mail-vc0-f182.google.com with SMTP id id10so1209580vcb.13 for ; Wed, 25 Feb 2015 04:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=xq+dJ70buCH7U1XyQ3teL3FQsRL2I91cdSQInrpNcYA=; b=kSF15sHvn7GB5xgaSSw2xq/G/oOvkcrsiLBtUMrFuq8iwLMrcq/Jum5tNc+32T19F3 y0KHR1b8z1oYPFf2O3jqGmd0cho9B5q4RcID+jET1IMo8L5C6hSdMJZIsmK2AjJajcrs Zf8DjP7y6OuHimqdy9b8/wjQvsy8K1Ruc+7PEjj0MQVLUm10BAkyYBkKFdGJPRLXMBTH 9isUpOgtkOEQCtqWvqSU4kpChnyHHr7w11CbdtKK653V9wuPlVgZRPlpzvLPT/dwKnHD e31A6PTwskhwosB0cjm9QcRopD3QjfK2SqhoBrYYOhhhUrlL+pWqDwPZPMZ3s4HXSyrA 9qaA== X-Received: by 10.52.66.205 with SMTP id h13mr3876632vdt.16.1424868881900; Wed, 25 Feb 2015 04:54:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.23.52 with HTTP; Wed, 25 Feb 2015 04:54:20 -0800 (PST) In-Reply-To: References: Date: Wed, 25 Feb 2015 04:54:20 -0800 Message-ID: To: Dmitry Stogov Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf307d04dc8ead7d050fe923d1 Subject: Re: [PHP-DEV] Re: [RFC-Discuss] Scalar Type Declarations v0.5 From: shashankkumar.me@gmail.com (Shashank Kumar) --20cf307d04dc8ead7d050fe923d1 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 25, 2015 at 4:30 AM, Dmitry Stogov wrote: > anyone may tell, what this will print without running :) > > main.php > ======== > declare(strict_types=1) > include "a.php"; > include "b.php"; > var_dump(foo("5")); > ?> > > a.php > ===== > declare(strict_types=0) > function foo(string $a): string { > bar($a); > return $a; > } > ?> > > b.php > ===== > declare(strict_types=1) > function bar(int &$a) { > var_dump($a); > } > ?> > > Thank. Dmitry. > > As I understand the proposal and above example, it's possible to change the 'strict_type' settings per file. So, for an enterprise application being developed over many years, it's a very realistic scenario that this setting will be different in different files especially if coding conventions are not followed (happens very often). Does that mean when reading or writing code, in addition to checking the signature of a function, I have to check the 'strict_types' setting at the top as well, to understand how that signature behaves? Thanks Shashank --20cf307d04dc8ead7d050fe923d1--