Skip to main content
Jump to: navigation, search

Type inference for APDT

Revision as of 11:02, 19 August 2008 by (Talk | contribs) (Getting the source)


The Aspect PHP Development Tools (APDT) project provides Eclipse platform based tool support for AOSD with PHPAspect. Our goal is to deliver a user experience that is consistent with the PHP Development Tools (PDT) when working with PHPAspect projects and resources. This plugin provides an integration layer between the PHPAspect weaver, runtime and Eclipse/PDT extension points.

Due to the highly dynamic nature of PHP, most of PHPAspect joinpoints can't be determined statically: PHPAspect weaves hooks in the source code in order to perform type checking at runtime. When a project is woven, a significant amount of hooks can be inserted in the source even though it be can statically analyzed that none of these hooks will trigger a code-advice: this is where type inference comes in.

APDT and PDT have both an integration layer with DLTK which as an experimental type inference framework used to improve code analysis on dynamic languages.

The type inference could be also used to improve APDT UI by providing aspect type information in the editor.


  • Student: William Candillon
  • Mentor: Michael Spector

Getting the source

The source is available on APDT SVN repository. APDT contains many eclipse plugins and the runtime library for PHP.

Hello World

Let's consider a simple piece of PHP code:

class Foo{
  public function fuebar(){
    return true;
class Bar{
  public function fuebar(){
    return true;
$foo = new Foo();
$bar = new Bar();

And the following joinpoint (all method invocation of the bar() method in an instance of Foo):


Before this summer, when you were writing a such joinpoint, PHPAspect was testing the type of $foo, $bar and $unknown to check if the joinpoint has been matched and then execute the associated code-advince. By using DLTK/PDT type inference engine, APDT knows that $foo is an instance of Foo therefore the joinpoint has been statically matched. $bar isn't an instance of Foo, this node in the PHP Program is left unchanged. The type of $unknown is unknown, APDT adds a runtime assertion: the type of $unknown is tested at runtime to check for code-advice execution.


  • Improved code completion in the APDT editor.
  • Quick assist markers in the APDT editor, like AJDT provides (semantic analysis).

Community Proposals


APDT Website

An overview of APDT

PHPAspect Website

Back to the top