Issue 28 in addendum: Annotations with no space between the docblock margin and the @ symbol are silently eaten

0 views
Skip to first unread message

adde...@googlecode.com

unread,
Jan 8, 2011, 7:47:32 PM1/8/11
to addendum...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 28 by shabbyrobe: Annotations with no space between the docblock
margin and the @ symbol are silently eaten
http://code.google.com/p/addendum/issues/detail?id=28

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);
}


adde...@googlecode.com

unread,
Jan 9, 2011, 6:50:37 AM1/9/11
to addendum...@googlegroups.com
Updates:
Status: Accepted

Comment #1 on issue 28 by jan.suchal: Annotations with no space between the

docblock margin and the @ symbol are silently eaten
http://code.google.com/p/addendum/issues/detail?id=28

Cool, would you mind providing a file .patch of this change?

adde...@googlecode.com

unread,
Jan 9, 2011, 7:09:02 AM1/9/11
to addendum...@googlegroups.com

Comment #2 on issue 28 by shabbyrobe: Annotations with no space between the
docblock margin and the @ symbol are silently eaten
http://code.google.com/p/addendum/issues/detail?id=28

Here 'tis. Is this format OK? I just did an svn diff.

Attachments:
issue-28.diff 1.7 KB

adde...@googlecode.com

unread,
Jan 9, 2011, 8:31:38 AM1/9/11
to addendum...@googlegroups.com
Updates:
Status: Fixed

Comment #3 on issue 28 by jan.suchal: Annotations with no space between the

docblock margin and the @ symbol are silently eaten
http://code.google.com/p/addendum/issues/detail?id=28

Thanks, applied in #75 http://code.google.com/p/addendum/source/detail?r=75#

Reply all
Reply to author
Forward
0 new messages