Supported Versions: PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8
Compares two "PHP-standardized" version number strings
<?php version_compare(string $version1, string $version2, ?string $operator = null): int|bool
<?php                     $max = empty($matches[2]) ? '99.9' : $matches[2];



                    if (\version_compare($min, $max, '>')) {

                        \trigger_error(

                            "Invalid range in testVersion setting: '" . $testVersion . "'",

                            \E_USER_WARNING
<?php         $testVersion = $testVersion[1];



        if (\is_null($testVersion) === true

            || \version_compare($testVersion, $phpVersion) >= 0

        ) {

            return true;

        }
<?php         $testVersion = $testVersion[0];



        if (\is_null($testVersion) === false

            && \version_compare($testVersion, $phpVersion) <= 0

        ) {

            return true;

        }
<?php         if (\version_compare(\PHP_VERSION_ID, '50500', '<') === true

            && \version_compare(Helper::getVersion(), '3.1.0', '<') === true

        ) {

            $targets[] = \T_STRING;
<?php         if (\version_compare(\PHP_VERSION_ID, '50500', '<') === true

            && \version_compare(Helper::getVersion(), '3.1.0', '<') === true

        ) {

            $targets[] = \T_STRING;

        }
<?php             $targets[] = \T_STRING;

        }



        if (\version_compare(\PHP_VERSION_ID, '70399', '>')) {

            $targets[] = \T_OPEN_TAG;

        }
<?php     public function register()

    {

        if (\version_compare(\PHP_VERSION_ID, '70000', '<') === true) {


            $this->aspTags = (bool) \ini_get('asp_tags');

        }
<?php             \T_END_NOWDOC,

        ];



        if (\version_compare(\PHP_VERSION_ID, '70299', '>') === false) {


            $targets[] = \T_STRING;

        }
<?php         $trailingError     = 'Having code - other than a semi-colon or new line - after the closing marker of a heredoc/nowdoc is not supported in PHP 7.2 or earlier.';

        $trailingErrorCode = 'ClosingMarkerNoNewLine';



        if (\version_compare(\PHP_VERSION_ID, '70299', '>') === true) {
<?php         $error     = 'The body of a heredoc/nowdoc can not contain the heredoc/nowdoc closing marker as text at the start of a line since PHP 7.3.';

        $errorCode = 'ClosingMarkerNoNewLine';



        if (\version_compare(\PHP_VERSION_ID, '70299', '>') === true) {

            $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($stackPtr + 1), null, true, null, true);

            if ($nextNonWhitespace === false

                || $tokens[$nextNonWhitespace]['code'] === \T_SEMICOLON
<?php         if (\version_compare(Helper::getVersion(), '3.4.0', '<') === true) {

            $tokens[] = \T_STRING_CAST;

            $tokens[] = \T_CONSTANT_ENCAPSED_STRING;

        }
<?php         $phpcsVersion = Helper::getVersion();




        if (\version_compare($phpcsVersion, self::MIN_RECOMMENDED_VERSION, '>=')) {

            $this->examine = false;

            return ($phpcsFile->numTokens + 1);

        }
<?php             return ($phpcsFile->numTokens + 1);

        }



        if (\version_compare($phpcsVersion, self::MIN_SUPPORTED_VERSION, '<')) {

            $isError      = true;

            $message      = 'IMPORTANT: Please be advised that the minimum PHP_CodeSniffer version the PHPCompatibility standard supports is %s. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation. The recommended version of PHP_CodeSniffer for PHPCompatibility is %s or higher.';

            $errorCode    = 'Unsupported_' . $this->stringToErrorCode(self::MIN_SUPPORTED_VERSION);
<?php         $phpVersion = \phpversion();




        if (\version_compare($phpVersion, self::MIN_RECOMMENDED_VERSION, '>=')) {

            $this->examine = false;

            return ($phpcsFile->numTokens + 1);

        }
<?php             return ($phpcsFile->numTokens + 1);

        }



        if (\version_compare($phpVersion, self::MIN_SUPPORTED_VERSION, '<')) {

            $isError      = true;

            $message      = 'IMPORTANT: Please be advised that the minimum PHP version the PHPCompatibility standard supports is %s. You are currently using PHP %s. Please upgrade your PHP installation. The recommended version of PHP for PHPCompatibility is %s or higher.';

            $errorCode    = 'Unsupported_' . $this->stringToErrorCode(self::MIN_SUPPORTED_VERSION);