Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60104 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71607 invoked from network); 17 Apr 2012 19:41:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 19:41:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:48770] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/04-03996-057CD8F4 for ; Tue, 17 Apr 2012 15:41:05 -0400 Received: by lbbgf7 with SMTP id gf7so5179936lbb.29 for ; Tue, 17 Apr 2012 12:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=1lV2Vu9ntB1fcrJG9dcmd3nq+NIcIk3RYZEDuGJ0Pyk=; b=J5J9goqld2sAjfFF+ij9tlD7YiOYOOXppKpxazwJXUwUOw2oZkn9Z6pRUKYhb9Ar1D Q3BfEmpXGfuwSks1HnjQQ4My/L3JF3vEKuDkk62ubo+4Q5EgdAJznjtNVHQoFt2grXpa 05d1yUqHapS2SukWM5x4FUka8O2JXtV5NpyKC+IZFAdg3udGa+dtAkWyPcqeChnMPNaj DDKJQ4Y5GDMwgCwHuHrfyFkD1ONWGbGJul72zftYpB1e9IRss2Oip/4ZrfNUckWw34N9 eR/as1x98doS72tGykPQOKePDtj+Nfu0ANRK1Byudmcz0BfNRwcEOsstxUtiscEHB65g b5Dw== MIME-Version: 1.0 Received: by 10.152.103.134 with SMTP id fw6mr15278050lab.20.1334691661518; Tue, 17 Apr 2012 12:41:01 -0700 (PDT) Received: by 10.152.127.68 with HTTP; Tue, 17 Apr 2012 12:41:01 -0700 (PDT) In-Reply-To: References: <4F89D4F1.8070009@ralphschindler.com> Date: Tue, 17 Apr 2012 21:41:01 +0200 Message-ID: To: Galen Wright-Watson Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] New Feature: Fully qualified class name resolution as scalar with class keyword From: nikita.ppv@googlemail.com (Nikita Popov) On Tue, Apr 17, 2012 at 9:36 PM, Galen Wright-Watson w= rote: >Would it be easy to have a patch that simply allows use of the class name, > or is the "::class" suffix necessary to resolve some ambiguity? Example > usage: > > =A0 =A0$mock =3D $this->getMock(A\Namespaced\**ClassName); > =A0 =A0# or > =A0 =A0use A\Namespaced\ClassName; > =A0 =A0$mock =3D $this->getMock(ClassName); > > Would changing the definition for class_name_scalar be sufficient? > > =A0 =A0class_name_scalar: > =A0 =A0 =A0 =A0class_name { zend_resolve_class_name(&$1, ZEND_FETCH_CLASS= _GLOBAL, > 1 TSRMLS_CC); $$ =3D $1; =A0} > =A0 =A0; > > To my eye, this is the least surprising syntax. In your above example ClassName could just as well be a constant :) Nikita