update lock clucknut
All checks were successful
All checks were successful
This commit is contained in:
13
vendor/nette/schema/src/Schema/Helpers.php
vendored
13
vendor/nette/schema/src/Schema/Helpers.php
vendored
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the Nette Framework (https://nette.org)
|
||||
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nette\Schema;
|
||||
|
||||
use Nette;
|
||||
@@ -74,9 +72,9 @@ public static function getPropertyType(\ReflectionProperty|\ReflectionParameter
|
||||
|
||||
/**
|
||||
* Returns an annotation value.
|
||||
* @param \ReflectionProperty $ref
|
||||
* @param \ReflectionClass<object>|\ReflectionProperty $ref
|
||||
*/
|
||||
public static function parseAnnotation(\Reflector $ref, string $name): ?string
|
||||
public static function parseAnnotation(\ReflectionClass|\ReflectionProperty $ref, string $name): ?string
|
||||
{
|
||||
if (!Reflection::areCommentsAvailable()) {
|
||||
throw new Nette\InvalidStateException('You have to enable phpDoc comments in opcode cache.');
|
||||
@@ -121,12 +119,13 @@ public static function validateType(mixed $value, string $expected, Context $con
|
||||
}
|
||||
|
||||
|
||||
/** @param array{?float, ?float} $range */
|
||||
public static function validateRange(mixed $value, array $range, Context $context, string $types = ''): void
|
||||
{
|
||||
if (is_array($value) || is_string($value)) {
|
||||
[$length, $label] = is_array($value)
|
||||
? [count($value), 'items']
|
||||
: (in_array('unicode', explode('|', $types), true)
|
||||
: (in_array('unicode', explode('|', $types), strict: true)
|
||||
? [Nette\Utils\Strings::length($value), 'characters']
|
||||
: [strlen($value), 'bytes']);
|
||||
|
||||
@@ -147,6 +146,7 @@ public static function validateRange(mixed $value, array $range, Context $contex
|
||||
}
|
||||
|
||||
|
||||
/** @param array{?float, ?float} $range */
|
||||
public static function isInRange(mixed $value, array $range): bool
|
||||
{
|
||||
return ($range[0] === null || $value >= $range[0])
|
||||
@@ -166,6 +166,7 @@ public static function validatePattern(string $value, string $pattern, Context $
|
||||
}
|
||||
|
||||
|
||||
/** @return \Closure(mixed): mixed */
|
||||
public static function getCastStrategy(string $type): \Closure
|
||||
{
|
||||
if (Nette\Utils\Validators::isBuiltinType($type)) {
|
||||
|
||||
Reference in New Issue
Block a user