【问题标题】:I need to use a splat operator within a PHP docblock and cannot figure out how to escape the character我需要在 PHP docblock 中使用 splat 运算符并且无法弄清楚如何转义字符
【发布时间】:2020-04-28 12:22:18
【问题描述】:

我正在使用代码接收并运行多组示例数据。 我正在发送多个接受标头,其中之一是"*/*"

所以示例代码是:

   /**
     * My description of the test
     *
     * GET a/path/i/am/testing
     *
     * @example ["*/*", 200]
     * @example ["application/json", 200]
     * @example ["text/html", 200]
     *
     */

我尝试过双引号内的单引号,我尝试过单引号内的双引号,我尝试过连接每个片段,我尝试过反斜杠,我尝试过 Unicode。 PHP 认为 splat 正在与 docblock 对话。我错过了什么?提前致谢!

【问题讨论】:

  • 你用反斜杠做了什么?像这样? @example ["*\/*", 200](顺便说一下,PHP 中的“splat 运算符”通常指的是 ... 运算符而不是星号)

标签: php escaping codeception splat docblocks


【解决方案1】:

尝试 {@*} 而不是 */

 * @example ["{@*}*", 200]
should be interpreted as
* @example ["*/*", 200]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-04
    • 1970-01-01
    • 1970-01-01
    • 2017-05-17
    • 1970-01-01
    • 2020-03-26
    • 2016-12-21
    相关资源
    最近更新 更多