Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95269 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17707 invoked from network); 17 Aug 2016 17:17:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2016 17:17:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=aaron@trowski.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=aaron@trowski.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain trowski.com designates 199.38.81.6 as permitted sender) X-PHP-List-Original-Sender: aaron@trowski.com X-Host-Fingerprint: 199.38.81.6 mercury.negativeion.net Received: from [199.38.81.6] ([199.38.81.6:54141] helo=mercury.negativeion.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/BB-45465-C2C94B75 for ; Wed, 17 Aug 2016 13:17:32 -0400 Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id 133343E8C975; Wed, 17 Aug 2016 13:17:29 -0400 (EDT) X-Virus-Scanned: amavisd-new at negativeion.net Received: from mercury.negativeion.net ([127.0.0.1]) by localhost (mercury.negativeion.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j3s40cIFQdrr; Wed, 17 Aug 2016 13:17:28 -0400 (EDT) Received: from [10.0.1.3] (unknown [192.119.134.23]) by mercury.negativeion.net (Postfix) with ESMTPSA id AC8DA3E8C966; Wed, 17 Aug 2016 13:17:28 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) In-Reply-To: Date: Wed, 17 Aug 2016 12:17:28 -0500 Cc: internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> <15E198DD-FF66-475D-ABBC-54ECD2B6BF62@trowski.com> To: Marco Pivetta X-Mailer: Apple Mail (2.3124) Subject: Re: [PHP-DEV] ReflectionType::__toString() prepending \ to class names From: aaron@trowski.com (Aaron Piotrowski) > On Aug 17, 2016, at 12:02 PM, Marco Pivetta = wrote: >=20 > 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. Looks like this problem is more complicated than I thought. I thought = prepending the \ would mean little work on your end, but it appears I = was wrong. I'm still confused as to what's going on and what the best solution = is... Currently Doctrine is manually prepending \ to class names. = Obviously your logic would have to change between 7.0 and 7.1, but then = going forward you could rely on ReflectionType::__toString() to return a = syntax-valid type name, rather than modifying it. Or perhaps rather than = relying on casting to a string and examining the string, Doctrine should = be using ReflectionNamedType::getName() and ReflectionType::allowsNull() = for 7.1 and beyond. (Just a suggestion, I'd have to dig into the code to = really understand what's going on, and I don't have a ton of time to do = so at the moment.) > =46rom 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. >=20 > 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. It sounds like you'd prefer the ? was not prepended to the string as = well, is that correct? Again it sounds like it would be better to use = methods other than __toString(). I understand __toString() was the only = way to get the type name before, but now that this has been fixed = perhaps it should be avoided in your use-cases. Aaron Piotrowski=