PHP Classes

doc before class bug

Recommend this page to a friend!

      PHP WSDL Generator  >  All threads  >  doc before class bug  >  (Un) Subscribe thread alerts  
Subject:doc before class bug
Summary:Documentation before class breakes it
Messages:8
Author:Viktor Söderqvist
Date:2008-04-02 09:52:23
Update:2013-10-15 20:48:52
 

  1. doc before class bug   Reply   Report abuse  
Picture of Viktor Söderqvist Viktor Söderqvist - 2008-04-02 09:52:23
Documentation before the class will make the generated wsdl almost empty.

/** Some documentation before the class */
class example {
// ....
}

The wsdl generated from this class will contain only the empty tags <definitions><service></service></definitions>

When I remove the initial documentation and replace it by ordinary comments, it all works again.

  2. Re: doc before class bug   Reply   Report abuse  
Picture of Protung Dragos Protung Dragos - 2008-04-02 12:04:40 - In reply to message 1 from Viktor Söderqvist
Can you post or email me the classes you tested on ?
I've put the comment before the class and on my test classes works perfectly.

And what do you mean by "ordinary comments" ?

  3. Re: doc before class bug   Reply   Report abuse  
Picture of Lars Gyrup Brink Nielsen Lars Gyrup Brink Nielsen - 2013-09-25 10:03:21 - In reply to message 2 from Protung Dragos
The still problem still persists. If I have

-----
/**
* This is a dummy class for demonstration purposes
*/
class Foo
{
// Body
}
-----

it will not display methods of that class.

However, if I place a _namespace_ or _use_ clause before the DocBlock, the WSDL is generated as supposed to:

-----
namespace Bar;

/**
* This is a dummy class for demonstration purposes
*/

use Bar\Baz;

class Foo
{
// Body
}
-----

  4. Re: doc before class bug   Reply   Report abuse  
Picture of Protung Dragos Protung Dragos - 2013-10-11 17:11:31 - In reply to message 3 from Lars Gyrup Brink Nielsen
Get the latest version.
It's still in beta as there are not enough tests and examples, but I've been using it for a long time on production without a problem. I plan on adding more tests soon.

  5. Re: doc before class bug   Reply   Report abuse  
Picture of Lars Gyrup Brink Nielsen Lars Gyrup Brink Nielsen - 2013-10-14 06:23:41 - In reply to message 3 from Lars Gyrup Brink Nielsen
I meant a namespace and/or use clause AFTER the DocBlock :-) However, it seems that the problem doesn't seem to persist in all cases. If you are still using v1.x of this package, this might be a bug fix for you.

  6. Re: doc before class bug   Reply   Report abuse  
Picture of Protung Dragos Protung Dragos - 2013-10-14 07:34:44 - In reply to message 5 from Lars Gyrup Brink Nielsen
I understand now what you mean.
But this is not a bug, it's designed to work like that. This is because you can have comments in arbitrary places and there is no way to say that a particular comment is for a certain piece of code. You have to put the comments before the class.

  7. Re: doc before class bug   Reply   Report abuse  
Picture of Lars Gyrup Brink Nielsen Lars Gyrup Brink Nielsen - 2013-10-15 17:56:21 - In reply to message 6 from Protung Dragos
I usually put the comment right before the class description/header. However, I experienced some issues where I had to put e.g. _use Bar\Baz;_ between the class comment and the class description for it to generate the WSDL for that class.

Instead of
------------------------
namespace Bar

use Bar\Baz;

/**
* Foo class comment
*
* @author Lars
*/
class Foo
{
// Class body
}
------------------------

I had to move the comment up before the use clause like this:
------------------------
namespace Bar

/**
* Foo class comment
*
* @author Lars
*/

use Bar\Baz;

class Foo
{
// Class body
}
------------------------

  8. Re: doc before class bug   Reply   Report abuse  
Picture of Protung Dragos Protung Dragos - 2013-10-15 20:48:52 - In reply to message 7 from Lars Gyrup Brink Nielsen
Are you using the latest version ?
Could you write the integration test ?