for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Base daft objects.
*
* @author SignpostMarv
*/
declare(strict_types=1);
namespace SignpostMarv\DaftObject;
class NestedTypeParanoia extends TypeParanoia
{
* @param mixed $needle
* @return int|null
public static function MaybeFoundInArray($needle, array $haystack)
* @var int|false
$out = array_search($needle, $haystack, true);
return is_int($out) ? $out : null;
}
* @param mixed $object
public static function ThrowIfNotNestedType(
$object,
int $argument,
string $class,
string $function,
string ...$types
) {
static::ThrowIfNotType(
$argument,
$class,
$function,
DaftNestedObject::class,
...$types
);
public static function ThrowIfNotWriteableNestedType(
DaftNestedWriteableObject::class,
* @param mixed $maybe
public static function ForceInt($maybe) : int
return is_int($maybe) ? $maybe : (int) $maybe;