承接 vixducis/phpstan-utilities 相关项目开发

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

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

vixducis/phpstan-utilities

最新稳定版本:1.1.2

Composer 安装命令:

composer require vixducis/phpstan-utilities

包简介

A collection of useful utilities to transform or create types.

README 文档

README

This is a collection of PHPStan utilities you can use to transform types.

Installation

composer require vixducis/phpstan-utilities

Afterwards, add the following section to your phpstan.neon configuration file:

includes:
- vendor/vixducis/phpstan-utilities/extension.neon

Utilities

This package provides several type transformation utilities for use with PHPStan. Each utility can be used as a generic type in your PHPDoc or PHPStan configuration.

ArrayValues

Sometimes, you'll have a template type that contains a template, but you still want to extract the values from it.

Usage:

/** @var ArrayValues<T> */

This utility extracts the value types from an array type T. If T is an array, it returns the type of its values. Otherwise, it returns an error type.

This differs from value-of: value-of<array{a:int,b:string}> will return int|string. ArrayValues<array{a:int,b:string}> will return array{int,string}.

UnwrapSingletonArray

This utility unwraps a singleton array type, i.e., if the type is an array containing exactly one element, it yields both the original array type and the value type as a union. Otherwise, it returns the original type.

Usage:

/** @var UnwrapSingletonArray<T> */
  • If T is an array of exactly one element, returns T|V (where V is the value type).
  • Otherwise, returns T.

UnionToIntersection

This utility converts a union type into an intersection type.

Usage:

/** @var UnionToIntersection<T> */

If T is a union type (e.g., A|B), UnionToIntersection<T> produces an intersection (e.g., A&B). If T is not a union, returns an error type.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固