diff --git a/composer.json b/composer.json index 530ad49..4367dc4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^10.1", "phpmd/phpmd": "^2.13", - "squizlabs/php_codesniffer": "^3.7" + "squizlabs/php_codesniffer": "^4.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index f9abae1..6a893d4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8884c4422b28535b685064878fd2d229", + "content-hash": "68a55eb49612b9a53dde693c60aedcda", "packages": [ { "name": "phpgt/promise", @@ -2125,26 +2125,31 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.6", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91" + "reference": "bbdc3d0532623e21838b7041a4364383a8126f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/4c378e1a528ea066890fc2397cbdd2f94eb2fc91", - "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/bbdc3d0532623e21838b7041a4364383a8126f96", + "reference": "bbdc3d0532623e21838b7041a4364383a8126f96", "shasum": "" }, "require": { + "ext-libxml": "*", "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.4.0" + "php": ">=7.2.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + "phpunit/phpunit": "^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31" + }, + "suggest": { + "ext-iconv": "For accurate character length calculation when the checked files contain multi-byte characters.", + "ext-pcntl": "For parallel processing support via the --parallel CLI option." }, "bin": [ "bin/phpcbf", @@ -2169,7 +2174,7 @@ "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.", "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", @@ -2200,7 +2205,7 @@ "type": "thanks_dev" } ], - "time": "2026-08-06T00:17:32+00:00" + "time": "2026-08-06T02:45:27+00:00" }, { "name": "symfony/config", diff --git a/test/phpunit/Timer/IndividualTimerTest.php b/test/phpunit/Timer/IndividualTimerTest.php index be9e254..9d8cec4 100644 --- a/test/phpunit/Timer/IndividualTimerTest.php +++ b/test/phpunit/Timer/IndividualTimerTest.php @@ -6,24 +6,19 @@ class IndividualTimerTest extends TestCase { public function testConstructWithFutureTime() { - $epoch = microtime(true); - $epochPlus5s = $epoch + 5; + $before = microtime(true) + 5; $sut = new IndividualTimer(5); - self::assertEquals( -// The timer must be scheduled within one hundredth of a second of the expectation: - round($epochPlus5s, 2), - round($sut->getNextRunTime(), 2) - ); + $after = microtime(true) + 5; + self::assertGreaterThanOrEqual($before, $sut->getNextRunTime()); + self::assertLessThanOrEqual($after, $sut->getNextRunTime()); } public function testConstructWithPastTime() { - $epoch = microtime(true); - $epochMinus5s = $epoch - 5; + $before = microtime(true) - 5; $sut = new IndividualTimer(-5); - self::assertEquals( - round($epochMinus5s, 2), - round($sut->getNextRunTime(), 2) - ); + $after = microtime(true) - 5; + self::assertGreaterThanOrEqual($before, $sut->getNextRunTime()); + self::assertLessThanOrEqual($after, $sut->getNextRunTime()); } public function testTickWithFutureTime() {