Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12589 invoked from network); 13 Nov 2014 12:57:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Nov 2014 12:57:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wg0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:38045] helo=mail-wg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/92-29190-B9AA4645 for ; Thu, 13 Nov 2014 07:56:59 -0500 Received: by mail-wg0-f53.google.com with SMTP id b13so16801143wgh.26 for ; Thu, 13 Nov 2014 04:56:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=/KG70w7cwpJDGcYOhdq/jcJ2xdGUOH9qWMF4faBH4fI=; b=yFuQh0vbKjQPudWtt/z3DHbePYXwcTmzF/O2BjgTAPHGpWKWZ3AdpRc0ZLqeO7tDQu 7/CQkkpfD1C2NoZEtLpvIDBLssJrOQL0v3apRYIpkNFIwB5LiKAOP2OMiiZT+3lVdPy1 IVgC2JbVVGb7fsdLV3TictR/P981uHMgIKHMqTAZtEA8Z/qTqtnn/5RMRCyQ/Y5n4m7D SOXO4j61adqAiCbvT6OmBFZcwd9dUydQp2P4NW4cXJ3fO3Hf1l3YHPL8a7MvGLkSytGJ D69XPLuzhM2qB0AQGbphCSQoLRnSpysYTMfvS1UF1I9Ji9S/S5LF16u/PKIa2tS1SARP nBcw== X-Received: by 10.194.52.68 with SMTP id r4mr3853734wjo.82.1415883415197; Thu, 13 Nov 2014 04:56:55 -0800 (PST) Received: from [192.168.0.148] ([62.189.198.114]) by mx.google.com with ESMTPSA id dm10sm17939841wib.18.2014.11.13.04.56.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Nov 2014 04:56:54 -0800 (PST) Message-ID: <5464AA71.1030208@gmail.com> Date: Thu, 13 Nov 2014 12:56:17 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <000201cff3b2$37615e50$a6241af0$@tutteli.ch> <001101cffda8$9f56e980$de04bc80$@tutteli.ch> <001a01cffebf$76f5c2a0$64e147e0$@tutteli.ch> <54648E94.5060802@gmail.com> <001b01cfff3d$a8fc7900$faf56b00$@tutteli.ch> In-Reply-To: <001b01cfff3d$a8fc7900$faf56b00$@tutteli.ch> Content-Type: multipart/alternative; boundary="------------040001030503040907060305" Subject: Re: AW: AW: [PHP-DEV] forbid use declaration outside of a namespace in PHP 7 From: rowan.collins@gmail.com (Rowan Collins) --------------040001030503040907060305 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Robert Stoll wrote on 13/11/2014 12:30: >> -----Ursprüngliche Nachricht----- >> >Von: Rowan Collins [mailto:rowan.collins@gmail.com] >> >Gesendet: Donnerstag, 13. November 2014 11:57 >> >An:internals@lists.php.net >> >Betreff: Re: AW: [PHP-DEV] forbid use declaration outside of a namespace in PHP 7 >> > >> >Robert Stoll wrote on 12/11/2014 21:27: >> > >>> > >That's still perfectly fine because in your code the use statement is not outside of a namespace, it is implicitly in the >> >default namespace. >> > >> >Surely if that's true of Adam's example, it's true of yours as well? > [Robert Stoll] > The difference is that I have specified a namespace and thus code outside of that namespace is no longer implicitly in the default namespace. > Ah, OK, on further experimenting, and closer reading of the documentation, I see that you are right. For anyone else wondering, the key quotes from the manual are: - "A file containing a namespace must declare the namespace at the top of the file before any other code - with one exception: the declare keyword." - "No PHP code may exist outside of the namespace brackets except for an opening declare statement." So as soon as the keyword "namespace" appears somewhere in the file, there is no longer any implicit global non-namespaced code. As such, it seems to me that allowing a "use" statement is simply a bug - no other code is allowed in that position, and the only documented exception to that rule is declare(). Regards, -- Rowan Collins [IMSoP] --------------040001030503040907060305--