Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95266 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11966 invoked from network); 17 Aug 2016 16:46:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2016 16:46:15 -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:37189] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/7A-45465-5D494B75 for ; Wed, 17 Aug 2016 12:46:14 -0400 Received: by mail-wm0-f49.google.com with SMTP id i5so244028045wmg.0 for ; Wed, 17 Aug 2016 09:46:13 -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=ZXFWYxjwPas64RDP23TXOkmaSQARHj0tu8uAqt2JncQ=; b=HUXHQ/CbnC3GlTrhjhWo/39FM+eAbozb4J5SzQa9F7SzsTq0GlfSOBArGca43bUCyi boa3GXEHMtBb3EfW8KxL8s5C1BSXC/s3Rkz/ba1/gWXm8XmcI0zflizgP0Jw02dEwEqy 73L98wmqrV0k6G/YLkbEfmmdP4M2IzWwEGJSdG87Uqxlfkcpzu9+qWxBuwkS9KqUCag9 BoFGQ+U+Twx83B6DqHi9zfEz5UOtEwAs+LUTCWdSi6HsNpj283/o22etX9eJJOirJNTA 8h02O+dCLdipcM3U+UJ9k4PeW9Vet29oi2f4wh+7QeUK8nCac/2SvEBEctdzYMEWGKnE snug== 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=ZXFWYxjwPas64RDP23TXOkmaSQARHj0tu8uAqt2JncQ=; b=TGAmG9wGqlgo9fUCvlgnstVLO+jsb/gscgiGt3E+2zNZg/dFhHpquGYPouafpLz3U0 quDyTAGFa3fwioBhB8aQTBU1cRYo/o3vj6uMJPJckCvM3fuICVl9hN6udDA20v/Bdpza iPVhvOTQX/lYXLq43NFuybxR1apL/JyLjxPabtMN6ItahzNR6yey5ARkHqJpG7lQ0geN LMN6R0qukQkZbfuJQoA5Q4xccfDYoZFAhnowgG8pZgxEeFXKJRXK2VM2W7c6k0470TW1 LGqtAt3yPeP0YfCfSneDWsdc/2IZlusf7TBP3jnEf07z8SYMlXMKFhdjo37CjvlIPYGX 8y8g== X-Gm-Message-State: AEkoouvmlD/rZAakYwKwoQ2P7/GQMuvqYsX2CqXnK5ZzQqvoYmbnL5nrIv+PDDD8ee1rmwnjgK6B/2dMQQxndw== X-Received: by 10.194.189.229 with SMTP id gl5mr43117848wjc.168.1471452370047; Wed, 17 Aug 2016 09:46:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.125.242 with HTTP; Wed, 17 Aug 2016 09:45:49 -0700 (PDT) In-Reply-To: <15E198DD-FF66-475D-ABBC-54ECD2B6BF62@trowski.com> References: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> <15E198DD-FF66-475D-ABBC-54ECD2B6BF62@trowski.com> Date: Wed, 17 Aug 2016 18:45:49 +0200 Message-ID: To: Aaron Piotrowski Cc: internals Content-Type: multipart/alternative; boundary=047d7bb709d4d22aef053a47332d Subject: Re: [PHP-DEV] ReflectionType::__toString() prepending \ to class names From: ocramius@gmail.com (Marco Pivetta) --047d7bb709d4d22aef053a47332d Content-Type: text/plain; charset=UTF-8 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/ On Wed, Aug 17, 2016 at 6:44 PM, Aaron Piotrowski wrote: > Marco, > > > On Aug 17, 2016, at 11:22 AM, Marco Pivetta ocramius@gmail.com>> wrote: > > > > 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/ > > > > > Adjustments will be necessary in Zend\Code no matter what because of > nullable types. If a type is nullable, ReflectionType::__toString() will > return "?\Type\Name" or without the changes I committed it would return > "?Type\Name". > > If you need the type name without the leading ? or \, use > ReflectionNamedType::getName(). > > It would be nice to have no BC breaks, but right now I'm not seeing a way > of handling nullable types in ReflectionType::__toString() without some > sort of BC break. > > Aaron Piotrowski > > --047d7bb709d4d22aef053a47332d--