Gilles
Gilles

Reputation: 317

Error generating phpdoc with phing

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 :

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

Upvotes: 0

Views: 1043

Answers (3)

Gilles
Gilles

Reputation: 317

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.

Upvotes: 1

ashnazg
ashnazg

Reputation: 6688

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

Upvotes: 0

Wyck
Wyck

Reputation: 2023

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>

Upvotes: 0

Related Questions