An experimental patch to PHP/ZendEngine to bring native annotations to PHP
PHP
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
anoforphp-5.3.5.diff
testannotation.php

README

INSTALL
=======
1.- Download the patch.
2.- Apply with:  patch -p1 < anoforphp-5.3.5.diff
3.- Compile and install PHP as usual.

BEWARE
======
This is an *experimental* work. I'm not that familiar with the internals of ZendEngine(tm) so I wont promess there wont be any memory leaks, or crashes. It seems stable, but please report any issues you may spot so I can correct them as soon as possible ;)

ABOUT
======
First things first, this patch is made for PHP 5.3.5, but it should be easy to port it to other 5.3.+ versions.

Now, the idea behind this patch is pretty obvious. Annotations are a very popular thing and php lacks of them. Also, it's pretty expensive to have them inside doc blocks (i.e: /** */), so this patch is made mostly for the extension reflection of php and the ZendEngine2(tm).

The annotation token is "@@", because the "@" was already taken. So for instance, you would do:

@@AnAnnotation
@@AnotherAnnotation("something")
@@AnotherAnnotation(key1="value1")
@@AnotherAnnotation(key1="value1", key2="value2")
...
class something {
...
}

also:

class something {
	@@AnAnnotation
	@@AnotherAnnotation("something")
	@@AnotherAnnotation(key1="value1")
	@@AnotherAnnotation(key1="value1", key2="value2")
	...
	public function aMethod() {
		...
	}
}

And, best of all:
class something {
	public function aMethod(@@AnAnnotation $a, @@An1 @@An2(key1="value1") $b) {
		...
	}
}

Homepage
========
http://marcelog.github.com/

Thanks To
=========
Pierrick Charron (https://github.com/adoy) for this comments on the use of TSRLM macros and also for his issue reports.