wp-hookdoc icon indicating copy to clipboard operation
wp-hookdoc copied to clipboard

Parsing fails when referencing namespaced parameters

Open zackkatz opened this issue 4 years ago • 1 comments

When referencing namespaced objects, instead of generating a row for the parameter, the table has an empty row:

I tried a bunch of things but I'm afraid none work:

  • {\\GV\\Template_Context}
  • {\GV\Template_Context}
  • {%5GV%5Template_Context}

Then these work, but they show the quotes, which I don't want:

  • {'\GV\Template_Context'}
  • {"\GV\Template_Context"}

Here's an example docblock:

/**
 * Modify the reserved embed slugs that trigger a warning.
 *
 * @hook gravityview/rewrite/reserved_slugs
 * @since 2.5
 *
 * @param {array} $reserved_slugs An array of strings, reserved slugs.
 * @param {\GV\Template_Context} $gravityview The context.
 *
 * @returns {array}
 */

I understand that you're simulating @class by replacing @hook with @class and that JS doesn't have that PHP namespace notation, but I'd appreciate guidance!

zackkatz avatar Apr 06 '21 17:04 zackkatz

Hey!

Thanks for your issue. Yeah, this is a known issue. But I haven't found the time to look at it in more detail yet. Currently, I can also unfortunately promise no date because I have not yet needed this.

As a temporary workaround you can do something like this:

/**
 * Modify the reserved embed slugs that trigger a warning.
 *
 * @hook gravityview/rewrite/reserved_slugs
 * @since 2.5
 *
 * @param {array} $reserved_slugs An array of strings, reserved slugs.
 * @param {Template_Context} $gravityview The context. (`\GV\Template_Context`)
 *
 * @returns {array}
 */

PRs welcome 😊

matzeeable avatar Apr 12 '21 08:04 matzeeable