Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95268 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15890 invoked from network); 17 Aug 2016 17:02:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2016 17:02:45 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:35447] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/5B-45465-4B894B75 for ; Wed, 17 Aug 2016 13:02:44 -0400 Received: by mail-wm0-f49.google.com with SMTP id f65so206811663wmi.0 for ; Wed, 17 Aug 2016 10:02:44 -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=VSuQa4JOanYoAPhikYKgRJbRg46BvbfNNb1emYuR2do=; b=nW+Ivhn8DJOXOhhVJEVS+HDD2u61k0vchMgaSWn6phJc9wbC65cA9dESk6yDGnl4JX M1IXUjO/w+ZB1CC3xyaphad5fg1G/DocAHVm+Hm2Rb5YdSpuuTsirXWPO5Doh1y0gP0V +293Kj+b3cFXUIKMHSYWzd11ccbd8gqtxqKbLe2BbL+ynB9VkjjTqFSubrbNdSRKhj13 S6hPiKE7CR+9pzWoHDiGfWCQXfYWmBHTTmweNX0zbCKMnux1u4EfSu/DIuEm+fHgCPEE XzkHNLO9sApSh1BvDsIhUuNKD9Oz26JAjKco/B6oyXjj5NwRtXR/QGs8pLgB9JUlEVIG nibA== 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=VSuQa4JOanYoAPhikYKgRJbRg46BvbfNNb1emYuR2do=; b=aUQrP6OWWmOpPrIL+7MlI7H6Tq6hIA+zn5xBnYdzIhsKubjsh/K5gokkMjF8rtNCHC xkiSbdwFJL8+e2YAiugneIuN/Vxlr2ZzbuVjsT5m9I3NJkuqoIXJbUqo7EPGh6l7rEan wKo1HzbGPce8PJZOZWLF/ICpBv2AQ0krLU47qgqj6GX4oRiCyCGctEHnrbiyi+JwLqpE 23P1JrucWnlYSZlGDwYJwS6lc8DwN57QnUtMCPHqiZ+4jPb4lx0fy/dMZeobw//cCaWk xSvmnIk3EYe+/yi7oU5hMPl+7Hvu52lKixCGHA+0uYsv7BSyPYnXYVNQ/2oxbeStdLbI srBw== X-Gm-Message-State: AEkooutXoM+Ux3EoJIF/70fFSBRpzQAui12BsOH4znhGMjn/Mm649cQna+9TdxQHz+uV6UsyEhWt1MgyvTqneg== X-Received: by 10.194.190.232 with SMTP id gt8mr44354776wjc.141.1471453361388; Wed, 17 Aug 2016 10:02:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.125.242 with HTTP; Wed, 17 Aug 2016 10:02:20 -0700 (PDT) In-Reply-To: References: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> <15E198DD-FF66-475D-ABBC-54ECD2B6BF62@trowski.com> Date: Wed, 17 Aug 2016 19:02:20 +0200 Message-ID: To: Aaron Piotrowski Cc: internals Content-Type: multipart/alternative; boundary=047d7b87465ee8c3d7053a476ec4 Subject: Re: [PHP-DEV] ReflectionType::__toString() prepending \ to class names From: ocramius@gmail.com (Marco Pivetta) --047d7b87465ee8c3d7053a476ec4 Content-Type: text/plain; charset=UTF-8 On Wed, Aug 17, 2016 at 6:55 PM, Aaron Piotrowski wrote: > > > On Aug 17, 2016, at 11:45 AM, Marco Pivetta wrote: > > > > Since scalar types are invalid anyway if prepended with `\`, I see no > point > > in producing a string with the `\` in it. > > > > The current consumers of `Type` assume no `\` is prepended, and we spent > an > > age and a half dealing with `\` being in front of class names in doctrine > > (and finally got rid of it). > > > > This is not being really helpful, as it is. > > > > Marco Pivetta > > > > http://twitter.com/Ocramius > > > > http://ocramius.github.com/ > > > > Scalar types do not have a \ prepended. Only class, interface, and trait > names. > Aware. > Can you show me some of the code in Doctrine that handles this? This issue > came up because of Doctrine prepending a \ in front of nullable class names > [1], resulting in `\?Type`, which of course is invalid. > This is something to be fixed by introducing support for PHP 7.1 from our (doctrine/zendframework) side, not from PHP's side by changing existing behavior (very very very messy). Doctrine does not yet deal with 7.1, although work started on it, and I'll likely complete it once we get at last RC phases of 7.1: https://github.com/doctrine/common/pull/734/files > Unfortunately I think no matter what is done, nullable types just created > another headache for you. :-( > That would have been a headache anyway. We saw it coming, and it will be fixed on our end, but please don't try to outsmart it. I know that there is good intention on your side, but this is really going to just make it an issue. From the codegen-side (I do write a lot of code generators), having `\` prepended in front of stuff makes things just more complex to deal with, since I have to strip it and re-introduce it anyway in multiple locations in the code, while it should just be attached in the final output-logic bit. Instead, please keep the reflector on-spot: reflecting things, telling us what they are. What the code generator does with the definitions is up to the code generator after that. We have to adjust the code for `void` and `?` anyway, so this is just more changes to keep track of, and it would break existing code. P.S.: a lot of confusion between direct/mailing-list responses. Sorry if this comes through as a new thread, that's not intentional. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --047d7b87465ee8c3d7053a476ec4--