On Fri, 2007-12-14 at 14:09 -0500, Nathan Nobbe wrote: > On Dec 12, 2007 4:21 AM, Mathijs van Veluw <mathijs.van.veluw@xxxxxxxxxxx> > wrote: > > > Hello there, > > > > We have a large project with lots of classes. > > Now i am wondering if there is a way to let something check all those > > files and tell me which methods/functions variables/constants etc.. > > arn't used anymore. > > > > Or even which files arn't used anymore. > > > > Is there already something like this? > > > if you want to do it right, youll have to make use of the php tokenizer. > http://us.php.net/manual/en/ref.tokenizer.php > using this tool you can analyze the source to create a list of things like > - all classes defined in the code > - all functions defined in the code > once you have these lists you simply iterate over each member of them. > if there are no references to a specific function or class, it *should* be > safe to assume it is no longer in use, however it could be new code, not > yet in use. That's easier said than done :) The case of functions is mostly trivial however it becomes much more difficult once you get into the realm of dynamic function calling using variables. Additionally the case of classes and their methods is difficult to begin with. A method may be referenced for an object anywhere, but knowing that a given variable holds a particular object is much more difficult. In fact it's impossible to properly track in PHP since it's a loosely typed language and any variable can hold any type of object. Cheers, Rob. -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ........................................................... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php