Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57558 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12240 invoked from network); 29 Jan 2012 23:51:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2012 23:51:22 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.214.170 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.214.170 mail-tul01m020-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:50316] helo=mail-tul01m020-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/91-15394-87BD52F4 for ; Sun, 29 Jan 2012 18:51:21 -0500 Received: by obbup3 with SMTP id up3so3781940obb.29 for ; Sun, 29 Jan 2012 15:51:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.74.66 with SMTP id r2mr24869787obv.67.1327881077593; Sun, 29 Jan 2012 15:51:17 -0800 (PST) Received: by 10.60.20.1 with HTTP; Sun, 29 Jan 2012 15:51:17 -0800 (PST) Date: Sun, 29 Jan 2012 18:51:17 -0500 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d044470d1ef175604b7b367c6 Subject: ReflectionFile missing From: rasmus@mindplay.dk (Rasmus Schultz) --f46d044470d1ef175604b7b367c6 Content-Type: text/plain; charset=ISO-8859-1 Dear List, I realized the other day that ReflectionFile is missing from the Reflection API. A search for "ReflectionFile" on Google will reveal a number of implementations of classes with exactly that name, which suggests users are missing this - for example: https://github.com/rmccue/ReflectionFile/blob/master/ReflectionFile.php I think reflecting on files used to be less important than it is now - with the addition of namespaces, and the ability to import classes and interfaces from other namespaces, there are some interesting and useful aspects of files that could be exposed via Reflection. One thing that comes to mind, is with custom annotation libraries for PHP - some libraries (such as my own) permit you to globally set custom aliases to make annotation-names shorter and more useful, others resort to making you type the fully qualified class-name every time you want to apply an annotation. Neither approach is very elegant. This is addressed by the language, by allowing you to import classes and interfaces - annotation libraries could discover imported annotation types this way, but that aspect of the source code is not exposed via Reflection. Any thoughts? - Rasmus Schultz --f46d044470d1ef175604b7b367c6--