Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101312 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31286 invoked from network); 11 Dec 2017 08:16:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2017 08:16:56 -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 209.85.128.175 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.128.175 mail-wr0-f175.google.com Received: from [209.85.128.175] ([209.85.128.175:35515] helo=mail-wr0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/19-53433-5FE3E2A5 for ; Mon, 11 Dec 2017 03:16:54 -0500 Received: by mail-wr0-f175.google.com with SMTP id g53so16557153wra.2 for ; Mon, 11 Dec 2017 00:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sBEpOE3RJT66bZNhWqqDEUVkAGkFPGAgybQmt0L0Ya8=; b=PQLv/mYK8y8eZ+XRfe89agtGkESTBRNR8Npzt2eXQRkN5NfXlz+Yq8tlMnHtN6Yslr J0VsjiJQsEuiNuq+TYyQGAy16ix6+xdCLe85tDWVImNWykuuTgHsdxTcFxK+uG33EblM oqxphxha46SonBYs7ixE5Ko6/Mud3cpyt7aF78vV8aPhBFsGih5KnEOn0odVBxMEmv+e AuiDZxmTjPO8kC4wZ5hp/C4ooxBu+hHz52A+Uonsaw7UzZSnHeTuSxPdPY48itPQLKbj vUoG7PQjHEWvmTjecYlxXwtVonlFjQEq5h7BpXI0j/hGzjQ16jBjm0mRGSTikUtPgWui MpXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sBEpOE3RJT66bZNhWqqDEUVkAGkFPGAgybQmt0L0Ya8=; b=H5olUZC3t/+fBJSkLFM/rCMexJdbN4us6bj42QhxxxuEZOQfPGSt/EzCMJakfopKrg hAkmaQDapb9mYqxyoY8653CwiHACH9RuQg6fNd4iOA1ghtPI8DSU8+WacRYejh/o1vMS VvVjdhJ2UpMRrbDsujjeQl/yFUxBgf6srw8Qh9DTIKFzSYE0+EXmsqS3PiTzGrSoeHdb plYFH/xcfGx4EHu9bWsBT2hZ0cRto+yjmQMBf/o8UEWEn3hj+W3mffccP+48MvYGyAJP s1mXgzUDUJVoLaCng48GJJzZcJsm4PHr7lqqm8+jyhuhqkrAPtckJRix9ti7w0s+0ocO kYFw== X-Gm-Message-State: AJaThX5z69SDQVmHwYdXcAwTNLhKSeENCbC0qm1ebDoNd+umUPDdRoym ymjvMSqD+7B8Ifgk/i9cVpYmFPLDbxIMUbyno5g= X-Google-Smtp-Source: AGs4zMZol+KbxIeVVlSRLAH/2E0S4A0sYFtkfV5VakmcL/Ejvojhqcx/ynESuSErpy0kpPDbN7c2KtyvSFRTkIJbbio= X-Received: by 10.223.177.194 with SMTP id r2mr33905259wra.84.1512980210700; Mon, 11 Dec 2017 00:16:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.184.205 with HTTP; Mon, 11 Dec 2017 00:16:49 -0800 (PST) Received: by 10.223.184.205 with HTTP; Mon, 11 Dec 2017 00:16:49 -0800 (PST) In-Reply-To: References: Date: Mon, 11 Dec 2017 09:16:49 +0100 Message-ID: To: Andreas Hennings Cc: PHP Internals List Content-Type: multipart/alternative; boundary="f403045e756602d97705600c28c2" Subject: Re: [PHP-DEV] Reflection API: Add ::getFullName() method. From: ocramius@gmail.com (Marco Pivetta) --f403045e756602d97705600c28c2 Content-Type: text/plain; charset="UTF-8" If you really want to expose a symbol's FQN, I suggest exposing the internal name as per `(array)` cast semantics. namespace A { class B { public $c; private $d; private $e; } } That would be: "A\B#\$c" "A\B#\0*\0\$d" "A\B#\0A\\B\0\$e" Obviously, the `\0` is horrible and can probably be improved: depends on whether the API is intended for human or machine consumption. If it is machine consumption, strings are the wrong approach anyway. I'd also add that this would be (fucking finally!) a good way to fix PHP's documentation horrible usage of `::` for both instance and static members. On 11 Dec 2017 04:00, "Andreas Hennings" wrote: I propose a new method ::getFullName() for all methods that implement \Reflector. (I would add it to the \Reflector interface, but this would be a BC break.) The full name would be, depending on the type: function: "str_replace()", "Acme\foo()". class: "Acme\Animal\Cat", "stdClass". method: "Acme\Animal\Cat::meow()". property: "Acme\Animal\Cat::$color". etc. I don't know if we can cover all reflection API classes in a meaningful way. E.g. for ReflectionObject, the full name would be the same as for the class, otherwise it would get complicated. Currently the ::__toString() and ::export() return something else, which is not really useful. The goal is to have something that is different for different items. E.g. a class and a function with the same name need to have a different "full name", hence the added "()" for functions and methods. As a rule of thumb, the "full name" is what one would put after a @see tag in phpDoc, but without the leading "\\". For consistency with the rest of PHP and reflection API, we should use QN and not FQN as return value. Related: I started another thread proposing a ::getHash() method. I originally though to propose the two things in the same thread, but I now think they should be discussed independently. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php --f403045e756602d97705600c28c2--