FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using function prototypes in code
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Using function prototypes in code [message #175044 is a reply to message #175036] Fri, 05 August 2011 12:52 Go to previous message
Umberto Salsi is currently offline  Umberto Salsi
Messages: 2
Registered: August 2011
Karma:
Junior Member
webber <frank(dot)thynne(at)gmail(dot)com> wrote:

> In the interest of clarity and maintainability I would like to be able
> to write code that makes it clear what kind of arguments a function
> expects and what it returns.
>
> This is what I tried:
>
> function integer int_func(string $s) {
> // does something like, say, converting "five" to 5
> }
>


I suggest one of these

- phpDocumetor (www.phpdoc.org) generates docs from DocBlocks.

- Doxygen (www.doxygen.org) generates docs from DocBlocks.

- PHPLint (www.icosaedro/phplint) generates docs from DocBlocks, but
it is mainly a static source analyzer that implements it own parser for
the PHP language and checks if the declarations actually correspond to
the usage in the code performing a strict type check (numbers go with
numbers, strings with strings and so on). This latter is mine :-)

All these tools support a specially formatted comment named "DocBlock",
with which the function above becomes:


/**
* Short description here. Longer description follows in the
* next sentences.
* @param string $s Name of something, or similar.
* @return int Some value that tells something so and so.
*/
function int_func($s){...}



Regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: From city to lati and long
Next Topic: Regarding Session reset
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 00:31:06 GMT 2024

Total time taken to generate the page: 0.04535 seconds