Is phpdoc block boundary syntax strict?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    Is phpdoc block boundary syntax strict?

    Nobody I know actually uses phpdoc, but some of the staff where I work use IDEs that can parse phpdoc blocks, so I try to be accommodating. Plus I might just use it someday if I have some time to kill. In the meantime...

    I'm curious if phpdoc block boundaries are 'strict'. In other words, I've only ever heard of phpdoc blocks formatted like this:

    [CODE=php]
    /**
    *
    * ... doc content goes here ...
    *
    */
    [/code]

    But what if I did this:

    [code=php]
    /*************** *
    **
    ** ... more doc content ...
    */
    [/code]

    Or this:

    [code=php]
    /*************** *
    //
    // ... and so forth ...
    */
    [/code]

    Each comment block style has a specific meaning in my code, so I don't really want to cramp my style to make phpdoc happy.

    Thanks for your time.
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    I am not sure about how strict phpdoc is, however, I do know that the Zend IDE uses phpdoc to give function descriptions and mouseover hints. What you might want to try is downloading the free trial of Zend, and loading up one of your scripts. Then, begin typing the name of a function, and when you get the pop-up, see if everything is displayed correctly. Your other option is to sift through the phpdoc documentation (boy there better be some), or send them a friendly email.

    Originally posted by pbmods
    Nobody I know actually uses phpdoc, but some of the staff where I work use IDEs that can parse phpdoc blocks, so I try to be accommodating. Plus I might just use it someday if I have some time to kill. In the meantime...

    I'm curious if phpdoc block boundaries are 'strict'. In other words, I've only ever heard of phpdoc blocks formatted like this:

    [CODE=php]
    /**
    *
    * ... doc content goes here ...
    *
    */
    [/code]

    But what if I did this:

    [code=php]
    /*************** *
    **
    ** ... more doc content ...
    */
    [/code]

    Or this:

    [code=php]
    /*************** *
    //
    // ... and so forth ...
    */
    [/code]

    Each comment block style has a specific meaning in my code, so I don't really want to cramp my style to make phpdoc happy.

    Thanks for your time.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      After sifting a little deeper through phpdoc's documentation (indeed!), I came across this:

      Originally posted by phpdoc docs
      Any line within a DocBlock that doesn't begin with a * will be ignored.
      Ok. So that's half of it.

      And here's the line above it:

      Originally posted by phpdoc docs
      A DocBlock is an extended C++-style PHP comment that begins with "/**" and has an "*" at the beginning of every line. DocBlocks precede the element they are documenting.
      Though it didn't specifically say otherwise, my guess is that if I wanted phpdoc functionality, I'd be stuck with the standard phpdoc format. Phoo.

      Although it looks like I could make the last line any format that I wanted :P

      Code:
      /**
      *
      *	A beautiful, relaxing sunset.
      *
      *	You are on a warm, sandy beach.  The sky is turning a most absolutely
      *		gorgeous shade of purple as the sun slowly sinks into the horizon across
      *		the crashing waves.
      *
      *	You see a note.
      *
      *	@exits north, south
      *
      
                  ^^                   @@@@@@@@@
             ^^       ^^            @@@@@@@@@@@@@@@
                                  @@@@@@@@@@@@@@@@@@              ^^
                                 @@@@@@@@@@@@@@@@@@@@
       ~~~~ ~~ ~~~~~ ~~~~~~~~ ~~ &&&&&&&&&&&&&&&&&&&& ~~~~~~~ ~~~~~~~~~~~ ~~~
       ~         ~~   ~  ~       ~~~~~~~~~~~~~~~~~~~~ ~       ~~     ~~ ~
         ~      ~~      ~~ ~~ ~~  ~~~~~~~~~~~~~ ~~~~  ~     ~~~    ~ ~~~  ~ ~~
         ~  ~~     ~         ~      ~~~~~~  ~~ ~~~       ~~ ~ ~~  ~~ ~
       ~  ~       ~ ~      ~           ~~ ~~~~~~  ~      ~~  ~             ~~
             ~             ~        ~      ~      ~~   ~             ~
      */
      [EDIT: ASCII art borrowed from chris.com]

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Originally posted by pbmods
        Although it looks like I could make the last line any format that I wanted :P

        Code:
        /**
        *
        *	A beautiful, relaxing sunset.
        *
        *	You are on a warm, sandy beach.  The sky is turning a most absolutely
        *		gorgeous shade of purple as the sun slowly sinks into the horizon across
        *		the crashing waves.
        *
        *	You see a note.
        *
        *	@exits north, south
        *
        
                    ^^                   @@@@@@@@@
               ^^       ^^            @@@@@@@@@@@@@@@
                                    @@@@@@@@@@@@@@@@@@              ^^
                                   @@@@@@@@@@@@@@@@@@@@
         ~~~~ ~~ ~~~~~ ~~~~~~~~ ~~ &&&&&&&&&&&&&&&&&&&& ~~~~~~~ ~~~~~~~~~~~ ~~~
         ~         ~~   ~  ~       ~~~~~~~~~~~~~~~~~~~~ ~       ~~     ~~ ~
           ~      ~~      ~~ ~~ ~~  ~~~~~~~~~~~~~ ~~~~  ~     ~~~    ~ ~~~  ~ ~~
           ~  ~~     ~         ~      ~~~~~~  ~~ ~~~       ~~ ~ ~~  ~~ ~
         ~  ~       ~ ~      ~           ~~ ~~~~~~  ~      ~~  ~             ~~
               ~             ~        ~      ~      ~~   ~             ~
        */
        [EDIT: ASCII art borrowed from chris.com]
        I would be offended if you didn't!!

        P.S. MUD references make me warm and tingly.

        Comment

        Working...