siestacat / php-array-cast
强制转换一维数组
1.0.2
2023-11-17 23:24 UTC
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: ^10.2.2
README
安装
composer require siestacat/php-array-cast
用法
use Siestacat\PhpArrayCast\Cast;
Cast::class(range(0,9), \stdClass::class); //Will throw error
Cast::class(array_fill(0, 9, new \stdClass), \stdClass::class); //No error
Cast::type(range(0,9), 'string'); //Will throw error
Cast::class(array_fill(0, 9, 'banana'), 'string'); //No error
测试
git clone https://github.com/SiestaCat/php-array-cast.git
cd php-array-cast
composer install
composer run-script test