问题
I'm using the tool from phpdoc.org and i'm stuck when I have a PHP file such as header.inc.php with only HTML inside.
<?php
/**
* Header content
*
* @author My name
*
* @since 1.0.0
*/
?>
<!DOCTYPE html>
<html lang="fr" class="no-js">
<head>
...
I get an error in my phpdoc "No page-level DocBlock was found in file...". I googled it but I didnt find any user with my case.
How to fix that error? Any tips are welcome.
Thank's!
Regards
回答1:
I just ran across this posting and though it's older, I thought I would add my two cents. While sylouuu is correct about placing a namespace directly after the your intended page-level DocBlock, I believe that it is now required to place the '@package' tag in the DocBlock. There is some caution here when dealing with logical versus hierarchical 'packages'. This behavior is basically dependent upon which version of PHPDocumentor you are using.
From: http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_elements.pkg.html "In phpDocumentor version 1.2.2, a Page-level DocBlock is the first DocBlock in a file if it contains a @package tag."
And at https://github.com/phpDocumentor/phpDocumentor2/issues/910 it can be read that as recently as a month ago, the issue of page-level DocBlocks in files with no PHP code/nodes is still being worked. Thus, as sylouuu stated about adding a namespace, once you do this, you have an documentable element and your problem should be resolved. Additionally, since most likely no documentation for the page will be created without having a node present, this allows your html-only file to have its documentation created.
Hope it helps! dw
回答2:
Ok anwser found: https://github.com/phpDocumentor/phpDocumentor2/issues/695
TL;DR: At the moment, it's not fixed, just ignore theses warnings.
来源:https://stackoverflow.com/questions/13622548/phpdocumentor-page-level-docblock-in-html-included-file