protected static function matchImpl()

in src/expression/StaticPrefixUnaryExpression.hack [18:39]


  protected static function matchImpl(
    this::TNode $node,
  ): ?Expression<mixed> {
    $value = StaticExpression::match($node->getOperand());
    if ($value === null) {
      return null;
    }
    $value = $value->getValue();

    $op = $node->getOperator();
    if ($op is HHAST\ExclamationToken) {
      return new self(!(bool)$value);
    }
    if ($op is HHAST\PlusToken) {
      return new self((int)$value);
    }
    if ($op is HHAST\MinusToken) {
      return new self(-(int)$value);
    }

    return null;
  }