for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Copyright 2017 NanoSector
*
* You should have received a copy of the MIT license with the project.
* See the LICENSE file for more information.
*/
namespace ValidationClosures;
class Types
{
* @return \Closure
public static function string(): \Closure
return \Closure::fromCallable('is_string');
}
public static function int(): \Closure
return \Closure::fromCallable('is_int');
public static function float(): \Closure
return \Closure::fromCallable('is_float');
public static function boolean(): \Closure
return \Closure::fromCallable('is_bool');
public static function array(): \Closure
return \Closure::fromCallable('is_array');
public static function callable(): \Closure
return \Closure::fromCallable('is_callable');
public static function object(): \Closure
return \Closure::fromCallable('is_object');
public static function numeric(): \Closure
return \Closure::fromCallable('is_numeric');
* @param string $class
public static function instanceof(string $class): \Closure
return function ($value) use ($class)
return $value instanceof $class;
};