minor #29727 [Lock] Pedantic improvements for lock (greg0ire)

This PR was squashed before being merged into the 3.4 branch (closes #29727).

Discussion
----------

[Lock] Pedantic improvements for lock

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Yes, this PR is just about comments, I hope it's ok, I just stumbled into this issues while trying to figure out the bug fixed by #29726

Commits
-------

dc568c0ba1 [Lock] Pedantic improvements for lock
This commit is contained in:
Fabien Potencier 2019-01-01 18:28:56 +01:00
commit 63ef2f5179
3 changed files with 8 additions and 7 deletions

View File

@ -43,7 +43,7 @@ interface StoreInterface
* *
* If the store does not support this feature it should throw a NotSupportedException. * If the store does not support this feature it should throw a NotSupportedException.
* *
* @param float $ttl amount of second to keep the lock in the store * @param float $ttl amount of seconds to keep the lock in the store
* *
* @throws LockConflictedException * @throws LockConflictedException
* @throws NotSupportedException * @throws NotSupportedException

View File

@ -36,7 +36,7 @@ trait BlockingStoreTestTrait
*/ */
public function testBlockingLocks() public function testBlockingLocks()
{ {
// Amount a microsecond used to order async actions // Amount of microseconds we should wait without slowing things down too much
$clockDelay = 50000; $clockDelay = 50000;
if (\PHP_VERSION_ID < 50600 || \defined('HHVM_VERSION_ID')) { if (\PHP_VERSION_ID < 50600 || \defined('HHVM_VERSION_ID')) {

View File

@ -20,7 +20,9 @@ use Symfony\Component\Lock\StoreInterface;
trait ExpiringStoreTestTrait trait ExpiringStoreTestTrait
{ {
/** /**
* Amount a microsecond used to order async actions. * Amount of microseconds used as a delay to test expiration. Should be
* small enough not to slow the test suite too much, and high enough not to
* fail because of race conditions.
* *
* @return int * @return int
*/ */
@ -34,7 +36,7 @@ trait ExpiringStoreTestTrait
/** /**
* Tests the store automatically delete the key when it expire. * Tests the store automatically delete the key when it expire.
* *
* This test is time sensible: the $clockDelay could be adjust. * This test is time-sensitive: the $clockDelay could be adjusted.
*/ */
public function testExpiration() public function testExpiration()
{ {
@ -71,14 +73,13 @@ trait ExpiringStoreTestTrait
/** /**
* Tests the refresh can push the limits to the expiration. * Tests the refresh can push the limits to the expiration.
* *
* This test is time sensible: the $clockDelay could be adjust. * This test is time-sensitive: the $clockDelay could be adjusted.
*/ */
public function testRefreshLock() public function testRefreshLock()
{ {
// Amount a microsecond used to order async actions // Amount of microseconds we should wait without slowing things down too much
$clockDelay = $this->getClockDelay(); $clockDelay = $this->getClockDelay();
// Amount a microsecond used to order async actions
$key = new Key(uniqid(__METHOD__, true)); $key = new Key(uniqid(__METHOD__, true));
/** @var StoreInterface $store */ /** @var StoreInterface $store */