【问题标题】:Does Psalm supprt @param-out for "this"?诗篇是否支持“这个”的@param-out?
【发布时间】:2020-10-07 15:16:20
【问题描述】:

是否可以在 Psalm 中使用 @param-out 来操作 thisself 中的幻像类型?示例:

/**
 * @template T
 */
class Foo
{
  /**
   * @param T $t
   */
  public function __construct($t)
  {
    $this->t = $t;
  }
  /**
   * WRONG:
   * @param-out Test<S> $this
   */
  public function test()
  {
    // Also this doesn't work:
    $this->t = new S();
  }
}

一个用例可能是例如幻像类型设置为OpenClosed 的文件类,调用$file-&gt;open();T 更改为Open

【问题讨论】:

    标签: php psalm-php


    【解决方案1】:

    没有。使用@param-self-out 有一个可能会或可能不会合并的拉取请求。

    【讨论】:

      猜你喜欢
      • 2015-10-25
      • 2021-12-14
      • 2021-04-11
      • 2020-02-15
      • 2021-11-21
      • 1970-01-01
      • 2012-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多