Giter VIP home page Giter VIP logo

addendum's People

addendum's Issues

Notice: Undefined variable: class in doc_comment.php on line 86

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

Fatal error PHP 5.3

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

annotations on method/function parameters

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

Date of the latest release (0.4.0)

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

Name collision with PHPUnit's "Target" class

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

Class prefixes?

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

why AnnotationMatcher Should Match Annotation ?

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

Testing google groups notify

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

Annotations do not support inheritance

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

Caching parsed annotations

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:

Recursive Annotations Parsing Documentation

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

getDeclaredAnnotations() does not work with autoloader

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:

const or statics as value of a annotation property

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

Exceptions instead of trigger_error

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

Case sensitivity of annotations

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

File level annotations couses apache to hang-up

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

Addendum::getDeclaredAnnotations() caches declared classes > Problem

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

MultiValueAnnotation array

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

Inheritance of annotations support

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

Unknown class passed as parameter in is_subclass

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

Annotations with no space between the docblock margin and the @ symbol are silently eaten

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

Perfomance improvements

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

Namespaces support

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

User friendly parsing error messages

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

why AnnotationMatcher Should Match Annotation ?

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

  • Merged into: #24

why AnnotationMatcher Should Match Annotation ?

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

  • Merged into: #24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.