jakub-frajt / typed-list
仅包含特定类型值的数组数据类型。在PHP中替换缺失的泛型类型。
0.2
2022-03-17 10:27 UTC
Requires
- php: ^8.1
Requires (Dev)
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-09-17 15:54:28 UTC
README
整数列表
use Frajt\IntegerList; // create IntegerList from array $integerList = new IntegerList([1, 2, 30]); // numeric string values are automatically casted to integer $integerList = new IntegerList(['1', 2, 30]); $integerList->getValues(); // get values as array [1, 2, 30] // support \Iterator interface foreach ($integerList as $intValue) { echo $intValue.PHP_EOL; }