承接 componenta/default-value 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

componenta/default-value

Composer 安装命令:

composer require componenta/default-value

包简介

Default value sentinel for Componenta packages

README 文档

README

Single marker enum for distinguishing an omitted default value from an explicit null.

Use it in APIs where null is a meaningful caller-provided value and cannot also mean "argument was not provided".

Installation

composer require componenta/default-value

Related Packages

Package Why it matters here
componenta/di Uses DefaultValue::None in attributes where null can be an explicit default.
componenta/config Useful for APIs that distinguish an omitted fallback from a null fallback.

Usage

use Componenta\Stdlib\DefaultValue;

function readOption(string $name, mixed $default = DefaultValue::None): mixed
{
    if ($default === DefaultValue::None) {
        return loadRequiredOption($name);
    }

    return loadOptionalOption($name, $default);
}

Passing null remains explicit:

readOption('cache.ttl', null); // default is intentionally null

Contract

DefaultValue::None means no default value was provided. It is intentionally a marker, not a container and not a replacement for Option/Maybe value objects.

When To Use

Use this package for function arguments, resolver APIs, config helpers, and factories that need to preserve the difference between:

  • no fallback was given
  • fallback was given and the fallback is null

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固