35469

Doxygen not documenting php code inside if tags

I am using doxygen, but it doesn't document some of my classes. All these classes are called in the following way:

<?php if(!class_exists('a')){ class a{ function b(){ print 'c'; } } } ?>

I assume it has to do with if(!class_exists('a')), how can i let doxygen still document this?

Answer1:

Doxygen has many issues documenting php code. And many of them can be corrected by using an input_filter.

Use the following code as filter

<?php $source = file_get_contents($argv[1]); $regexp = '#(<\?php[\s]+)(if\(!class_exists\([^\)]+\)\)\{)([\s\S]*)(\})([\s]*\?>)#'; $replace = '$1 $3 $5'; $source = preg_replace($regexp, $replace, $source); echo $source; ?>

and enter it as

/path/to/php php_var_filter.php

into the INPUT_FILTER setting.

Notice: This way you can fix many doxygen issues. If something does not work, it is beacause of a difference between c (or c++) code to php code (most likly). You can use the input_filter to change your php code to look more like c code. This will fix many problems.

<strong>Edit</strong> Maybe you also want to think about an autoload function. I think this is a better way to get the if(!class_exists(..))-result.

<strong>Edit</strong> I just noticed I already answerd a similar question different. You can also use this answer.

You can find some more input filters to improve doxygen's php support on GitHub.

Recommend

  • Need little assistance with pexpect module
  • The compatibility issue between NDIS version and Windows version
  • How can i call robocopy within a python script to bulk copy multiple folders?
  • Signature-changing decorator: properly documenting additional argument
  • pexpect equivalent of Expect's “send_user”
  • Remix Ethereum where goes the contract?
  • Accessing variables in other classes (Java)
  • what is the use case for scala List's companion function returning GenericCompanion?
  • RegEx for Phone Number Numbers with Letters
  • Excel VBA Delete Row If Misspelled Word
  • 'Set' in Components of Cake PHP
  • php regex remove digits
  • How do I prepend to a stream in Bash?
  • manupulating a string to create directories in unix
  • Replace and retrieve placeholder value
  • Getting syntax error in mysql-php. You have an error in your SQL syntax;
  • removing last 3 characters on a file (file extension)
  • Installing PHP 7 on digitalocean
  • Get specific string
  • How does this usort cmp function actually work?
  • Stop Bash Script if Hive Fails
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Spring security and special characters
  • Counter field in MS Access, how to generate?
  • Javascript + PHP Encryption with pidCrypt
  • Display Images one by one with next and previous functionality
  • Upload files with Ajax and Jquery
  • Websockets service method fails during R startup
  • Do I've to free mysql result after storing it?
  • retrieve vertices with no linked edge in arangodb
  • A cron job substitute?
  • json Serialization in asp
  • Acquiring multiple attributes from .xml file in c#
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • Python/Django TangoWithDjango Models and Databases
  • java string with new operator and a literal