8000 minor #50090 [Lock] Add the void return type in Lock interfaces (stof) · symfony/symfony@805f207 · GitHub
[go: up one dir, main page]

Skip to content

Commit 805f207

Browse files
committed
minor #50090 [Lock] Add the void return type in Lock interfaces (stof)
This PR was merged into the 6.3 branch. Discussion ---------- [Lock] Add the void return type in Lock interfaces | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | n/a Contributes to #47551 Commits ------- 66dd1ad Add the void return type in Lock interfaces
2 parents 78a4d29 + 66dd1ad commit 805f207

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

src/Symfony/Component/Lock/BlockingSharedLockStoreInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ interface BlockingSharedLockStoreInterface extends SharedLockStoreInterface
2121
/**
2222
* Waits until a key becomes free for reading, then stores the resource.
2323
*
24+
* @return void
25+
*
2426
* @throws LockConflictedException
2527
*/
2628
public function waitAndSaveRead(Key $key);

src/Symfony/Component/Lock/BlockingStoreInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ interface BlockingStoreInterface extends PersistingStoreInterface
2121
/**
2222
* Waits until a key becomes free, then stores the resource.
2323
*
24+
* @return void
25+
*
2426
* @throws LockConflictedException
2527
*/
2628
public function waitAndSave(Key $key);

src/Symfony/Component/Lock/LockInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public function acquire(bool $blocking = false): bool;
3636
*
3737
* @param float|null $ttl Maximum expected lock duration in seconds
3838
*
39+
* @return void
40+
*
3941
* @throws LockConflictedException If the lock is acquired by someone else
4042
* @throws LockAcquiringException If the lock cannot be refreshed
4143
*/
@@ -49,6 +51,8 @@ public function isAcquired(): bool;
4951
/**
5052
* Release the lock.
5153
*
54+
* @return void
55+
*
5256
* @throws LockReleasingException If the lock cannot be released
5357
*/
5458
public function release();

src/Symfony/Component/Lock/PersistingStoreInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ interface PersistingStoreInterface
2323
/**
2424
* Stores the resource if it's not locked by someone else.
2525
*
26+
* @return void
27+
*
2628
* @throws LockAcquiringException
2729
* @throws LockConflictedException
2830
*/
@@ -31,6 +33,8 @@ public function save(Key $key);
3133
/**
3234
* Removes a resource from the storage.
3335
*
36+
* @return void
37+
*
3438
* @throws LockReleasingException
3539
*/
3640
public function delete(Key $key);
@@ -45,6 +49,8 @@ public function exists(Key $key): bool;
4549
*
4650
* @param float $ttl amount of seconds to keep the lock in the store
4751
*
52+
* @return void
53+
*
4854
* @throws LockConflictedException
4955
*/
5056
public function putOffExpiration(Key $key, float $ttl);

src/Symfony/Component/Lock/SharedLockStoreInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ interface SharedLockStoreInterface extends PersistingStoreInterface
2121
/**
2222
* Stores the resource if it's not locked for reading by someone else.
2323
*
24+
* @return void
25+
*
2426
* @throws LockConflictedException
2527
*/
2628
public function saveRead(Key $key);

src/Symfony/Component/Lock/Tests/LockTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,14 @@ public function testAcquireReadTwiceWithExpiration()
472472
private $keys = [];
473473
private $initialTtl = 30;
474474

475-
public function save(Key $key)
475+
public function save(Key $key): void
476476
{
477477
$key->reduceLifetime($this->initialTtl);
478478
$this->keys[spl_object_hash($key)] = $key;
479479
$this->checkNotExpired($key);
480-
481-
return true;
482480
}
483481

484-
public function delete(Key $key)
482+
public function delete(Key $key): void
485483
{
486484
unset($this->keys[spl_object_hash($key)]);
487485
}
@@ -491,7 +489,7 @@ public function exists(Key $key): bool
491489
return isset($this->keys[spl_object_hash($key)]);
492490
}
493491

494-
public function putOffExpiration(Key $key, $ttl)
492+
public function putOffExpiration(Key $key, $ttl): void
495493
{
496494
$key->reduceLifetime($ttl);
497495
$this->checkNotExpired($key);

0 commit comments

Comments
 (0)
0