<?php
namespace MyNameSpace;
/**
* Class MyClass.
*
* @Annotation(
* id = "my_id"
* )
*/
class MyClass {
/**
* {@inheritdoc}
*/
public function initializeIterator() {
$array = [
['name' => 'Jonathan','id' => '5'],
['name' => 'Abdul' ,'id' => '22'],
];
$object = new \ArrayObject($array);
$filter_iterator = new class ($object->getIterator()) extends \FilterIterator {
public function accept() {
$user = $this->getInnerIterator()->current();
if( strcasecmp($user['name'],'abdul') == 0) {
return false;
}
return true;
}
};
return $filter_iterator;
}
}
$class = 'MyNameSpace\MyClass';
$finder = new \Doctrine\Common\Reflection\Psr0FindFile(['MyNameSpace' => ['my_folder']]);
$parser = new \Doctrine\Common\Reflection\StaticReflectionParser($class, $finder, FALSE);
$doctrine_doc = $parser->getDocComment();
/**
* Class MyClass.
*
* @Annotation(
* id = "my_id"
* )
*/
actual result: empty string.
After debugging I found out that the parse overrides DocComment for the main class by DocComment of an anonymous class which is empty.