Skip to content

Commit 7d84358

Browse files
committed
Simplify dummy phpdocs
1 parent f3c2e8d commit 7d84358

27 files changed

+167
-197
lines changed

phpstan.neon.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ parameters:
2121
identifier: if.condNotBoolean
2222
message: '~^Only booleans are allowed in an if condition, mixed given\.$~'
2323
count: 1
24+
-
25+
message: '~^Parameter #1 \$(redisAPI|redis) \(Redis\|RedisCluster\) of method malkusch\\lock\\mutex\\PHPRedisMutex::(add|evalScript)\(\) should be contravariant with parameter \$redisAPI \(mixed\) of method malkusch\\lock\\mutex\\RedisMutex::(add|evalScript)\(\)$~'
26+
identifier: method.childParameterType
27+
path: 'src/mutex/PHPRedisMutex.php'
28+
count: 2
29+
-
30+
message: '~^Parameter #1 \$(redisAPI|client) \(Predis\\ClientInterface\) of method malkusch\\lock\\mutex\\PredisMutex::(add|evalScript)\(\) should be contravariant with parameter \$redisAPI \(mixed\) of method malkusch\\lock\\mutex\\RedisMutex::(add|evalScript)\(\)$~'
31+
identifier: method.childParameterType
32+
path: 'src/mutex/PredisMutex.php'
33+
count: 2
2434
-
2535
path: 'tests/mutex/*Test.php'
2636
identifier: empty.notAllowed
@@ -31,3 +41,8 @@ parameters:
3141
identifier: method.deprecated
3242
message: '~^Call to deprecated method getMockForAbstractClass\(\) of class PHPUnit\\Framework\\TestCase:\nhttps://github.com/sebastianbergmann/phpunit/issues/5241$~'
3343
count: 8
44+
-
45+
path: 'tests/mutex/PredisMutexTest.php'
46+
identifier: method.deprecated
47+
message: '~^Call to deprecated method addMethods\(\) of class PHPUnit\\Framework\\MockObject\\MockBuilder:\nhttps://github.com/sebastianbergmann/phpunit/issues/5320$~'
48+
count: 1

