Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83781 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39395 invoked from network); 25 Feb 2015 12:58:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 12:58:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.178 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.178 mail-vc0-f178.google.com Received: from [209.85.220.178] ([209.85.220.178:55755] helo=mail-vc0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/FF-62407-407CDE45 for ; Wed, 25 Feb 2015 07:58:45 -0500 Received: by mail-vc0-f178.google.com with SMTP id hq11so1229469vcb.9 for ; Wed, 25 Feb 2015 04:58:42 -0800 (PST) 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=1Gq0UE1bz7ttmPS1ANtjZ/Hm6rqWXh+cC2TvfXDQHjQ=; b=K37B2FDLLtGTml89HeSIJyyCBLXHYaLBtuTnAg3UTgQJeBqMUZwX4wmByZlSmzi4kI WXFE2+ZDZt3IR7yUCahkJW4pSBpuyidpjj6rqaTfhIj8J4nuXNyMmPKO2epcx6OrF00e plNsiuAToOxQikGzJJo09oeNx/hcr960aym2lW4IuOw8c5mGUgj5TYv8g5LZ2PYU/H3f 2+MjkR+SZi3b752MuO2uVf1OfjnsjHvxamXL4X8BVyKuLZpjPvMk1RGfo3ysumqfvKcR DDxEIBDrI6h7Scah34rQUb+p0FZfx04t/4CJhRjq3ck7PeQ582H9VLUXlz48UuBgxvg2 yVRQ== X-Gm-Message-State: ALoCoQkLDFRqzJFooEGej75QOwCuxHmWaSZMBtAE8mNkDI3SFhyOTgqsdsNBb1f3a5KK4bW9FzdYIOBGE5NEmKteZaxMKrR6ochZnIVqpAj92hF5PNiwoHYEyHeKUNqdvZuQ3KnS1q2LAbTC/M6c/ueAGK7w+1zDbQ== MIME-Version: 1.0 X-Received: by 10.52.51.198 with SMTP id m6mr3881371vdo.38.1424869121936; Wed, 25 Feb 2015 04:58:41 -0800 (PST) Received: by 10.52.113.231 with HTTP; Wed, 25 Feb 2015 04:58:41 -0800 (PST) In-Reply-To: References: Date: Wed, 25 Feb 2015 16:58:41 +0400 Message-ID: To: Shashank Kumar Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1136a0eadd65c8050fe93193 Subject: Re: [PHP-DEV] Re: [RFC-Discuss] Scalar Type Declarations v0.5 From: dmitry@zend.com (Dmitry Stogov) --001a1136a0eadd65c8050fe93193 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 25, 2015 at 3:54 PM, Shashank Kumar wrote: > 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? > I think you should check it in the top line of the file where the function was called from. Thanks. Dmitry. > > Thanks > Shashank > --001a1136a0eadd65c8050fe93193--