gbecchio / addendum Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/addendum
License: GNU Lesser General Public License v2.1
Automatically exported from code.google.com/p/addendum
License: GNU Lesser General Public License v2.1
Hello,
I get this error
Notice: Undefined variable: class in
E:\TOOLS\xampp-1.6.6a\htdocs\project\src\lib\addendum\annotations\doc_comment.ph
p
on line 86
I get this error when I'm instantiating the class :
$reflection = new ReflectionAnnotatedClass($classname);
Original issue reported on code.google.com by [email protected]
on 1 Jul 2008 at 4:33
PHP 5.3
class Myanno extends Annotation {
public function __construct($nfo) {
$this->nfo = $nfo;
}
}
/**
@Myanno('special info')
*/
class Annoclass {
}
this code above throws
Fatal error: Cannot override final method Annotation::__construct()
Original issue reported on code.google.com by [email protected]
on 31 Oct 2009 at 8:04
It does not seem possible to do annotations on the parameters of a method
or function (I don't see a getDocComment on the php parameter reflection
class so I assume this is not possible). Is that true?
Original issue reported on code.google.com by [email protected]
on 6 May 2008 at 5:41
Addendum 0.4.0
1. Define an annotation like "class Y extends Annotation {}"
2. Annotate a class with the annotation
3. Addendum won't see the Y annotation for annotated class
SimpleTest is attached.
Original issue reported on code.google.com by [email protected]
on 23 Jun 2010 at 1:21
Attachments:
What steps will reproduce the problem?
1. Look up the date of the zip for 0.4.0 in downloads. Shows Oct 2009.
2. The contents match those of the trunk (from Oct 2010)???
3. Be Confused
What is the expected output? What do you see instead?
I expect to see a coherent date for the file. :)
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Dec 2010 at 3:53
What steps will reproduce the problem?
1. Use a @Target annotated class besides a PHPUnit test using its Target class.
What is the expected output? What do you see instead?
PHP fails when redeclaring "Target" over another already declared "Target".
What version of the product are you using? On what operating system?
0.4.0, Linux
Please provide any additional information below.
The correct fix might be to use namespaces to avoid clashes, but it's very
tricky (tried it).
As a fix I've renamed @Target to @AnnotationTarget locally.
Original issue reported on code.google.com by [email protected]
on 20 Aug 2010 at 9:52
First of all, Addendum rocks!!
But it would be really nice to have support for class
prefixes.
That way I can do something like this:
<?php
class My_Annotation_Title
{}
/**
* @Title("Welcome")
*/
class Class_That_Uses_My_Annottion
{}
?>
I think more people will like this feature. I do, because it
allows me to use the Zend class naming convention.
Original issue reported on code.google.com by [email protected]
on 23 Jun 2009 at 6:08
What steps will reproduce the problem?
1. make Annotation class abstract
2. run test unit
What is the expected output? What do you see instead?
no error is expected but it was errors in this tests case :
testValueMatcherShouldMatchAnnotation
testNestedAnnotationMatcherShouldMatchAnnotation
What version of the product are you using? On what operating system?
Addendum 0.4.0
PHP 5.2.9
Window XP
Please provide any additional information below.
What is the necessity of this constraint ?
I think it would be better in point of view POO to make the annotation class
abstract.
Original issue reported on code.google.com by [email protected]
on 25 Oct 2010 at 4:24
[deleted issue]
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 29 Jul 2008 at 1:07
What steps will reproduce the problem?
/** Target('class') */
class AAA extends Annotation { }
/** Target('property') */
class BBB extends Annotation { }
/** @AAA('no') */
class x {
/** @BBB('no') */
public $my_var;
}
class y extends x { }
$obj = new y();
$reflection = new ReflectionAnnotatedClass($obj);
echo "Are Annotations inherited >> ".((int)$reflection->hasAnnotation('AAA'));
What is the expected output? What do you see instead?
Expected:
Are Annotations inherited >> 1
Instead:
Are Annotations inherited >> 0
What version of the product are you using? On what operating system?
svn HEAD on Debian
Please provide any additional information below.
I would be willing to write it (it seems extremely simple to implement) if
given SVN access.
I think you should be able to annotate Annotations with another special one
like target like this:
/**
@Target('class')
@Inheritable(true)
*/
class AAA extends Annotation { }
You could then toggle the inheritance of the attribute per method, property, or
class. It would be simply some updates to the internal.
Original issue reported on code.google.com by [email protected]
on 2 Sep 2010 at 3:42
Addendum's performance is greatly improved by introducing a cache for parsed
annotations.
See discussion here:
https://groups.google.com/group/addendum-discuss/browse_thread/thread/d10167f236
dbd5c
A patch is attached.
Original issue reported on code.google.com by [email protected]
on 16 Jan 2011 at 1:52
Attachments:
What steps will reproduce the problem?
1. Create a simple annotation class using the following code:
/**
* This is the class behind our @Something annotations
*/
class Something extends Annotation {}
2. Use the annotation class as described in the basic tutorials.
What is the expected output? What do you see instead?
This might be really obvious and dumb, but I expected the above annotation
class to work. However, it caused a Segmentation Fault when I tried
accessing the Something annotation on another class because it caused a
recursive loop. When the Something class gets instantiated, it gets parsed
for annotations as well as the class on which I am searching for
annotations. When the Something class is parsed, it finds the '@Something'
string and recursively starts parsing its own annotation. If it's necessary
for the Annotation subclass to be parsed for annotations, then simply
adding a warning to the documentation could save people a lot of time
debugging this issue.
What version of the product are you using? On what operating system?
Annotations 0.3.2
Ubuntu Jaunty
PHP 5.2
Please provide any additional information below.
This is a great tool, thanks for making it :)
Original issue reported on code.google.com by [email protected]
on 30 Oct 2009 at 8:35
Addendum::getDeclaredAnnotations() does not work with autoloaders.
I patched the Addendum class and added a declareAnnotation() method. You'll
find the patch attached if you're interested.
Thanks for this nice library, it is being used in Atomik Framework
(atomikframework.com)
Original issue reported on code.google.com by maxime.bouroumeau
on 19 Mar 2010 at 11:31
Attachments:
Hello, I noticed a little problem with class constants(and statics) as a
value of a Annotation class property. After assigning a class constant to
the Annotation class property, the Annotation class property doesn't
contain any value. It should contain the value of the class constant. Too
explain the problem I wrote an example:
/** @Target("property") */
class XAnnotation extends Annotation {
public $annotationProp;
}
class YEnum {
const A = 1;
const B = 2;
}
class Zz {
/** @XAnnotation(annotationProp=YEnum::A) */
protected $annotatedProp;
}
$z = new Zz();
$reflectedProperties = new ReflectionAnnotatedClass($z)->getProperties();
for($i = 0; $i < count($reflectedProperties); $i++) {
$annotation = $reflectedProperties[$i]->getAnnotation('XAnnotation');
echo $annotation->annotationProp; // Expected output should be 1 the
value of YEnum::A, but it returns nothing
}
I'am using Addendum 0.3.2 on PHP 5.2.8
Original issue reported on code.google.com by [email protected]
on 11 Feb 2009 at 11:45
It would be nice if you could throw some kind of exception instead of
calling trigger_error (annotations.php). I'm using addendum with a
persistence api, btw - see my comment on your "RealWorldUsage" wiki page.
Original issue reported on code.google.com by [email protected]
on 8 Nov 2008 at 7:50
Would it be possible to change Addendum so it would ignore cases in
annotations?
All the phpDocumentor tags are in lowercase (@package, @author) but my
annotations start with an uppercase (@Title). That's because I want my
annotation class to be "Title" instead of "title".
When you look at this code you'll see that it's not very pretty:
/**
* Description
*
* @Title('HelloWorld')
* @package helloworld
* @author Ruud
*/
class HelloWorldClass {}
Original issue reported on code.google.com by [email protected]
on 29 Dec 2009 at 8:45
What steps will reproduce the problem?
<?php
/**
* @Sample_Anno('FOO')
*/
require_once 'libraries/addendum/annotations.php';
class Sample_Anno extends Annotation {}
/**
* @Sample_Anno('BAR')
*/
class TestClass {}
$annotations = new ReflectionAnnotatedClass('TestClass');
?>
What version of the product are you using? On what operating system?
Windows XP
PHP 5.2.6
Apache 2.2
addendum-0.3.2
Please provide any additional information below.
Script breaks at Annotation::checkTargetConstraints
class Annotation {
// ....
private function checkTargetConstraints($target) {
$reflection = new ReflectionAnnotatedClass($this); // <---- HERE
I think it makes infinitive loop.
Original issue reported on code.google.com by [email protected]
on 28 Jan 2009 at 1:47
The static method getDeclaredAnnotations on class Addendum caches all the
declared classes in Addendum::$annotations.
When you try something like this:
File: AnimalAnnotation.php:
<?php
class Animal extends Annotation {}
?>
File: HumanAnnotation.php:
<?php
class Human extends Annotation {}
?>
File: Parser.php
<?php
include("addendum.php");
// Include the Animal Annotation:
include("AnimalAnnotation.php");
// Do not include the HumanAnnotation yet
/** @Animal */
class Dog {
// some code
}
$reflection = new ReflectionAnnotatedClass('Dog');
// $reflection now contains the annotations of class Dog
// Now include the HumanAnnotation
include("HumanAnnotation.php");
/** @Human */
class Ruud {
// some code
}
$reflection = new ReflectionAnnotatedClass('Ruud');
?>
Now you get this exception: "Unknown class passed as parameter"
This is logical because the first time Addendum::getDeclaredAnnotations()
is called (by Addendum::resolveClassName()) it will cache all declared
classes using get_declared_classes().
When you declare new annotations by including the files (like
HumanAnnotation.php) they won't show up in the cached annotations.
A quick fix I made is the following function for the Addendum class:
<?php
public static function resetDeclaredAnnotations() {
self::$annotations = false;
}
?>
Now I can call Addendum::resetDeclaredAnnotations() after I load new
annotations.
Original issue reported on code.google.com by [email protected]
on 2 Feb 2010 at 12:03
What steps will reproduce the problem?
1. @Data(type="array", columns = {1 = "elm1", 2 = "elm2", 3 = "elm3})
2. store the annotation in a variable $f
3. run var_dump($f->getAllAnnotations()).
What is the expected output?
$data["type"] => "array",
$data["columns"] => array(1 => "elm1", 2 => "elm2", 3 => "elm3")
What do you see instead?
$data["type"] => "array",
$data["columns"] => array(0 => "elm1", 1 => "elm2", 2 => "elm3")
What version of the product are you using? On what operating system?
I just downloaded the version from today, I'm running Ubuntu 11.04
Please provide any additional information below.
However if I only have one element in the columns array, I get the correct
result:
$data["type"] => "array",
$data["columns"] => array(1 => "elm1")
But as soon I add one more element, I cannot controll numeric keys anymore, if
I use strings it works fine as well.
Original issue reported on code.google.com by [email protected]
on 30 Jun 2011 at 7:57
Maybe is good idea to implement:
- filter, cos' we definitely dont want to parse @return, @var,
@desc attributes. it will be good if this option is configurable ;)
Original issue reported on code.google.com by [email protected]
on 26 Mar 2008 at 11:14
Maybe is good idea to implement:
- inheritance of annotations
- also a filter, cos' we definitely dont want to parse @return, @var,
@desc attributes. it will be good if this option is configurable ;)
Original issue reported on code.google.com by [email protected]
on 6 Feb 2008 at 8:07
What steps will reproduce the problem?
1. Set Ignore annotations
2. Instantiate ReflectionAnnotatedClass with Doctrine2 Entity
3.
What is the expected output? What do you see instead?
Expected to find extra annotations other then Doctrine2 Annotations.
What version of the product are you using? On what operating system?
Latest
Please provide any additional information below.
Put the ignore check before the is_subclass in the annotationsbuilder class to
fix this:
!Addendum::ignores($class) && is_subclass_of($class, 'Annotation')
Original issue reported on code.google.com by [email protected]
on 12 Oct 2010 at 8:24
What steps will reproduce the problem?
1. Create a class
2. Add an annotation doc block
3. Omit the space between the * margin of the docblock and the @ of the
annotation.
If I have an annotation declared like so, with no space preceding the @,
Addendum cannot find the annotation:
/**
*@Table("person")
*/
class Person {}
$c = new ReflectionAnnotatedClass('Person');
var_dump($c->getAnnotations()); // nope
In the AnnotationsMatcher class, the regular expression seems to be looking for
a "space that is followed by an at symbol".
Changing the regex from '/\s(?=@)/' to '/[\s\*](?=@)/' seems to work without
breaking any of the other tests.
I used the following tests to make sure it worked as I expected. The second
test case was just to make sure "/**\n@Annotation(true)\n*/ worked, and it does.
public function testAnnotationsMatcherShouldMatchWhenThereIsNoSpaceBetweenDocBlockMarginAndAt() {
$matcher = new AnnotationsMatcher;
$expected = array('Annotation'=>array(array('value'=>true)));
$block = "/**\n *@Annotation(true)\n*/";
$this->assertMatcherResult($matcher, $block, $expected);
}
public function testAnnotationsMatcherShouldMatchWhenFirstThingOnALine() {
$matcher = new AnnotationsMatcher;
$expected = array('Annotation'=>array(array('value'=>true)));
$block = "/**\n@Annotation(true)\n*/";
$this->assertMatcherResult($matcher, $block, $expected);
}
Original issue reported on code.google.com by [email protected]
on 9 Jan 2011 at 12:47
Would it be possible to support brackets [ ] for simple array values?
This way you'll support both Javascript-style arrays: {} and [].
Original issue reported on code.google.com by [email protected]
on 29 Dec 2009 at 8:49
Am using addendum heavily and interested in some perfomance improvements.
I know annotation builder alredy uses static cache for annotations, but
maybe something like stripping standart php doc comments may speed up process?
Things like @author, @package, @var etc. can be omited while processing and
think it can gives some boost, no?
Thanks for great library, very useful
Original issue reported on code.google.com by [email protected]
on 8 Apr 2010 at 5:16
Hi,
I would like to know if you plan to add namespaces support.
It doesn't seem to need heavy modifications :
I just changed the regexp located at line 134 of annotation_parser.php to
accept backslashes.
Then I was able to use your framework with classes (and annotation classes)
located in namespaces.
Speaking of namespaces, don't you think it would find to move your classes
in an Addendum namespace ?? ;)
Thank you for your work !
Original issue reported on code.google.com by [email protected]
on 3 May 2010 at 1:51
Hey this is awesome and exactly what I was looking for...one small problem
I encountered due to my own ignorance was the custom annotations were not
properly parsed when I used them like:
/
@Custom (name=value)
/
Basically the speace between @Custom and the openeing bracket caused the
annotations to not parse (whether by design or not I don't know?). Likewise
unless I used numerics as values strings would not properly parse either.
While this is moot it did make it difficult to figure out what was going wrong.
I would suggest either clearly stating this in the docs (opting for better
performance?) or to add the additional checking in the parsing routine to
at least accomodate whitespace and/or throw exceptions on errors parsing
annotations.
When used as a meta-pgroamming facility this could lead to seriusly
annoying bugs that are very difficult to track down, unless you aware of
how Annotations are being used.
Cheers, Alex
Original issue reported on code.google.com by [email protected]
on 25 Nov 2008 at 10:16
What steps will reproduce the problem?
1. make Annotation class abstract
2. run test unit
What is the expected output? What do you see instead?
no error is expected but it was errors in this tests case :
testValueMatcherShouldMatchAnnotation
testNestedAnnotationMatcherShouldMatchAnnotation
What version of the product are you using? On what operating system?
Addendum 0.4.0
PHP 5.2.9
Window XP
Please provide any additional information below.
What is the necessity of this constraint ?
I think it would be better in point of view POO to make the annotation class
abstract.
Original issue reported on code.google.com by [email protected]
on 25 Oct 2010 at 4:26
What steps will reproduce the problem?
1. make Annotation class abstract
2. run test unit
What is the expected output? What do you see instead?
no error is expected but it was errors in this tests case :
testValueMatcherShouldMatchAnnotation
testNestedAnnotationMatcherShouldMatchAnnotation
What version of the product are you using? On what operating system?
Addendum 0.4.0
PHP 5.2.9
Window XP
Please provide any additional information below.
What is the necessity of this constraint ?
I think it would be better in point of view POO to make the annotation class
abstract.
Original issue reported on code.google.com by [email protected]
on 25 Oct 2010 at 4:27
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.