ocramius/optional
最新稳定版本:1.0.0
Composer 安装命令:
composer require ocramius/optional
包简介
A port of java.util.Optional to PHP
关键字:
README 文档
README
This package is a PHP port of the java.util.Optional class in the
OpenJDK libraries.
Currently maintained by Niklas Schöllhorn, taken over 3rd March, 2019
You can find the API of java.lang.Optional in the
Java 8 API docs.
Installation
composer require ocramius/optional
Differences with the Java implementation
Because of PHP's current limitations, I had to rewrite some bits of the Java implementation as follows:
Optional#empty()is namedOptional#newEmpty(), becauseemptyis a reserved PHP keyword- type-safety is not ensured at any time: generics have simply been stripped from the
Optionalimplementation. This may change in future, but I don't plan to do it right now. Optional#toString()is namedOptional#__toString()in accordance to PHP magic methods namingConsumer,Predicate,FunctionandSupplierarguments are simplycallable, for simplicity and flexibility.
License
Since this library is a direct port of the OpenJDK sources, I have to keep the original license in place, which is GPLv2 + ClassPath exceptions.
统计信息
- 总下载量: 263
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2015-01-11