src/exception/ExecutionOutsideLockException.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ class ExecutionOutsideLockException extends LockReleaseException
2121
/**
2222
* Creates a new instance of the ExecutionOutsideLockException class.
2323
*
24-
* @param float $elapsedTime total elapsed time of the synchronized code callback execution
25-
* @param float $timeout the lock timeout in seconds
26-
*
27-
* @return self execution outside lock exception
24+
* @param float $elapsedTime Total elapsed time of the synchronized code callback execution
25+
* @param float $timeout The lock timeout in seconds
2826
*/
2927
public static function create(float $elapsedTime, float $timeout): self
3028
{

src/exception/LockReleaseException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class LockReleaseException extends MutexException
3131
* Gets the result that has been returned during the critical code
3232
* execution.
3333
*
34-
* @return mixed the return value of the executed code block
34+
* @return mixed The return value of the executed code block
3535
*/
3636
public function getCodeResult()
3737
{
@@ -42,9 +42,9 @@ public function getCodeResult()
4242
* Sets the result that has been returned during the critical code
4343
* execution.
4444
*
45-
* @param mixed $codeResult the return value of the executed code block
45+
* @param mixed $codeResult The return value of the executed code block
4646
*
47-
* @return self current lock release exception instance
47+
* @return $this
4848
*/
4949
public function setCodeResult($codeResult): self
5050
{
@@ -57,7 +57,7 @@ public function setCodeResult($codeResult): self
5757
* Gets the exception that has happened during the synchronized code
5858
* execution.
5959
*
60-
* @return \Throwable|null the exception thrown by the code block or null when there has been no exception
60+
* @return \Throwable|null The exception thrown by the code block or null when there has been no exception
6161
*/
6262
public function getCodeException(): ?\Throwable
6363
{
@@ -68,9 +68,9 @@ public function getCodeException(): ?\Throwable
6868
* Sets the exception that has happened during the critical code
6969
* execution.
7070
*
71-
* @param \Throwable $codeException the exception thrown by the code block
71+
* @param \Throwable $codeException The exception thrown by the code block
7272
*
73-
* @return self current lock release exception instance
73+
* @return $this
7474
*/
7575
public function setCodeException(\Throwable $codeException): self
7676
{

src/exception/MutexException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
*/
1313
class MutexException extends \RuntimeException implements PhpLockException
1414
{
15-
/** @var int not enough redis servers */
15+
/** Not enough redis servers */
1616
public const REDIS_NOT_ENOUGH_SERVERS = 1;
1717
}

src/exception/TimeoutException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ class TimeoutException extends LockAcquireException
1515
/**
1616
* Creates a new instance of the TimeoutException class.
1717
*
18-
* @param float $timeout the timeout in seconds
19-
*
20-
* @return self a timeout has been exceeded exception
18+
* @param float $timeout The timeout in seconds
2119
*/
2220
public static function create(float $timeout): self
2321
{

src/mutex/CASMutex.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@
1717
*/
1818
class CASMutex extends Mutex
1919
{
20-
/** @var Loop the loop */
20+
/** @var Loop */
2121
private $loop;
2222

2323
/**
2424
* Sets the timeout.
2525
*
26-
* The default is 3 seconds.
26+
* @param float $timeout The timeout in seconds
2727
*
28-
* @param float $timeout the timeout in seconds
29-
*
30-
* @throws \LengthException the timeout must be greater than 0
28+
* @throws \LengthException The timeout must be greater than 0
3129
*/
3230
public function __construct(float $timeout = 3)
3331
{
@@ -66,8 +64,8 @@ public function notify(): void
6664
* });
6765
* </code>
6866
*
69-
* @throws \Exception the execution block threw an exception
70-
* @throws TimeoutException the timeout was reached
67+
* @throws \Exception The execution block threw an exception
68+
* @throws TimeoutException The timeout was reached
7169
*/
7270
#[\Override]
7371
public function synchronized(callable $code)

src/mutex/FlockMutex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class FlockMutex extends LockMutex
3333
*/
3434
public const STRATEGY_BUSY = 3;
3535

36-
/** @var resource the file handle */
36+
/** @var resource */
3737
private $fileHandle;
3838

3939
/** @var float */
@@ -45,7 +45,7 @@ class FlockMutex extends LockMutex
4545
/**
4646
* Sets the file handle.
4747
*
48-
* @param resource $fileHandle the file handle
48+
* @param resource $fileHandle
4949
*/
5050
public function __construct($fileHandle, float $timeout = self::INFINITE_TIMEOUT)
5151
{

src/mutex/LockMutex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ abstract class LockMutex extends Mutex
1919
*
2020
* This method blocks until the lock was acquired.
2121
*
22-
* @throws LockAcquireException the lock could not be acquired
22+
* @throws LockAcquireException The lock could not be acquired
2323
*/
2424
abstract protected function lock(): void;
2525

2626
/**
2727
* Releases the lock.
2828
*
29-
* @throws LockReleaseException the lock could not be released
29+
* @throws LockReleaseException The lock could not be released
3030
*/
3131
abstract protected function unlock(): void;
3232

src/mutex/MemcachedMutex.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
class MemcachedMutex extends SpinlockMutex
1111
{
12-
/** @var \Memcached the connected Memcached API */
12+
/** @var \Memcached */
1313
private $memcache;
1414

1515
/**
@@ -18,11 +18,10 @@ class MemcachedMutex extends SpinlockMutex
1818
* The Memcached API needs to have at least one server in its pool. I.e.
1919
* it has to be added with Memcached::addServer().
2020
*
21-
* @param string $name the lock name
22-
* @param \Memcached $memcache the connected Memcached API
23-
* @param float $timeout the time in seconds a lock expires, default is 3
21+
* @param string $name The lock name
22+
* @param float $timeout The time in seconds a lock expires
2423
*
25-
* @throws \LengthException the timeout must be greater than 0
24+
* @throws \LengthException The timeout must be greater than 0
2625
*/
2726
public function __construct(string $name, \Memcached $memcache, float $timeout = 3)
2827
{

src/mutex/Mutex.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ abstract class Mutex
2626
*
2727
* @template T
2828
*
29-
* @param callable(): T $code the synchronized execution callback
29+
* @param callable(): T $code The synchronized execution callback
3030
*
31-
* @return T the return value of the execution callback
31+
* @return T
3232
*
33-
* @throws \Exception the execution callback threw an exception
34-
* @throws LockAcquireException the mutex could not be acquired, no further side effects
35-
* @throws LockReleaseException the mutex could not be released, the code was already executed
36-
* @throws ExecutionOutsideLockException some code has been executed outside of the lock
33+
* @throws \Exception The execution callback threw an exception
34+
* @throws LockAcquireException The mutex could not be acquired, no further side effects
35+
* @throws LockReleaseException The mutex could not be released, the code was already executed
36+
* @throws ExecutionOutsideLockException Some code has been executed outside of the lock
3737
*/
3838
abstract public function synchronized(callable $code);
3939

@@ -52,10 +52,10 @@ abstract public function synchronized(callable $code);
5252
* });
5353
* </code>
5454
*
55-
* @param callable(): bool $check callback that decides if the lock should be acquired and if the synchronized
55+
* @param callable(): bool $check Callback that decides if the lock should be acquired and if the synchronized
5656
* callback should be executed after acquiring the lock
5757
*
58-
* @return DoubleCheckedLocking the double-checked locking pattern
58+
* @return DoubleCheckedLocking The double-checked locking pattern
5959
*/
6060
public function check(callable $check): DoubleCheckedLocking
6161
{

0 commit comments

Comments
 (0)