Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95264 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8387 invoked from network); 17 Aug 2016 16:23:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2016 16:23:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:37817] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/C9-45465-D6F84B75 for ; Wed, 17 Aug 2016 12:23:09 -0400 Received: by mail-wm0-f47.google.com with SMTP id i5so242814659wmg.0 for ; Wed, 17 Aug 2016 09:23:09 -0700 (PDT) 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; bh=QiSTyj6id01HYC9BUUVyHcgZyHn4hqI5pX/O+K6bB4o=; b=bBl7Cda6Nv3X2OOHypR0F1TIjnEUCd/qU97kgFmB54DpWaWJ8uJBepOFTeZnwgHUKi LXzYyIjt1j7e6wHYQjVVhzycMgWMJbPaLlBoQRIjuE0+ef0CWlCsYuB+C42nbOHtBPVl HciF4+o8KXgN9Jam0JHughomkUmb8AzJsvOnPQzIOORfl4bkdNGaXAaChZaH33fvGA0p mmocWsMkbyUm9saFpKxoeM02C4QdkDgSQKpRexnd9uf+PCCH9ASTYR/jtzI60KmHUUqn xJbJ88UH6tWYgmuVWU9YOlptrF/wZQ2H62xKxrqPoDov17eOHO2Ir7AAXAFl5P5l4R2S djnw== 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:from:date :message-id:subject:to:cc; bh=QiSTyj6id01HYC9BUUVyHcgZyHn4hqI5pX/O+K6bB4o=; b=CEpbRZ8QKq9qISDMzdqeeNSvvVnS93mJJ4H1Ur+mE+TmQ5KFReEnV2JhzXmj18Nlxx BvA31ObJWz4KWKLJErPTtlyL0AeGFnWqeXRiSOHEPajjmPu6j8nfxivo4YRey8XVgURT Jjlt9vT4xJiW26YTlwm/rPssu+y6to4zDsAaWJBADQc/moR4/PQVvb8sbn9jjFv8WJyF MdfnI1SQzp/uNG/VokbMlfDZna5E9LTANy2TRvR66eXLMZ8s9mHERFi3XlFZhtW2lFNN TQolb2bvs71bFgzdz12B6SF4uKTgBjklqU212A1IeksqNUGyyjt6fgHMgcby64HcxVuR 7mFQ== X-Gm-Message-State: AEkooutAEpqQJAgZVhlCcT8VXiFAc3SC3Uf6oXDx2cikY+xQ1GP8hPyYYy5zn5+TMC98tPxWjGAHGFUmvUiHmQ== X-Received: by 10.28.27.211 with SMTP id b202mr28869742wmb.12.1471450986031; Wed, 17 Aug 2016 09:23:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.125.242 with HTTP; Wed, 17 Aug 2016 09:22:45 -0700 (PDT) In-Reply-To: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> References: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> Date: Wed, 17 Aug 2016 18:22:45 +0200 Message-ID: To: Aaron Piotrowski Cc: internals Content-Type: multipart/alternative; boundary=001a114b3ab853bf84053a46e162 Subject: Re: [PHP-DEV] ReflectionType::__toString() prepending \ to class names From: ocramius@gmail.com (Marco Pivetta) --001a114b3ab853bf84053a46e162 Content-Type: text/plain; charset=UTF-8 Sorry, I have to object here: this is quite a BC break for Zend\Code, specifically. We will have to re-adjust the code generators to adapt to the newly introduced prepended `\`. In addition to that, there is no need for `\` to be prepended to a type string, since inside string scope, we are always dealing with the base namespace. Seems unnecessary and causes a lot of headaches, instead of actually simplifying things. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Wed, Aug 17, 2016 at 6:18 PM, Aaron Piotrowski wrote: > Hi all, > > I recently made some changes [1] to ReflectionType::__toString() that > prepends a leading \ to class names. These changes follow from the > discussion on ReflectionType improvements [2, 3] and the discussion on my > PR to implement some of the RFC [4]. > > A \ should be prepended to class names returned from > ReflectionType::__toString() so the output of this method can be used when > generating code within a namespace. Currently, several libs such as > Doctrine manually prepend a \ when generating code. Nullable types will > complicate this, since a ? is prepended to the type name, requiring a \ to > instead be inserted as the second character. The changes I made will > alleviate the need for libs to manipulate the string returned from > ReflectionType::__toString() when generating code. This will become more > important if more complex types are introduced, such as callable prototypes. > > If anyone has objections to these changes, please let me know. > > Thanks! > > Aaron Piotrowski > > [1] http://git.php.net/?p=php-src.git;a=commitdiff;h= > 20fdd47921f423728b409fd0ae0106dab9c34573 > [2] http://news.php.net/php.internals/94452 > [3] https://wiki.php.net/rfc/reflectiontypeimprovements > [4] https://github.com/php/php-src/pull/2068#issuecomment-240071841 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a114b3ab853bf84053a46e162--