0

I'm configuring Jenkins for my project and I want to create phpdoc but it doesn't works. I'm using phing and my server is with Debian.

What I've made :

  • Install phpDoc

    pear install phpdoc/phpDocumentor-beta
    
  • Phing :

    <target name="phpdoc">
         <phpdoc2 destdir="${workspace}/app/docs" template="responsive">
             <fileset dir="./src">
                 <include name="**.*.php" />
             </fileset>
         </phpdoc2>
     </target>
    

I'm getting this error :

    PHP Fatal error:  Call to undefined method phpDocumentor\Parser\Parser::setTitle() in /usr/share/php/phing/tasks/ext/phpdoc/PhpDocumentor2Wrapper.php on line 169
    PHP Stack trace:
    PHP   1. {main}() /usr/share/php/phing.php:0
    PHP   2. Phing::fire() /usr/share/php/phing.php:43
    PHP   3. Phing::start() /usr/share/php/phing/Phing.php:270
    PHP   4. Phing->runBuild() /usr/share/php/phing/Phing.php:170
    PHP   5. Project->executeTargets() /usr/share/php/phing/Phing.php:572
    PHP   6. Project->executeTarget() /usr/share/php/phing/Project.php:791
    PHP   7. Target->performTasks() /usr/share/php/phing/Project.php:818
    PHP   8. Target->main() /usr/share/php/phing/Target.php:321
    PHP   9. Task->perform() /usr/share/php/phing/Target.php:298
    PHP  10. PhingCallTask->main() /usr/share/php/phing/Task.php:260
    PHP  11. PhingTask->main() /usr/share/php/phing/tasks/system/PhingCallTask.php:158
    PHP  12. PhingTask->processFile() /usr/share/php/phing/tasks/system/PhingTask.php:150
    PHP  13. Project->executeTarget() /usr/share/php/phing/tasks/system/PhingTask.php:277
    PHP  14. Target->performTasks() /usr/share/php/phing/Project.php:818
    PHP  15. Target->main() /usr/share/php/phing/Target.php:321
    PHP  16. Task->perform() /usr/share/php/phing/Target.php:298
    PHP  17. PhpDocumentor2Task->main() /usr/share/php/phing/Task.php:260
    PHP  18. PhpDocumentor2Wrapper->run() /usr/share/php/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php:147
    PHP  19. PhpDocumentor2Wrapper->parseFiles() /usr/share/php/phing/tasks/ext/phpdoc/PhpDocumentor2Wrapper.php:201
    Build step 'Invoke Phing targets' marked build as failure

It seems that phpDocumentor class is not found but I don't find why !

My include path is .:/usr/share/php:/usr/share/pear and phpDocumentor is installed in /usr/share/pear folder.

Any ideas ?

Edit : I've created a simple test file :

    # cat test.php
    <?php
    $parser = new \phpDocumentor\Parser\Parser();

But I get this error :

    # php -f test.php
    PHP Fatal error:  Class 'phpDocumentor\Parser\Parser' not found in /var/www/test.php on line 2
    PHP Stack trace:
    PHP   1. {main}() /var/www/test.php:0

Why phpDocumentor seams to be not installed while I've :

pear info phpdoc/phpDocumentor
About pear.phpdoc.org/phpDocumentor-2.0.0
=========================================
Release Type          PEAR-style PHP-based Package
Name                  phpDocumentor
Channel               pear.phpdoc.org
[...]
Release Date          2013-08-03 06:08:35
Release Version       2.0.0 (stable)
API Version           2.0.0 (stable)
package.xml version   2.0
Last Modified         2013-08-06 08:17
Previous Installed    - None -
Version
Gilles
  • 317
  • 5
  • 15

3 Answers3

1

I've finally made it using exec command :

<target name="phpdoc" description="API Documentation">
     <exec command="phpdoc
        -d ${ws}/src
        -t ${builddir}/reports/doc/
        --template responsive
    " />
</target>

Less options and not really pretty but that works.

Gilles
  • 317
  • 5
  • 15
0

Download the stable 1.4.4 (stable) - http://pear.php.net/package/PhpDocumentor/

Try maybe set the title:

<target name="phpdoc">
     <phpdoc2 title="Some Title" destdir="${workspace}/app/docs" template="responsive">
         <fileset dir="./src">
             <include name="**.*.php" />
         </fileset>
     </phpdoc2>
 </target>
Wyck
  • 2,023
  • 4
  • 28
  • 34
  • Thanks but I get exactly the same error. I think it could be a pear autoloading configuration problem... – Gilles Aug 05 '13 at 07:07
0

My hunch is that you are installing phpDocumentor 1.x but using a Phing task designed for phpDocumentor 2.x.

ashnazg
  • 6,558
  • 2
  • 32
  • 39
  • I've followed the install guide of http://www.phpdoc.org/ : pear channel-discover pear.phpdoc.org pear install phpdoc/phpDocumentor – Gilles Aug 06 '13 at 08:17
  • I've tried to install phpDocumentor 1.x but same problem, so I came back to phpDocumentor 2.x. – Gilles Aug 06 '13 at 08:22
  • My point is that it looks to me like the Phing Task you are using is one that's written for phpDocumentor 2.x (http://www.phing.info/docs/guide/stable/chapters/appendixes/AppendixC-OptionalTasks.html#PhpDocumentor2Task). But if you actually have phpDocumentor 1.x installed instead, you need to use Phing's Task that's written for it (http://www.phing.info/docs/guide/stable/chapters/appendixes/AppendixC-OptionalTasks.html#PhpDocumentorTask). – ashnazg Aug 06 '13 at 21:02
  • However, I now think the more likely scenario is that the Phing's phpDocumentor2 Task may not be caught up with recent work in phpDocumentor 2.x's alpha/beta period. It's entirely possible that class refactorings in phpdoc2 have made the Phing task inoperable. That's only a guess though. – ashnazg Aug 06 '13 at 21:04