承接 haeckel/generics 相关项目开发

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

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

haeckel/generics

最新稳定版本:0.2.0

Composer 安装命令:

composer require haeckel/generics

包简介

Support for generic classes

README 文档

README

codecov ci Static Badge Static Badge Packagist License

haeckel/php-generics

haeckel/generics is a php Library for dealing with generic data structures. It aims for simplicity and being fully typesafe at runtime, so unit tests will make errors visible. Uses PHPStan's generic syntax for type documentation and static analysis.

Features

  • Types classes that denote php types for usage, where the native type system cannot be used, e.g. in terms of generics for parameters, because they violate the LSP rules. All type classes can be used to type check at runtime and you can get a string representation that matches the native php notation.
  • Filters the filter interfaces enforce callable signatures, by specifying the __invoke() method signature. These are used to filter generic data structures (e.g. find a subset of a collection) or to remove specific elements.
  • Struct contains standard data structures that support generic usage. There is always an interface and an abstract base class for these structures.

PHPStan

This project uses the max level of PHPStan and phpstan/phpstan-strict-rules to ensure the code follows a good standard. Here are the places, where @phpstan-ignore is used to step around a check (cf. unsafe mode in rust or go, where you can opt out of compiler guarantees).

Installation

composer require haeckel/generics

Usage

See the tests Folder for runnable implementations.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Source Code

Support

Let us know if you have issues.

Issue Tracker

License

LGPL-3.0-or-later

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2025-09-29