Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95263 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6879 invoked from network); 17 Aug 2016 16:18:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2016 16:18:21 -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:53841] helo=mercury.negativeion.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/79-45465-B4E84B75 for ; Wed, 17 Aug 2016 12:18:19 -0400 Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id 59D213E8BC42 for ; Wed, 17 Aug 2016 12:18:16 -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 XaDIsHL0HUNA for ; Wed, 17 Aug 2016 12:18:15 -0400 (EDT) Received: from [10.0.1.3] (unknown [192.119.134.23]) by mercury.negativeion.net (Postfix) with ESMTPSA id B3F633E8BC2F for ; Wed, 17 Aug 2016 12:18:15 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-ID: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> Date: Wed, 17 Aug 2016 11:18:15 -0500 To: internals Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) Subject: ReflectionType::__toString() prepending \ to class names From: aaron@trowski.com (Aaron Piotrowski) 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=3Dphp-src.git;a=3Dcommitdiff;h=3D20fdd47921f423728b4= 09fd0ae0106dab9c34573 [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=