Issue with Generating Documentation Using PhpDoc for Namespaced Classes

Hi all,

I’ve been trying to use PhpDoc to generate documentation for my PHP project, but I’ve encountered a strange issue with namespaced classes. I’ve written a few classes inside a specific namespace, but PhpDoc is not correctly generating documentation for them. It seems to be skipping over any class that’s defined within a namespace. Here’s what I’m doing:

1.I have a class like this:

namespace MyApp\Models;

/**
 * Class User
 *
 * @package MyApp\Models
 */
class User {
    private $name;

    /**
     * Set the user's name.
     *
     * @param string $name
     */
    public function setName($name) {
        $this->name = $name;
    }

    /**
     * Get the user's name.
     *
     * @return string
     */
    public function getName() {
        return $this->name;
    }
}
  1. My phpdoc command:
phpdoc -d ./src -t ./docs -o HTML:frames:default

The issue I’m facing is that the generated documentation doesn’t include any of the classes inside the MyApp\Models namespace. I’ve checked the class definitions, and they seem fine. The file paths are correct, and I can see the classes when I run phpdoc without any other issues except this one.

I’ve checked the documentation PhpDoc but I can’t find anything that might be causing this issue.

Does anyone have any idea why PhpDoc is skipping over the namespaced classes? Should I be doing something differently in the DocBlocks or the phpdoc command itself?

Well, for starters, if you read the page you linked…

You:

The page you linked:

What happens when you do it that way?