On Sat, 12 Feb 2005, Marcus Boerger wrote:

> ups, reading again i see it, it was ReflectionProperty::getDocComment()

There's a generic getDocComment() method, but that just returns the
entire blob. You then need to parse the blog using the preg functions
to extract individual lines. It would be useful to have the Reflection
classes do this.

Sure, you can do this in userland code:

$field = 'link'; // specific comment
$rc = new ReflectionClass($this);
$dc = $rc->getDocComment();
if (preg_match("/@$field +(.+)/", $dc, $matches)) {
  // do something with $matches;
}

But I think this would be cleaner:

$field = 'link'; // specific comment
$rc = new ReflectionClass($this);
$matches = $rc->getDocComment($field);
foreach ($matches as $match) {
  // do something with $match;
}

As I would prefer to put the comment matching logic in the reflection
classes, so you can write tools that can rely upon a standardized
format for supplying meta data about a class, method, etc.

Not a big deal one way or another, but this could solve some of the
WSDL generation arguments (which I would love to solve) without
requiring major language changes, such as native type hinting.

-adam
-- 
[EMAIL PROTECTED] | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to