for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* It's free open-source software released under the MIT License.
*
* @author Anatoly Nekhay <[email protected]>
* @copyright Copyright (c) 2018, Anatoly Nekhay
* @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
* @link https://github.com/sunrise-php/http-router
*/
declare(strict_types=1);
namespace Sunrise\Http\Router\OpenApi;
use ReflectionNamedType;
use ReflectionType;
* @since 3.0.0
final class TypeFactory
{
public static function mixedPhpType(): Type
return new Type(Type::PHP_TYPE_NAME_MIXED, allowsNull: true);
}
public static function fromPhpTypeReflection(?ReflectionType $phpTypeReflection): Type
if ($phpTypeReflection === null) {
return self::mixedPhpType();
if ($phpTypeReflection instanceof ReflectionNamedType) {
return new Type(
$phpTypeReflection->getName(),
$phpTypeReflection->allowsNull(),
);
(string) $phpTypeReflection,