簡體   English   中英

我如何忽略phpDocumentor中的特定文件

[英]How do i ignore specific files in phpDocumentor

我正在記錄我使用phpDocumentor在PHP中構建的程序。 一切都很完美,但文檔顯示我有近100個錯誤,因為它正在讀取我用來將文件上傳到我的服務器的文件,但我沒有創建。 是否可以忽略那個給我所有錯誤的特定文件? 這是我正在執行以生成文檔文件的命令:

phpdoc run -d /var/www/html/myprogram/ -t /var/www/html/myprogram/documentation

我試圖忽略的文件位於/myprogram目錄內,如下所示:

/modules/module1/uploader.php

我發現了一些關於使用--ignore ,但是我不知道是否指的是與目錄特定的東西。

是否有可能在index.php文件中寫一些指示phpDocumentor忽略某些文件的東西?

--ignore標志將接受單個文件名(以及目錄名稱或glob表達式):

phpdoc run --ignore /var/www/html/myprogram/modules/module1/uploader.php -d /var/www/html/myprogram/ -t /var/www/html/myprogram/documentation

或者由於它將接受部分目錄,因此可以縮短為:

phpdoc run --ignore modules/module1/uploader.php -d /var/www/html/myprogram/ -t /var/www/html/myprogram/documentation

我希望,我的答案不會被低估。 我在這里包括我的答案以供將來參考,以及其他可能從中受益的人。

在項目的根目錄中創建phpdoc.xml配置文件有很大幫助,而不是通過包含多個include / ignore選項使命令復雜化。 人們可以很容易地將文件中所有必需的選項捆綁在一起,這些選項將由phpdoc讀取以幫助構建文檔。

例如,我的項目的phpdoc.xml配置文件如下包含phpdoc選項:

<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
    <title>App Plugins Documentations</title>
    <parser>
        <target>reference/docs</target>
    </parser>
    <transformer>
        <target>reference/docs</target>
    </transformer>
    <files>
        <directory>.</directory> <!-- Scan and parse all the php files except those found in the paths below -->
        <ignore>assets/*</ignore>
        <ignore>includes/gm-virtual-pages/*</ignore>
        <ignore>includes/app_virtual_pages/*</ignore>
        <ignore>includes/third-party/*</ignore>
        <ignore>includes/vendor/*</ignore>
        <ignore>reference/docs/*</ignore>
        <ignore>storage/*</ignore>
        <ignore>views/*</ignore>
        <ignore>index.php</ignore> <!-- Ignore all the index.php files -->
    </files>
</phpdoc>

這樣你就可以包含/忽略多個路徑和文件; 甚至是你問題中的特定文件。 您所要做的就是在文件的相對路徑中包含ignore選項。

<ignore>/modules/module1/uploader.php</ignore>

只需在項目的根目錄中運行phpdoc命令,其中包含phpdoc.xml配置文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM