Jump to content

Manuel:Mwdoc-filter.php

From mediawiki.org
This page is a translated version of the page Manual:Mwdoc-filter.php and the translation is 100% complete.
Version de MediaWiki :
1.20

Détails

Le fichier mwdoc-fliter.php est un filtre Doxygen pour montrer des types de variables membres corrects dans la documentation.

It has been adapted for MediaWiki to resolve various bugs we experienced from using Doxygen with our coding conventions:

  • We want to allow documenting class members on a single line by documenting them as /** @var SomeType Description here., and in long-form as ‎
    /** 
     * Description here.
     * @var SomeType
    
  • PHP does not support native type-hinting of class members. Instead, we document that using @var in the doc blocks above it. However, Doxygen only supports parsing this from executable code. We achieve this by having the this script filter take the typehint from the doc block and insert it into the source code in front of $myvar, like protected SomeType $myvar. This result is technically invalid PHP code, but Doxygen understands it this way.

Options et arguments

Ce script accepte le chemin d'un fichier PHP comme un argument.

Utilisation

php maintenance/mwdoc-filter.php file
ABC.php
<?php

class ABC {
    /** @var array[] Description 1 */
    private $a = [];

    /** @var int Description 2 */
    private $b;

    /** @var ActorStoreFactory Description 3 */
    private $c;
}
Terminal

Voir aussi