php-stubs
php-stubs copied to clipboard
Fix for stomp parameter lists
The code generates the stub with bad parameter list because of the OOP and functional style documentation and duplicates all parameter.
Did you manually update these files, or did you use the generate
command?
Updated manually because the generator takes the argument list from OOP and procedural description from the docs. For example: readFrame has two approach
OOP: public stompframe Stomp::readFrame ([ string $class_name = "stompFrame" ] ) procedural: array stomp_read_frame ( resource $link )
and the generated code:
/**
* Reads the next frame
*
* @param string $class_name
* @param resource $link
*
* @return array
*/
public function readFrame($class_name = 'stompFrame', $link)
{
}
Ah, I thought so.
Unfortunately, if we do not fix the generator, your changes are lost the next time generate
is run.
I know. Maybe we can filter the parameter list. In the SVN the stomp doc has the following format:
<refsect1 role="description">
&reftitle.description;
<para>&style.oop; (method):</para>
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Stomp::send</methodname>
<methodparam><type>string</type><parameter>destination</parameter></methodparam>
<methodparam><type>mixed</type><parameter>msg</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>headers</parameter></methodparam>
</methodsynopsis>
<para>&style.procedural;:</para>
<methodsynopsis>
<type>bool</type><methodname>stomp_send</methodname>
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
<methodparam><type>string</type><parameter>destination</parameter></methodparam>
<methodparam><type>mixed</type><parameter>msg</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>headers</parameter></methodparam>
</methodsynopsis>
<para>
Sends a message to the Message Broker.
</para>
</refsect1>
we only need the methodsynopsis right after "&style.oop; (method):" but i don't know if other documents maybe have two methodsynopsis block
The logic is in this class: https://github.com/schmittjoh/php-stubs/blob/master/src/PHPStubs/DocumentationParser.php
We should probably extract both the OO version and the function. It's probably just a matter of updating where the method/function name is taken from.
I just added a simple if to L#321 to check if method name is the referenced. But it only works for the OO version currently
Did you run generate
already?
Yes, on my dev server an it's ok for stomp but not tested on other classes.