On the SitePoint PHP blog today Troels Knak-Nielsen has posted about a lesser known feature of the popular XDebug debugging tool - function traces.
In case you haven't heard of it before, it "allows you to log all function calls, including parameters and return values to a file", to quote the manual. After playing around with it for a while, I realised that this information could be parsed and used to determine parameter types and return types of functions.
To illustrate one use for the trace results, he create a simple script that parsed them and reinjected them back into a source file as docblock comments. Included in the post is an example of its usage and the resulting comments for a simple class. It can be downloaded from github.