Just ahead: you did not indicate in your question which PHP Eclipse plugin you are talking about, so I assume you are talking about PDT.
As far as I know - and it is a little rusty, because now I use PHPStorm - it is impossible for PDT to include deleting files from the box.
This is also true for everything that static code analysis does, because many things cannot be resolved without a run-time context. For the examples you give:
include('file.php')
and require_once('file.php')
contain links to files related to the working directory and the inclusion path. Both are unknown during static code analysis. Most tools can extract the inclusion path from the project configuration; in PDT, this is usually the build path. The working directory problem is most often "solved" by simply expecting the working directory to be the directory in which the file containing these include directives is included, but this should not be true.
$linktoimportantpage = "file.php"
will need to track the evaluation of the variable value. This may be possible with static code analysis, but only very advanced tools will do it. I suspect PDT really supports this.
Since the appearance seems rather limited for static code analysis, to get a list of files used, I personally would do a regular expression search based on a file name template. Here, all files end with .php
, often used in a string, so the regular expression to search for such places:
\.php['"]
Eclipse PDT supports regular expressions in finding files from the GUI. Currently - even I use a different IDE mainly - I would personally do this on commanline because it is more flexible. This can be done using the find
and grep
commands. They come with their help pages and are easy to use. If you use windows, you can install git - bash for windows with bash, which contains all the useful command line tools for such things.
If you need a better experience, you can run the application and control everything, including analyzer software called inclued . This is the PECL package, and it is documented in the PHP manual: http://php.net/inclued - it is fairly straightforward and does not have the drawbacks of static code analysis tools, as it processes runtime information.
source share