This is a discussion on Reflection and used classes within the PHP Language forums, part of the PHP Programming Forums category; Hi Folks, Is there any way of using reflection to find out what classes other classes use? I do not ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi Folks,
Is there any way of using reflection to find out what classes other classes use? I do not mean which classes extend other classes, I mean within methods, for example, where the "new" keyword instantiates objects of other classes. Any ideas? |
|
|||
|
Hi,
Don't know of a way to this with reflection. You can use PHPXref to locate references to a particular class, or you could try a recursive grep for a class identifier. Regards, John Peters On Apr 25, 2:37 pm, Hugh Oxford <ares...@fas.com> wrote: > Hi Folks, > > Is there any way of using reflection to find out what classes other > classes use? > > I do not mean which classes extend other classes, I mean within methods, > for example, where the "new" keyword instantiates objects of other classes. > > Any ideas? |
|
|||
|
petersprc wrote:
> Hi, > > Don't know of a way to this with reflection. > > You can use PHPXref to locate references to a particular class, or you > could try a recursive grep for a class identifier. > > Regards, > > John Peters > I like PHPxref, the problem is I use autoload. Maybe I could look at the code. |
|
|||
|
Hugh Oxford wrote:
> Is there any way of using reflection to find out what classes other > classes use? > > I do not mean which classes extend other classes, I mean within methods, > for example, where the "new" keyword instantiates objects of other classes. > > Any ideas? Sorry, but in languages like PHP here is no way to do such things reliably. This is real code from my current project: <CODE> .... $classname=self::getClassName($classId); $filename=strtolower($classId.'.object.php'); include_once $filename; $object= new $classname($this,$parentId,$name); .... </CODE> Class names taken from XML file. So if you have case like this and PHPxref is not enough for you - I think here are tools to do this as you want. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|