Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6844 invoked from network); 13 Nov 2014 12:13:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Nov 2014 12:13:08 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:39412] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/81-29190-350A4645 for ; Thu, 13 Nov 2014 07:13:07 -0500 Received: by mail-wi0-f176.google.com with SMTP id ex7so755742wid.9 for ; Thu, 13 Nov 2014 04:13:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=7p0OhBIQSqgf2KEFbDEu9HwlQrPORIFwmW4uR9cOCO0=; b=CJ5CwM6Ojf5kCUCQsmnPA3Fyfph2KAZyESo94/XhlnWd8nmkuT2Zryj9rh+kpaRvql oMt7S+ICdU/b9u39AoXLDnUFKEEt68t5sX+Ec4kXFqVqyMRZyoe+jWC7Vl5qheAzHN0Z /5exGmFwdw6T5xwbT9ntDCvIhDmi2QFGRS2KLwV6RRVpp71TV8Q8p0IHXS6/W5nDCOqj XHVTgNmgoMo2JO0bgcxKCgZy10w0Ji8sXNTVau3qxpSsAAQOyOkV1EmUN5M46+5jLgwc 0HvlfV7iCC7uzxmypIn6llR4aNW/p42S9fmmH68GrVu2qrW9T3tsanIRUwyFkuaLTlKO AVsA== MIME-Version: 1.0 X-Received: by 10.194.58.8 with SMTP id m8mr3405056wjq.43.1415880783515; Thu, 13 Nov 2014 04:13:03 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.180.8.36 with HTTP; Thu, 13 Nov 2014 04:13:03 -0800 (PST) In-Reply-To: <1415878147.11005.1.camel@kuechenschabe> References: <000201cff3b2$37615e50$a6241af0$@tutteli.ch> <001101cffda8$9f56e980$de04bc80$@tutteli.ch> <001a01cffebf$76f5c2a0$64e147e0$@tutteli.ch> <1415878147.11005.1.camel@kuechenschabe> Date: Thu, 13 Nov 2014 12:13:03 +0000 X-Google-Sender-Auth: 39ZN4HS2LLZe74RH-GEtqkvzrIU Message-ID: To: =?UTF-8?Q?Johannes_Schl=C3=BCter?= Cc: Robert Stoll , Adam Harvey , PHP Internals Content-Type: multipart/alternative; boundary=047d7ba976322557370507bc6f02 Subject: Re: AW: [PHP-DEV] forbid use declaration outside of a namespace in PHP 7 From: cw@daverandom.com (Chris Wright) --047d7ba976322557370507bc6f02 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 13 November 2014 11:29, Johannes Schl=C3=BCter = wrote: > On Wed, 2014-11-12 at 22:27 +0100, Robert Stoll wrote: > > > 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. > > I am talking about the two following scenarios: > > > > use \Exception; > > namespace test; > > > > $e =3D new Exception(); //would fails because test\Exception is unknown= -> > use was defined outside the namespace > > > > > > Or > > namespace a{ > > } > > > > use some\UseDeclaration\which\is\outside\of\AnyNamespace as Useless; /= / > sorry for begin biased ^^ > > > > namespace test{ > > } > > If I get it rigth this might break code by people who, for whatever > reason, combine multiple PHP files into a single one. (cat *.php > > full.php && php full.php) > > This would only break if the individual files were already invalid. Files with namespace Name; style ns declarations couldn't be joined together in this way anyway, and files using namespace Name { ... } style declarations with use imports outside the block would be invalid on their own, concatenating them wouldn't break (or fix) this situation. Unless I missed something? I must say actually that while I think a use declaration outside a block-style namespace should be invalid, I'm about 50/50 on whether something like this should be invalid: > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7ba976322557370507bc6f02--