Answer the question
In order to leave comments, you need to log in
PHP script dependencies
I sit and look at a pile of PHP files.
There is a feeling that half can be erased. Well, or at least half of the contents of the files, given that many implement the standard functions that PHP has natively (apparently, a heavy legacy of past versions).
In general, the question is the following: is there a tool that, having received a PHP script as input, will reveal the entire chain of dependencies in the form of “function A uses function B from file Zu”, “function B from file Zyu uses function C from file Mu " etc.
Answer the question
In order to leave comments, you need to log in
It seems to me that the tools from this review can help you , in particular Dead Code Detector (DCD) for PHP code
It will be difficult to foresee such situations:
call_user_func( $neededFunc, $params );
xdebug_start_code_coverage(); // back to top
...
...
$includes = array_keys(array_keys(xdebug_get_code_coverage())); // In the end
Well, I don't know such tools, but you can do this:
Put debug_backtrace in each function, and save it somewhere. Further, during normal operation, collect data about what causes where, analyze and find out something. Due to my ignorance, this is the first option that comes to my mind. If you find such a tool, please throw in the answer. THX.
Take any IDE with file search, enter the name of the function, see where it is used, delete it, check if everything works. Then delete the next one. Etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question