Skip to content

Instantly share code, notes, and snippets.

@guilhermeblanco
Forked from tswicegood/gist:570858
Created September 8, 2010 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilhermeblanco/570863 to your computer and use it in GitHub Desktop.
Save guilhermeblanco/570863 to your computer and use it in GitHub Desktop.
<?php
// current implementation
class HairColor implements ReflectionAnnotation {
public $hairColor = "";
}
[HairColor(hairColor="purple")]
class PurplePeopleEater { }
// expanded current implementation
class HairColor implements ReflectionAnnotation {
public $hairColor = "";
public function __construct(Reflector $reflector, array $data = array()) {
$this->hairColor = $data['value'];
}
}
[HairColor("purple")]
class PurplePeopleEater { }
// Travis' thoughts:
class HairColor implements \SPL\Annotation {
public $hairColor = '';
public function __construct($hairColor) {
$this->hairColor = $hairColor;
}
}
[HairColor("purple")]
class PurplePeopleEater() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment