for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace SimpleSAML\XML\Assert;
use InvalidArgumentException;
/**
* @package simplesamlphp/xml-common
*/
trait LongTrait
{
/** @var string */
private static string $long_regex = '/^(((-[0]*([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[1-8][0-9]{7}|9[0-8][0-9]{6}|99[0-8][0-9]{5}|999[0-8][0-9]{4}|9999[0-8][0-9]{3}|99999[0-8][0-9]{2}|999999[0-8][0-9]|9999999[0-9]|[1-8][0-9]{8}|9[0-8][0-9]{7}|99[0-8][0-9]{6}|999[0-8][0-9]{5}|9999[0-8][0-9]{4}|99999[0-8][0-9]{3}|999999[0-8][0-9]{2}|9999999[0-8][0-9]|99999999[0-9]|[1-8][0-9]{9}|9[0-8][0-9]{8}|99[0-8][0-9]{7}|999[0-8][0-9]{6}|9999[0-8][0-9]{5}|99999[0-8][0-9]{4}|999999[0-8][0-9]{3}|9999999[0-8][0-9]{2}|99999999[0-8][0-9]|999999999[0-9]|[1-8][0-9]{10}|9[0-8][0-9]{9}|99[0-8][0-9]{8}|999[0-8][0-9]{7}|9999[0-8][0-9]{6}|99999[0-8][0-9]{5}|999999[0-8][0-9]{4}|9999999[0-8][0-9]{3}|99999999[0-8][0-9]{2}|999999999[0-8][0-9]|9999999999[0-9]|[1-8][0-9]{11}|9[0-8][0-9]{10}|99[0-8][0-9]{9}|999[0-8][0-9]{8}|9999[0-8][0-9]{7}|99999[0-8][0-9]{6}|999999[0-8][0-9]{5}|9999999[0-8][0-9]{4}|99999999[0-8][0-9]{3}|999999999[0-8][0-9]{2}|9999999999[0-8][0-9]|99999999999[0-9]|[1-8][0-9]{12}|9[0-8][0-9]{11}|99[0-8][0-9]{10}|999[0-8][0-9]{9}|9999[0-8][0-9]{8}|99999[0-8][0-9]{7}|999999[0-8][0-9]{6}|9999999[0-8][0-9]{5}|99999999[0-8][0-9]{4}|999999999[0-8][0-9]{3}|9999999999[0-8][0-9]{2}|99999999999[0-8][0-9]|999999999999[0-9]|[1-8][0-9]{13}|9[0-8][0-9]{12}|99[0-8][0-9]{11}|999[0-8][0-9]{10}|9999[0-8][0-9]{9}|99999[0-8][0-9]{8}|999999[0-8][0-9]{7}|9999999[0-8][0-9]{6}|99999999[0-8][0-9]{5}|999999999[0-8][0-9]{4}|9999999999[0-8][0-9]{3}|99999999999[0-8][0-9]{2}|999999999999[0-8][0-9]|9999999999999[0-9]|[1-8][0-9]{14}|9[0-8][0-9]{13}|99[0-8][0-9]{12}|999[0-8][0-9]{11}|9999[0-8][0-9]{10}|99999[0-8][0-9]{9}|999999[0-8][0-9]{8}|9999999[0-8][0-9]{7}|99999999[0-8][0-9]{6}|999999999[0-8][0-9]{5}|9999999999[0-8][0-9]{4}|99999999999[0-8][0-9]{3}|999999999999[0-8][0-9]{2}|9999999999999[0-8][0-9]|99999999999999[0-9]|[1-8][0-9]{15}|9[0-8][0-9]{14}|99[0-8][0-9]{13}|999[0-8][0-9]{12}|9999[0-8][0-9]{11}|99999[0-8][0-9]{10}|999999[0-8][0-9]{9}|9999999[0-8][0-9]{8}|99999999[0-8][0-9]{7}|999999999[0-8][0-9]{6}|9999999999[0-8][0-9]{5}|99999999999[0-8][0-9]{4}|999999999999[0-8][0-9]{3}|9999999999999[0-8][0-9]{2}|99999999999999[0-8][0-9]|999999999999999[0-9]|[1-8][0-9]{16}|9[0-8][0-9]{15}|99[0-8][0-9]{14}|999[0-8][0-9]{13}|9999[0-8][0-9]{12}|99999[0-8][0-9]{11}|999999[0-8][0-9]{10}|9999999[0-8][0-9]{9}|99999999[0-8][0-9]{8}|999999999[0-8][0-9]{7}|9999999999[0-8][0-9]{6}|99999999999[0-8][0-9]{5}|999999999999[0-8][0-9]{4}|9999999999999[0-8][0-9]{3}|99999999999999[0-8][0-9]{2}|999999999999999[0-8][0-9]|9999999999999999[0-9]|[1-8][0-9]{17}|9[0-8][0-9]{16}|99[0-8][0-9]{15}|999[0-8][0-9]{14}|9999[0-8][0-9]{13}|99999[0-8][0-9]{12}|999999[0-8][0-9]{11}|9999999[0-8][0-9]{10}|99999999[0-8][0-9]{9}|999999999[0-8][0-9]{8}|9999999999[0-8][0-9]{7}|99999999999[0-8][0-9]{6}|999999999999[0-8][0-9]{5}|9999999999999[0-8][0-9]{4}|99999999999999[0-8][0-9]{3}|999999999999999[0-8][0-9]{2}|9999999999999999[0-8][0-9]|99999999999999999[0-9]|[1-8][0-9]{18}|9[01][0-9]{17}|92[01][0-9]{16}|922[0-2][0-9]{15}|9223[0-2][0-9]{14}|92233[0-6][0-9]{13}|922337[01][0-9]{12}|92233720[0-2][0-9]{10}|922337203[0-5][0-9]{9}|9223372036[0-7][0-9]{8}|92233720368[0-4][0-9]{7}|922337203685[0-3][0-9]{6}|9223372036854[0-6][0-9]{5}|92233720368547[0-6][0-9]{4}|922337203685477[0-4][0-9]{3}|9223372036854775[0-7][0-9]{2}|922337203685477580[0-8]))|([+]?[0]*([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[1-8][0-9]{7}|9[0-8][0-9]{6}|99[0-8][0-9]{5}|999[0-8][0-9]{4}|9999[0-8][0-9]{3}|99999[0-8][0-9]{2}|999999[0-8][0-9]|9999999[0-9]|[1-8][0-9]{8}|9[0-8][0-9]{7}|99[0-8][0-9]{6}|999[0-8][0-9]{5}|9999[0-8][0-9]{4}|99999[0-8][0-9]{3}|999999[0-8][0-9]{2}|9999999[0-8][0-9]|99999999[0-9]|[1-8][0-9]{9}|9[0-8][0-9]{8}|99[0-8][0-9]{7}|999[0-8][0-9]{6}|9999[0-8][0-9]{5}|99999[0-8][0-9]{4}|999999[0-8][0-9]{3}|9999999[0-8][0-9]{2}|99999999[0-8][0-9]|999999999[0-9]|[1-8][0-9]{10}|9[0-8][0-9]{9}|99[0-8][0-9]{8}|999[0-8][0-9]{7}|9999[0-8][0-9]{6}|99999[0-8][0-9]{5}|999999[0-8][0-9]{4}|9999999[0-8][0-9]{3}|99999999[0-8][0-9]{2}|999999999[0-8][0-9]|9999999999[0-9]|[1-8][0-9]{11}|9[0-8][0-9]{10}|99[0-8][0-9]{9}|999[0-8][0-9]{8}|9999[0-8][0-9]{7}|99999[0-8][0-9]{6}|999999[0-8][0-9]{5}|9999999[0-8][0-9]{4}|99999999[0-8][0-9]{3}|999999999[0-8][0-9]{2}|9999999999[0-8][0-9]|99999999999[0-9]|[1-8][0-9]{12}|9[0-8][0-9]{11}|99[0-8][0-9]{10}|999[0-8][0-9]{9}|9999[0-8][0-9]{8}|99999[0-8][0-9]{7}|999999[0-8][0-9]{6}|9999999[0-8][0-9]{5}|99999999[0-8][0-9]{4}|999999999[0-8][0-9]{3}|9999999999[0-8][0-9]{2}|99999999999[0-8][0-9]|999999999999[0-9]|[1-8][0-9]{13}|9[0-8][0-9]{12}|99[0-8][0-9]{11}|999[0-8][0-9]{10}|9999[0-8][0-9]{9}|99999[0-8][0-9]{8}|999999[0-8][0-9]{7}|9999999[0-8][0-9]{6}|99999999[0-8][0-9]{5}|999999999[0-8][0-9]{4}|9999999999[0-8][0-9]{3}|99999999999[0-8][0-9]{2}|999999999999[0-8][0-9]|9999999999999[0-9]|[1-8][0-9]{14}|9[0-8][0-9]{13}|99[0-8][0-9]{12}|999[0-8][0-9]{11}|9999[0-8][0-9]{10}|99999[0-8][0-9]{9}|999999[0-8][0-9]{8}|9999999[0-8][0-9]{7}|99999999[0-8][0-9]{6}|999999999[0-8][0-9]{5}|9999999999[0-8][0-9]{4}|99999999999[0-8][0-9]{3}|999999999999[0-8][0-9]{2}|9999999999999[0-8][0-9]|99999999999999[0-9]|[1-8][0-9]{15}|9[0-8][0-9]{14}|99[0-8][0-9]{13}|999[0-8][0-9]{12}|9999[0-8][0-9]{11}|99999[0-8][0-9]{10}|999999[0-8][0-9]{9}|9999999[0-8][0-9]{8}|99999999[0-8][0-9]{7}|999999999[0-8][0-9]{6}|9999999999[0-8][0-9]{5}|99999999999[0-8][0-9]{4}|999999999999[0-8][0-9]{3}|9999999999999[0-8][0-9]{2}|99999999999999[0-8][0-9]|999999999999999[0-9]|[1-8][0-9]{16}|9[0-8][0-9]{15}|99[0-8][0-9]{14}|999[0-8][0-9]{13}|9999[0-8][0-9]{12}|99999[0-8][0-9]{11}|999999[0-8][0-9]{10}|9999999[0-8][0-9]{9}|99999999[0-8][0-9]{8}|999999999[0-8][0-9]{7}|9999999999[0-8][0-9]{6}|99999999999[0-8][0-9]{5}|999999999999[0-8][0-9]{4}|9999999999999[0-8][0-9]{3}|99999999999999[0-8][0-9]{2}|999999999999999[0-8][0-9]|9999999999999999[0-9]|[1-8][0-9]{17}|9[0-8][0-9]{16}|99[0-8][0-9]{15}|999[0-8][0-9]{14}|9999[0-8][0-9]{13}|99999[0-8][0-9]{12}|999999[0-8][0-9]{11}|9999999[0-8][0-9]{10}|99999999[0-8][0-9]{9}|999999999[0-8][0-9]{8}|9999999999[0-8][0-9]{7}|99999999999[0-8][0-9]{6}|999999999999[0-8][0-9]{5}|9999999999999[0-8][0-9]{4}|99999999999999[0-8][0-9]{3}|999999999999999[0-8][0-9]{2}|9999999999999999[0-8][0-9]|99999999999999999[0-9]|[1-8][0-9]{18}|9[01][0-9]{17}|92[01][0-9]{16}|922[0-2][0-9]{15}|9223[0-2][0-9]{14}|92233[0-6][0-9]{13}|922337[01][0-9]{12}|92233720[0-2][0-9]{10}|922337203[0-5][0-9]{9}|9223372036[0-7][0-9]{8}|92233720368[0-4][0-9]{7}|922337203685[0-3][0-9]{6}|9223372036854[0-6][0-9]{5}|92233720368547[0-6][0-9]{4}|922337203685477[0-4][0-9]{3}|9223372036854775[0-7][0-9]{2}|922337203685477580[0-7]))|0))$/D';
* @param string $value
* @param string $message
protected static function validLong(string $value, string $message = ''): void
parent::regex(
$value,
self::$long_regex,
$message ?: '%s is not a valid xs:long',
InvalidArgumentException::class,
);
}