init
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Some;
|
||||
|
||||
if (!function_exists('some')) {
|
||||
/**
|
||||
* @template T
|
||||
* @param T $value
|
||||
* @return Some<T>
|
||||
*/
|
||||
function some(mixed $value): Some
|
||||
{
|
||||
return new Some($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('none')) {
|
||||
function none(): None
|
||||
{
|
||||
return None::create();
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('toArray')) {
|
||||
function toArray(mixed $data): array
|
||||
{
|
||||
return \json_decode(\json_encode($data), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user