Author: smarr Date: Sun Dec 30 20:36:56 2007 New Revision: 7045 Log: - fixed several fatal errors and 41 normal errors ;)
Modified: experimental/Reflection/src/class.php experimental/Reflection/src/method.php experimental/Reflection/tests/test_classes/MyReflectionClass.php Modified: experimental/Reflection/src/class.php ============================================================================== --- experimental/Reflection/src/class.php [iso-8859-1] (original) +++ experimental/Reflection/src/class.php [iso-8859-1] Sun Dec 30 20:36:56 2007 @@ -141,15 +141,15 @@ * ReflectionMethod::IS_FINAL * @return ezcReflectionMethod[] */ - public function getMethods($filter = 0) { + public function getMethods($filter = null) { $extMethods = array(); - if ($filter > 0) { + if ( $this->class instanceof ReflectionClass ) { + $methods = $this->class->getMethods($filter); + } else { $methods = parent::getMethods($filter); - } else { - $methods = parent::getMethods(); } foreach ($methods as $method) { - $extMethods[] = new ezcReflectionMethod($this->getName(), $method->getName()); + $extMethods[] = new ezcReflectionMethod($method); } return $extMethods; } Modified: experimental/Reflection/src/method.php ============================================================================== --- experimental/Reflection/src/method.php [iso-8859-1] (original) +++ experimental/Reflection/src/method.php [iso-8859-1] Sun Dec 30 20:36:56 2007 @@ -42,13 +42,16 @@ * @param string $name Optional if $classOrSource is instance of ReflectionMethod */ public function __construct($classOrSource, $name = null) { - if ($class instanceof ReflectionClass) { - parent::__construct($class->getName(), $name); - $this->curClass = $class; - } - elseif (is_string($class)) { - parent::__construct($class, $name); - $this->curClass = new ReflectionClass($class); + if ($classOrSource instanceof ReflectionMethod ) { + $this->reflectionSource = $classOrSource; + } + elseif ($classOrSource instanceof ReflectionClass) { + parent::__construct($classOrSource->getName(), $name); + $this->curClass = $classOrSource; + } + elseif (is_string($classOrSource)) { + parent::__construct($classOrSource, $name); + $this->curClass = new ReflectionClass($classOrSource); } else { $this->curClass = null; @@ -83,6 +86,20 @@ } /** + * Returns the doc comment for the method. + * + * @return string Doc comment + */ + public function getDocComment() { + if ( $this->reflectionSource instanceof ReflectionMethod ) { + $comment = $this->reflectionSource->getDocComment(); + } else { + $comment = parent::getDocComment(); + } + return $comment; + } + + /** * Returns the type defined in PHPDoc tags * @return ezcReflectionType */ Modified: experimental/Reflection/tests/test_classes/MyReflectionClass.php ============================================================================== --- experimental/Reflection/tests/test_classes/MyReflectionClass.php [iso-8859-1] (original) +++ experimental/Reflection/tests/test_classes/MyReflectionClass.php [iso-8859-1] Sun Dec 30 20:36:56 2007 @@ -6,6 +6,10 @@ { return true; } + + public function change() { + return true; + } } ?> -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components