private static function mergeConstantPair()

in src/api-gen/DataMerger.php [196:221]


  private static function mergeConstantPair(
    ScannedConstant $a,
    ScannedDefinition $b,
  ): ScannedConstant {
    $b = $b as ScannedConstant;

    $value = $a->getValue();
    if ($value->hasStaticValue()) {
      $v = $value->getStaticValue();
      if ($v === null || $v === '' || $v === 0 || $v === 0.0) {
        $value = $b->getValue();
      }
    }

    return new ScannedConstant(
      $a->getASTx(),
      self::mergeNames($a->getName(), $b->getName()),
      $a->getContext(),
      self::mergeDocComments($a->getDocComment(), $b->getDocComment()),
      $value,
      self::mergeTypehintPair($a->getTypehint(), $b->getTypehint()),
      ($a->isAbstract() || $b->isAbstract())
        ? AbstractnessToken::IS_ABSTRACT
        : AbstractnessToken::NOT_ABSTRACT,
    );
  }