4

I have a large code library for which I am trying to generate hierarchical documentation. The project does not use namespaces but uses @package instead.

I just tried generating docs as a test from the following file with phpDocumentor2:

<?php
/**
 * This is a file
 * @package JustAn\Example
 **/

 /**
 * Something class
 **/
 class Something{
    function try_this(){

    }
 }

Though according to the docs @package JustAn\Example should be the equivalent of namespace JustAn\Example, I found this not to be the case.

When I use namespaces the resulting documentation is like this:

namespace version

When I use the @package notation the result looks like this (even though it recognizes the package notation - this is shown on the full details page of the class):

package notation version

I am looking for a way to get the hierarchical result without having to rewrite the code to use 'real' namespaces.

Aron
  • 3,419
  • 3
  • 30
  • 42
  • There does seem to be an issue with @package at the moment. See https://github.com/phpDocumentor/phpDocumentor2/issues/1133 – toxalot Mar 18 '14 at 16:05
  • This seems to be unrelated because the @package tag is registered, it just does not result in the same hiearchical listing. I've created an issue for it: https://github.com/phpDocumentor/phpDocumentor2/issues/1155 – Aron Mar 19 '14 at 16:18

2 Answers2

4

The problem is that the default "clean" template does not support this feature. Other templates (like "responsive" for example) do. You can use the --template="responsive" flag to change the default template used.

Aron
  • 3,419
  • 3
  • 30
  • 42
  • This doesn't fix the issue I am having. Did you actually get this working or are you just going by mvriel's answer in the issue thread? – toxalot Mar 21 '14 at 19:02
  • These templates worked: "responsive", "responsive-twig" worked. – Aron Mar 22 '14 at 21:02
  • I wish this can be added by phpdoc team in the future. Meantime, I just confirm "responsive" or "responsive-twig" works for me, although it doesn't look as nice as "clean". Another thought, we probably should use namespace ! – windmaomao Oct 15 '14 at 19:01
0

I see that you have the package tag in the file docblock, but not the class docblock. If you add it to your class docblock, I think it should work.

ashnazg
  • 6,558
  • 2
  • 32
  • 39
  • Just tried setting it on the class level too - the result is the same: no namespace hierarchy is present in the list. – Aron Mar 19 '14 at 16:01