HEX
Server: LiteSpeed
System: Linux atali.colombiahosting.com.co 5.14.0-570.12.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 13 06:11:55 EDT 2025 x86_64
User: coopserp (1713)
PHP: 8.2.29
Disabled: dl,exec,passthru,proc_open,proc_close,shell_exec,memory_limit,system,popen,curl_multi_exec,show_source,symlink,link,leak,listen,diskfreespace,tmpfile,ignore_user_abord,highlight_file,source,show_source,fpaththru,virtual,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setid,posix_times,posix_ttyname,posix_uname,proc_get_status,proc_nice,proc_terminate
Upload Files
File: //opt/cpanel/ea-wappspector/vendor/rector/rector/src/Validation/RectorAssert.php
<?php

declare (strict_types=1);
namespace Rector\Validation;

use Rector\Util\StringUtils;
use RectorPrefix202411\Webmozart\Assert\InvalidArgumentException;
/**
 * @see \Rector\Tests\Validation\RectorAssertTest
 */
final class RectorAssert
{
    /**
     * @see https://stackoverflow.com/a/12011255/1348344
     * @see https://regex101.com/r/PYQaPF/1
     * @var string
     */
    private const CLASS_NAME_REGEX = '#^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*$#';
    /**
     * @see https://stackoverflow.com/a/60470526/1348344
     * @see https://regex101.com/r/37aUWA/1
     *
     * @var string
     */
    private const NAKED_NAMESPACE_REGEX = '[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\\\]*[a-zA-Z0-9_\\x7f-\\xff]';
    /**
     * @see https://www.php.net/manual/en/language.variables.basics.php
     * @see https://regex101.com/r/hFw17T/1
     *
     * @var string
     */
    private const PROPERTY_NAME_REGEX = '#^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$#';
    /**
     * @see https://regex101.com/r/uh5B0S/2
     * @see https://www.php.net/manual/en/functions.user-defined.php
     * @see https://www.php.net/manual/en/language.constants.php
     *
     * @var string
     */
    private const METHOD_OR_CONSTANT_NAME_REGEX = '#^[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*$#';
    /**
     * @see https://regex101.com/r/uh5B0S/1
     * @see https://www.php.net/manual/en/functions.user-defined.php
     *
     * @var string
     */
    private const FUNCTION_NAME_REGEX = '#^(' . self::NAKED_NAMESPACE_REGEX . '\\\\)?([a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)$#';
    public static function constantName(string $name) : void
    {
        self::elementName($name, self::METHOD_OR_CONSTANT_NAME_REGEX, 'constant');
    }
    public static function className(string $name) : void
    {
        self::elementName($name, self::CLASS_NAME_REGEX, 'class');
    }
    public static function propertyName(string $name) : void
    {
        self::elementName($name, self::PROPERTY_NAME_REGEX, 'property');
    }
    public static function methodName(string $name) : void
    {
        self::elementName($name, self::METHOD_OR_CONSTANT_NAME_REGEX, 'method');
    }
    public static function functionName(string $name) : void
    {
        self::elementName($name, self::FUNCTION_NAME_REGEX, 'function');
    }
    /**
     * @api
     */
    public static function elementName(string $name, string $regex, string $elementType) : void
    {
        if (StringUtils::isMatch($name, $regex)) {
            return;
        }
        $errorMessage = \sprintf('"%s" is not a valid %s name', $name, $elementType);
        throw new InvalidArgumentException($errorMessage);
    }
}