From 313062aaf9fcecb3d78b978f8ce1a0045e2dbe25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 6 Dec 2024 21:38:43 +0100 Subject: [PATCH 1/3] Rename namespace to PascalCase --- README.md | 22 ++++++++-------- composer.json | 4 +-- phpstan.neon.dist | 4 +-- src/exception/DeadlineException.php | 2 +- .../ExecutionOutsideLockException.php | 4 +-- src/exception/LockAcquireException.php | 2 +- src/exception/LockReleaseException.php | 2 +- src/exception/MutexException.php | 2 +- src/exception/PhpLockException.php | 2 +- src/exception/TimeoutException.php | 2 +- src/mutex/CASMutex.php | 6 ++--- src/mutex/FlockMutex.php | 16 ++++++------ src/mutex/LockMutex.php | 6 ++--- src/mutex/MemcachedMutex.php | 2 +- src/mutex/Mutex.php | 12 ++++----- src/mutex/MySQLMutex.php | 8 +++--- src/mutex/NoMutex.php | 2 +- src/mutex/PHPRedisMutex.php | 6 ++--- src/mutex/PgAdvisoryLockMutex.php | 4 +-- src/mutex/PredisMutex.php | 6 ++--- src/mutex/RedisMutex.php | 8 +++--- src/mutex/SemaphoreMutex.php | 6 ++--- src/mutex/SpinlockMutex.php | 12 ++++----- src/mutex/TransactionalMutex.php | 6 ++--- src/util/DoubleCheckedLocking.php | 12 ++++----- src/util/LockUtil.php | 2 +- src/util/Loop.php | 6 ++--- src/util/PcntlTimeout.php | 6 ++--- tests/mutex/CASMutexTest.php | 10 +++---- tests/mutex/FlockMutexTest.php | 12 ++++----- tests/mutex/LockMutexTest.php | 8 +++--- tests/mutex/MemcachedMutexTest.php | 8 +++--- tests/mutex/MutexConcurrencyTest.php | 22 ++++++++-------- tests/mutex/MutexTest.php | 26 +++++++++---------- tests/mutex/MySQLMutexTest.php | 4 +-- tests/mutex/PHPRedisMutexTest.php | 10 +++---- tests/mutex/PgAdvisoryLockMutexTest.php | 4 +-- tests/mutex/PredisMutexTest.php | 8 +++--- tests/mutex/RedisMutexTest.php | 16 ++++++------ tests/mutex/SpinlockMutexTest.php | 16 ++++++------ tests/mutex/TransactionalMutexTest.php | 6 ++--- tests/util/DoubleCheckedLockingTest.php | 6 ++--- tests/util/LockUtilTest.php | 4 +-- tests/util/LoopTest.php | 8 +++--- tests/util/PcntlTimeoutTest.php | 8 +++--- 45 files changed, 174 insertions(+), 174 deletions(-) diff --git a/README.md b/README.md index 3169f9eb..b25e3641 100644 --- a/README.md +++ b/README.md @@ -44,16 +44,16 @@ composer require malkusch/lock ## Usage -This library uses the namespace `malkusch\lock`. +This library uses the namespace `Malkusch\Lock`. ### Mutex -The [`malkusch\lock\mutex\Mutex`][5] class is an abstract class and provides the +The [`Malkusch\Lock\Mutex\Mutex`][5] class is an abstract class and provides the base API for this library. #### Mutex::synchronized() -[`malkusch\lock\mutex\Mutex::synchronized()`][6] executes code exclusively. This +[`Malkusch\Lock\Mutex\Mutex::synchronized()`][6] executes code exclusively. This method guarantees that the code is only executed by one process at once. Other processes have to wait until the mutex is available. The critical code may throw an exception, which would release the lock as well. @@ -82,8 +82,8 @@ $newBalance = $mutex->synchronized(function () use ( #### Mutex::check() -[`malkusch\lock\mutex\Mutex::check()`][7] sets a callable, which will be -executed when [`malkusch\lock\util\DoubleCheckedLocking::then()`][8] is called, +[`Malkusch\Lock\Mutex\Mutex::check()`][7] sets a callable, which will be +executed when [`Malkusch\Lock\Util\DoubleCheckedLocking::then()`][8] is called, and performs a double-checked locking pattern, where it's return value decides if the lock needs to be acquired and the synchronized code to be executed. @@ -92,12 +92,12 @@ detailed explanation of that feature. If the check's callable returns `false`, no lock will be acquired and the synchronized code will not be executed. In this case the -[`malkusch\lock\util\DoubleCheckedLocking::then()`][8] method, will also return +[`Malkusch\Lock\Util\DoubleCheckedLocking::then()`][8] method, will also return `false` to indicate that the check did not pass either before or after acquiring the lock. In the case where the check's callable returns a value other than `false`, the -[`malkusch\lock\util\DoubleCheckedLocking::then()`][8] method, will +[`Malkusch\Lock\Util\DoubleCheckedLocking::then()`][8] method, will try to acquire the lock and on success will perform the check again. Only when the check returns something other than `false` a second time, the synchronized code callable, which has been passed to `then()` will be executed. In this case @@ -127,8 +127,8 @@ if ($newBalance === false) { ### Extracting code result after lock release exception -Mutex implementations based on [`malkush\lock\mutex\LockMutex`][12] will throw -[`malkusch\lock\exception\LockReleaseException`][13] in case of lock release +Mutex implementations based on [`Malkush\Lock\Mutex\LockMutex`][12] will throw +[`Malkusch\Lock\Exception\LockReleaseException`][13] in case of lock release problem, but the synchronized code block will be already executed at this point. In order to read the code result (or an exception thrown there), `LockReleaseException` provides methods to extract it. @@ -160,7 +160,7 @@ try { ### Implementations -Because the [`malkusch\lock\mutex\Mutex`](#mutex) class is an abstract class, +Because the [`Malkusch\Lock\Mutex\Mutex`](#mutex) class is an abstract class, you can choose from one of the provided implementations or create/extend your own implementation. @@ -179,7 +179,7 @@ own implementation. The **CASMutex** has to be used with a [Compare-and-swap][10] operation. This mutex is lock free. It will repeat executing the code until the CAS operation was successful. The code should therefore notify the mutex by calling -[`malkusch\lock\mutex\CASMutex::notify()`][11]. +[`Malkusch\Lock\Mutex\CASMutex::notify()`][11]. As the mutex keeps executing the critical code, it must not have any side effects as long as the CAS operation was not successful. diff --git a/composer.json b/composer.json index d7073d36..15b2a83f 100644 --- a/composer.json +++ b/composer.json @@ -71,12 +71,12 @@ "prefer-stable": true, "autoload": { "psr-4": { - "malkusch\\lock\\": "src/" + "Malkusch\\Lock\\": "src/" } }, "autoload-dev": { "psr-4": { - "malkusch\\lock\\Tests\\": "tests/" + "Malkusch\\Lock\\Tests\\": "tests/" } }, "config": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 203f1251..792b80d8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -22,12 +22,12 @@ parameters: message: '~^Only booleans are allowed in an if condition, mixed given\.$~' count: 1 - - 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)\(\)$~' + 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)\(\)$~' identifier: method.childParameterType path: 'src/mutex/PHPRedisMutex.php' count: 2 - - 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)\(\)$~' + 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)\(\)$~' identifier: method.childParameterType path: 'src/mutex/PredisMutex.php' count: 2 diff --git a/src/exception/DeadlineException.php b/src/exception/DeadlineException.php index e81cba6b..d9eda0cd 100644 --- a/src/exception/DeadlineException.php +++ b/src/exception/DeadlineException.php @@ -2,6 +2,6 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; class DeadlineException extends \RuntimeException implements PhpLockException {} diff --git a/src/exception/ExecutionOutsideLockException.php b/src/exception/ExecutionOutsideLockException.php index 475462f5..5e175adc 100644 --- a/src/exception/ExecutionOutsideLockException.php +++ b/src/exception/ExecutionOutsideLockException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; /** * Execution outside lock exception. @@ -14,7 +14,7 @@ * * Should only be used in contexts where the is being released. * - * @see \malkusch\lock\mutex\SpinlockMutex::unlock() + * @see \Malkusch\Lock\Mutex\SpinlockMutex::unlock() */ class ExecutionOutsideLockException extends LockReleaseException { diff --git a/src/exception/LockAcquireException.php b/src/exception/LockAcquireException.php index 61e094de..2bc548b3 100644 --- a/src/exception/LockAcquireException.php +++ b/src/exception/LockAcquireException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; /** * Lock acquire exception. diff --git a/src/exception/LockReleaseException.php b/src/exception/LockReleaseException.php index 2ee26857..8dad61ef 100644 --- a/src/exception/LockReleaseException.php +++ b/src/exception/LockReleaseException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; /** * Lock release exception. diff --git a/src/exception/MutexException.php b/src/exception/MutexException.php index f7b57a38..4658f1f2 100644 --- a/src/exception/MutexException.php +++ b/src/exception/MutexException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; /** * Mutex exception. diff --git a/src/exception/PhpLockException.php b/src/exception/PhpLockException.php index a351f046..655fd0ab 100644 --- a/src/exception/PhpLockException.php +++ b/src/exception/PhpLockException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; /** * Common php-lock/lock exception interface. diff --git a/src/exception/TimeoutException.php b/src/exception/TimeoutException.php index 18b1e993..cd6af9b0 100644 --- a/src/exception/TimeoutException.php +++ b/src/exception/TimeoutException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\exception; +namespace Malkusch\Lock\Exception; /** * Timeout exception. diff --git a/src/mutex/CASMutex.php b/src/mutex/CASMutex.php index bb1c51b3..7d235135 100644 --- a/src/mutex/CASMutex.php +++ b/src/mutex/CASMutex.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\util\Loop; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Util\Loop; /** * CAS based mutex implementation. diff --git a/src/mutex/FlockMutex.php b/src/mutex/FlockMutex.php index e3651565..bd8afbca 100644 --- a/src/mutex/FlockMutex.php +++ b/src/mutex/FlockMutex.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; - -use malkusch\lock\exception\DeadlineException; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\util\Loop; -use malkusch\lock\util\PcntlTimeout; +namespace Malkusch\Lock\Mutex; + +use Malkusch\Lock\Exception\DeadlineException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Util\Loop; +use Malkusch\Lock\Util\PcntlTimeout; /** * Flock() based mutex implementation. diff --git a/src/mutex/LockMutex.php b/src/mutex/LockMutex.php index c4a8b72b..cb42c4db 100644 --- a/src/mutex/LockMutex.php +++ b/src/mutex/LockMutex.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; /** * Locking mutex. diff --git a/src/mutex/MemcachedMutex.php b/src/mutex/MemcachedMutex.php index 3d46787b..2a0c7109 100644 --- a/src/mutex/MemcachedMutex.php +++ b/src/mutex/MemcachedMutex.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; /** * Memcached based spinlock implementation. diff --git a/src/mutex/Mutex.php b/src/mutex/Mutex.php index c93d7064..aa61fa5c 100644 --- a/src/mutex/Mutex.php +++ b/src/mutex/Mutex.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\ExecutionOutsideLockException; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\util\DoubleCheckedLocking; +use Malkusch\Lock\Exception\ExecutionOutsideLockException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Util\DoubleCheckedLocking; /** * The mutex provides methods for exclusive execution. @@ -40,7 +40,7 @@ abstract public function synchronized(callable $code); /** * Performs a double-checked locking pattern. * - * Call {@link \malkusch\lock\util\DoubleCheckedLocking::then()} on the + * Call {@link \Malkusch\Lock\Util\DoubleCheckedLocking::then()} on the * returned object. * * Example: diff --git a/src/mutex/MySQLMutex.php b/src/mutex/MySQLMutex.php index 8f3f2b48..b9f6c09c 100644 --- a/src/mutex/MySQLMutex.php +++ b/src/mutex/MySQLMutex.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\util\LockUtil; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Util\LockUtil; class MySQLMutex extends LockMutex { diff --git a/src/mutex/NoMutex.php b/src/mutex/NoMutex.php index b01f4f49..42de50f4 100644 --- a/src/mutex/NoMutex.php +++ b/src/mutex/NoMutex.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; /** * This mutex doesn't lock at all. diff --git a/src/mutex/PHPRedisMutex.php b/src/mutex/PHPRedisMutex.php index 1baf87fe..f02096bb 100644 --- a/src/mutex/PHPRedisMutex.php +++ b/src/mutex/PHPRedisMutex.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; /** * Mutex based on the Redlock algorithm using the phpredis extension. diff --git a/src/mutex/PgAdvisoryLockMutex.php b/src/mutex/PgAdvisoryLockMutex.php index 406f7763..ab358fc8 100644 --- a/src/mutex/PgAdvisoryLockMutex.php +++ b/src/mutex/PgAdvisoryLockMutex.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\util\LockUtil; +use Malkusch\Lock\Util\LockUtil; class PgAdvisoryLockMutex extends LockMutex { diff --git a/src/mutex/PredisMutex.php b/src/mutex/PredisMutex.php index 9a042688..30030612 100644 --- a/src/mutex/PredisMutex.php +++ b/src/mutex/PredisMutex.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; use Predis\ClientInterface; use Predis\PredisException; diff --git a/src/mutex/RedisMutex.php b/src/mutex/RedisMutex.php index 1981994e..9363349a 100644 --- a/src/mutex/RedisMutex.php +++ b/src/mutex/RedisMutex.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\util\LockUtil; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Util\LockUtil; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; diff --git a/src/mutex/SemaphoreMutex.php b/src/mutex/SemaphoreMutex.php index 22aa039d..08fe7f24 100644 --- a/src/mutex/SemaphoreMutex.php +++ b/src/mutex/SemaphoreMutex.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; /** * System V IPC based mutex implementation. diff --git a/src/mutex/SpinlockMutex.php b/src/mutex/SpinlockMutex.php index 6b0b44d6..8046b3e9 100644 --- a/src/mutex/SpinlockMutex.php +++ b/src/mutex/SpinlockMutex.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\ExecutionOutsideLockException; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\util\LockUtil; -use malkusch\lock\util\Loop; +use Malkusch\Lock\Exception\ExecutionOutsideLockException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Util\LockUtil; +use Malkusch\Lock\Util\Loop; /** * Spinlock implementation. diff --git a/src/mutex/TransactionalMutex.php b/src/mutex/TransactionalMutex.php index c02b26d8..6ed31601 100644 --- a/src/mutex/TransactionalMutex.php +++ b/src/mutex/TransactionalMutex.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\mutex; +namespace Malkusch\Lock\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\util\Loop; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Util\Loop; /** * Serialization is delegated to the DBS. diff --git a/src/util/DoubleCheckedLocking.php b/src/util/DoubleCheckedLocking.php index 88acb8f9..6af39280 100644 --- a/src/util/DoubleCheckedLocking.php +++ b/src/util/DoubleCheckedLocking.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace malkusch\lock\util; +namespace Malkusch\Lock\Util; -use malkusch\lock\exception\ExecutionOutsideLockException; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\mutex\Mutex; +use Malkusch\Lock\Exception\ExecutionOutsideLockException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Mutex\Mutex; /** * The double-checked locking pattern. * * You should not instantiate this class directly. Use - * {@link \malkusch\lock\mutex\Mutex::check()}. + * {@link \Malkusch\Lock\Mutex\Mutex::check()}. */ class DoubleCheckedLocking { diff --git a/src/util/LockUtil.php b/src/util/LockUtil.php index 82baf7c0..335c00de 100644 --- a/src/util/LockUtil.php +++ b/src/util/LockUtil.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace malkusch\lock\util; +namespace Malkusch\Lock\Util; /** * @internal diff --git a/src/util/Loop.php b/src/util/Loop.php index 4994fd02..a448085e 100644 --- a/src/util/Loop.php +++ b/src/util/Loop.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace malkusch\lock\util; +namespace Malkusch\Lock\Util; -use malkusch\lock\exception\TimeoutException; +use Malkusch\Lock\Exception\TimeoutException; /** * Repeats executing a code until it was successful. @@ -61,7 +61,7 @@ public function end(): void * * The code has to be designed in a way that it can be repeated without any * side effects. When execution was successful it should notify that event - * by calling {@link \malkusch\lock\util\Loop::end()}. I.e. the only side + * by calling {@link \Malkusch\Lock\Util\Loop::end()}. I.e. the only side * effects of the code may happen after a successful execution. * * If the code throws an exception it will stop repeating the execution. diff --git a/src/util/PcntlTimeout.php b/src/util/PcntlTimeout.php index b1754d61..6cdafd43 100644 --- a/src/util/PcntlTimeout.php +++ b/src/util/PcntlTimeout.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\util; +namespace Malkusch\Lock\Util; -use malkusch\lock\exception\DeadlineException; -use malkusch\lock\exception\LockAcquireException; +use Malkusch\Lock\Exception\DeadlineException; +use Malkusch\Lock\Exception\LockAcquireException; /** * Timeout based on a scheduled alarm. diff --git a/tests/mutex/CASMutexTest.php b/tests/mutex/CASMutexTest.php index c5976d43..a9988dd0 100644 --- a/tests/mutex/CASMutexTest.php +++ b/tests/mutex/CASMutexTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\mutex\CASMutex; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Mutex\CASMutex; use phpmock\environment\SleepEnvironmentBuilder; use phpmock\MockEnabledException; use phpmock\phpunit\PHPMock; @@ -22,8 +22,8 @@ protected function setUp(): void $sleepBuilder = new SleepEnvironmentBuilder(); $sleepBuilder->addNamespace(__NAMESPACE__); - $sleepBuilder->addNamespace('malkusch\lock\mutex'); - $sleepBuilder->addNamespace('malkusch\lock\util'); + $sleepBuilder->addNamespace('Malkusch\Lock\Mutex'); + $sleepBuilder->addNamespace('Malkusch\Lock\Util'); $sleep = $sleepBuilder->build(); try { $sleep->enable(); diff --git a/tests/mutex/FlockMutexTest.php b/tests/mutex/FlockMutexTest.php index f9fc9583..c49e1d69 100644 --- a/tests/mutex/FlockMutexTest.php +++ b/tests/mutex/FlockMutexTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; use Eloquent\Liberator\Liberator; -use malkusch\lock\exception\DeadlineException; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\mutex\FlockMutex; -use malkusch\lock\util\LockUtil; -use malkusch\lock\util\PcntlTimeout; +use Malkusch\Lock\Exception\DeadlineException; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Mutex\FlockMutex; +use Malkusch\Lock\Util\LockUtil; +use Malkusch\Lock\Util\PcntlTimeout; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/mutex/LockMutexTest.php b/tests/mutex/LockMutexTest.php index f3f9c9d9..eab351e9 100644 --- a/tests/mutex/LockMutexTest.php +++ b/tests/mutex/LockMutexTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\mutex\LockMutex; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Mutex\LockMutex; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/mutex/MemcachedMutexTest.php b/tests/mutex/MemcachedMutexTest.php index 9fbb7dd8..1e9f50e9 100644 --- a/tests/mutex/MemcachedMutexTest.php +++ b/tests/mutex/MemcachedMutexTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\mutex\MemcachedMutex; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Mutex\MemcachedMutex; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/mutex/MutexConcurrencyTest.php b/tests/mutex/MutexConcurrencyTest.php index df275390..71fbd7a1 100644 --- a/tests/mutex/MutexConcurrencyTest.php +++ b/tests/mutex/MutexConcurrencyTest.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; use Eloquent\Liberator\Liberator; -use malkusch\lock\mutex\FlockMutex; -use malkusch\lock\mutex\MemcachedMutex; -use malkusch\lock\mutex\Mutex; -use malkusch\lock\mutex\MySQLMutex; -use malkusch\lock\mutex\PgAdvisoryLockMutex; -use malkusch\lock\mutex\PHPRedisMutex; -use malkusch\lock\mutex\PredisMutex; -use malkusch\lock\mutex\SemaphoreMutex; -use malkusch\lock\mutex\TransactionalMutex; -use malkusch\lock\util\LockUtil; +use Malkusch\Lock\Mutex\FlockMutex; +use Malkusch\Lock\Mutex\MemcachedMutex; +use Malkusch\Lock\Mutex\Mutex; +use Malkusch\Lock\Mutex\MySQLMutex; +use Malkusch\Lock\Mutex\PgAdvisoryLockMutex; +use Malkusch\Lock\Mutex\PHPRedisMutex; +use Malkusch\Lock\Mutex\PredisMutex; +use Malkusch\Lock\Mutex\SemaphoreMutex; +use Malkusch\Lock\Mutex\TransactionalMutex; +use Malkusch\Lock\Util\LockUtil; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Constraint\IsType; use PHPUnit\Framework\TestCase; diff --git a/tests/mutex/MutexTest.php b/tests/mutex/MutexTest.php index 453685c6..b7282ccf 100644 --- a/tests/mutex/MutexTest.php +++ b/tests/mutex/MutexTest.php @@ -2,21 +2,21 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; use Eloquent\Liberator\Liberator; -use malkusch\lock\mutex\FlockMutex; -use malkusch\lock\mutex\LockMutex; -use malkusch\lock\mutex\MemcachedMutex; -use malkusch\lock\mutex\Mutex; -use malkusch\lock\mutex\MySQLMutex; -use malkusch\lock\mutex\NoMutex; -use malkusch\lock\mutex\PgAdvisoryLockMutex; -use malkusch\lock\mutex\PHPRedisMutex; -use malkusch\lock\mutex\PredisMutex; -use malkusch\lock\mutex\SemaphoreMutex; -use malkusch\lock\mutex\SpinlockMutex; -use malkusch\lock\mutex\TransactionalMutex; +use Malkusch\Lock\Mutex\FlockMutex; +use Malkusch\Lock\Mutex\LockMutex; +use Malkusch\Lock\Mutex\MemcachedMutex; +use Malkusch\Lock\Mutex\Mutex; +use Malkusch\Lock\Mutex\MySQLMutex; +use Malkusch\Lock\Mutex\NoMutex; +use Malkusch\Lock\Mutex\PgAdvisoryLockMutex; +use Malkusch\Lock\Mutex\PHPRedisMutex; +use Malkusch\Lock\Mutex\PredisMutex; +use Malkusch\Lock\Mutex\SemaphoreMutex; +use Malkusch\Lock\Mutex\SpinlockMutex; +use Malkusch\Lock\Mutex\TransactionalMutex; use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; diff --git a/tests/mutex/MySQLMutexTest.php b/tests/mutex/MySQLMutexTest.php index 8d06986b..f08d4f11 100644 --- a/tests/mutex/MySQLMutexTest.php +++ b/tests/mutex/MySQLMutexTest.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\mutex\MySQLMutex; +use Malkusch\Lock\Mutex\MySQLMutex; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/mutex/PHPRedisMutexTest.php b/tests/mutex/PHPRedisMutexTest.php index d875ddd6..a616d872 100644 --- a/tests/mutex/PHPRedisMutexTest.php +++ b/tests/mutex/PHPRedisMutexTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\exception\MutexException; -use malkusch\lock\mutex\PHPRedisMutex; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Exception\MutexException; +use Malkusch\Lock\Mutex\PHPRedisMutex; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\RequiresPhpExtension; diff --git a/tests/mutex/PgAdvisoryLockMutexTest.php b/tests/mutex/PgAdvisoryLockMutexTest.php index 80ed20c1..8ed704d6 100644 --- a/tests/mutex/PgAdvisoryLockMutexTest.php +++ b/tests/mutex/PgAdvisoryLockMutexTest.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\mutex\PgAdvisoryLockMutex; +use Malkusch\Lock\Mutex\PgAdvisoryLockMutex; use PHPUnit\Framework\Constraint\IsType; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/mutex/PredisMutexTest.php b/tests/mutex/PredisMutexTest.php index 8d5e8843..d1635325 100644 --- a/tests/mutex/PredisMutexTest.php +++ b/tests/mutex/PredisMutexTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\mutex\PredisMutex; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Mutex\PredisMutex; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Constraint\IsType; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/mutex/RedisMutexTest.php b/tests/mutex/RedisMutexTest.php index 09716778..20ca0503 100644 --- a/tests/mutex/RedisMutexTest.php +++ b/tests/mutex/RedisMutexTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\exception\MutexException; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\mutex\RedisMutex; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Exception\MutexException; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Mutex\RedisMutex; use phpmock\environment\SleepEnvironmentBuilder; use phpmock\MockEnabledException; use phpmock\phpunit\PHPMock; @@ -32,8 +32,8 @@ protected function setUp(): void $sleepBuilder = new SleepEnvironmentBuilder(); $sleepBuilder->addNamespace(__NAMESPACE__); - $sleepBuilder->addNamespace('malkusch\lock\mutex'); - $sleepBuilder->addNamespace('malkusch\lock\util'); + $sleepBuilder->addNamespace('Malkusch\Lock\Mutex'); + $sleepBuilder->addNamespace('Malkusch\Lock\Util'); $sleep = $sleepBuilder->build(); try { $sleep->enable(); diff --git a/tests/mutex/SpinlockMutexTest.php b/tests/mutex/SpinlockMutexTest.php index 62d459c9..c1ea4c3a 100644 --- a/tests/mutex/SpinlockMutexTest.php +++ b/tests/mutex/SpinlockMutexTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\ExecutionOutsideLockException; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\exception\LockReleaseException; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\mutex\SpinlockMutex; +use Malkusch\Lock\Exception\ExecutionOutsideLockException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Exception\LockReleaseException; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Mutex\SpinlockMutex; use phpmock\environment\SleepEnvironmentBuilder; use phpmock\MockEnabledException; use phpmock\phpunit\PHPMock; @@ -26,8 +26,8 @@ protected function setUp(): void $sleepBuilder = new SleepEnvironmentBuilder(); $sleepBuilder->addNamespace(__NAMESPACE__); - $sleepBuilder->addNamespace('malkusch\lock\mutex'); - $sleepBuilder->addNamespace('malkusch\lock\util'); + $sleepBuilder->addNamespace('Malkusch\Lock\Mutex'); + $sleepBuilder->addNamespace('Malkusch\Lock\Util'); $sleep = $sleepBuilder->build(); try { $sleep->enable(); diff --git a/tests/mutex/TransactionalMutexTest.php b/tests/mutex/TransactionalMutexTest.php index 4fccb688..b92a3ce0 100644 --- a/tests/mutex/TransactionalMutexTest.php +++ b/tests/mutex/TransactionalMutexTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\mutex; +namespace Malkusch\Lock\Tests\Mutex; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\mutex\TransactionalMutex; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Mutex\TransactionalMutex; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/util/DoubleCheckedLockingTest.php b/tests/util/DoubleCheckedLockingTest.php index 7d3df958..526fbe66 100644 --- a/tests/util/DoubleCheckedLockingTest.php +++ b/tests/util/DoubleCheckedLockingTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\util; +namespace Malkusch\Lock\Tests\Util; -use malkusch\lock\mutex\Mutex; -use malkusch\lock\util\DoubleCheckedLocking; +use Malkusch\Lock\Mutex\Mutex; +use Malkusch\Lock\Util\DoubleCheckedLocking; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/util/LockUtilTest.php b/tests/util/LockUtilTest.php index 2d5d40ca..c7610ae0 100644 --- a/tests/util/LockUtilTest.php +++ b/tests/util/LockUtilTest.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\util; +namespace Malkusch\Lock\Tests\Util; -use malkusch\lock\util\LockUtil; +use Malkusch\Lock\Util\LockUtil; use PHPUnit\Framework\TestCase; class LockUtilTest extends TestCase diff --git a/tests/util/LoopTest.php b/tests/util/LoopTest.php index 1d4478a2..452f4d49 100644 --- a/tests/util/LoopTest.php +++ b/tests/util/LoopTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\util; +namespace Malkusch\Lock\Tests\Util; -use malkusch\lock\exception\TimeoutException; -use malkusch\lock\util\Loop; +use Malkusch\Lock\Exception\TimeoutException; +use Malkusch\Lock\Util\Loop; use phpmock\environment\SleepEnvironmentBuilder; use phpmock\MockEnabledException; use phpmock\phpunit\PHPMock; @@ -23,7 +23,7 @@ protected function setUp(): void $sleepBuilder = new SleepEnvironmentBuilder(); $sleepBuilder->addNamespace(__NAMESPACE__); - $sleepBuilder->addNamespace('malkusch\lock\util'); + $sleepBuilder->addNamespace('Malkusch\Lock\Util'); $sleep = $sleepBuilder->build(); try { $sleep->enable(); diff --git a/tests/util/PcntlTimeoutTest.php b/tests/util/PcntlTimeoutTest.php index 1f1eda52..b0ce46c2 100644 --- a/tests/util/PcntlTimeoutTest.php +++ b/tests/util/PcntlTimeoutTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace malkusch\lock\Tests\util; +namespace Malkusch\Lock\Tests\Util; -use malkusch\lock\exception\DeadlineException; -use malkusch\lock\exception\LockAcquireException; -use malkusch\lock\util\PcntlTimeout; +use Malkusch\Lock\Exception\DeadlineException; +use Malkusch\Lock\Exception\LockAcquireException; +use Malkusch\Lock\Util\PcntlTimeout; use PHPUnit\Framework\TestCase; /** From 170073119a16c4608eca1bbb3cbb3837afb669d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 6 Dec 2024 21:52:58 +0100 Subject: [PATCH 2/3] rename directories --- src/{exception => Exception}/DeadlineException.php | 0 src/{exception => Exception}/ExecutionOutsideLockException.php | 0 src/{exception => Exception}/LockAcquireException.php | 0 src/{exception => Exception}/LockReleaseException.php | 0 src/{exception => Exception}/MutexException.php | 0 src/{exception => Exception}/PhpLockException.php | 0 src/{exception => Exception}/TimeoutException.php | 0 src/{mutex => Mutex}/CASMutex.php | 0 src/{mutex => Mutex}/FlockMutex.php | 0 src/{mutex => Mutex}/LockMutex.php | 0 src/{mutex => Mutex}/MemcachedMutex.php | 0 src/{mutex => Mutex}/Mutex.php | 0 src/{mutex => Mutex}/MySQLMutex.php | 0 src/{mutex => Mutex}/NoMutex.php | 0 src/{mutex => Mutex}/PHPRedisMutex.php | 0 src/{mutex => Mutex}/PgAdvisoryLockMutex.php | 0 src/{mutex => Mutex}/PredisMutex.php | 0 src/{mutex => Mutex}/RedisMutex.php | 0 src/{mutex => Mutex}/SemaphoreMutex.php | 0 src/{mutex => Mutex}/SpinlockMutex.php | 0 src/{mutex => Mutex}/TransactionalMutex.php | 0 src/{util => Util}/DoubleCheckedLocking.php | 0 src/{util => Util}/LockUtil.php | 0 src/{util => Util}/Loop.php | 0 src/{util => Util}/PcntlTimeout.php | 0 tests/{mutex => Mutex}/CASMutexTest.php | 0 tests/{mutex => Mutex}/FlockMutexTest.php | 0 tests/{mutex => Mutex}/LockMutexTest.php | 0 tests/{mutex => Mutex}/MemcachedMutexTest.php | 0 tests/{mutex => Mutex}/MutexConcurrencyTest.php | 0 tests/{mutex => Mutex}/MutexTest.php | 0 tests/{mutex => Mutex}/MySQLMutexTest.php | 0 tests/{mutex => Mutex}/PHPRedisMutexTest.php | 0 tests/{mutex => Mutex}/PgAdvisoryLockMutexTest.php | 0 tests/{mutex => Mutex}/PredisMutexTest.php | 0 tests/{mutex => Mutex}/RedisMutexTest.php | 0 tests/{mutex => Mutex}/SpinlockMutexTest.php | 0 tests/{mutex => Mutex}/TransactionalMutexTest.php | 0 tests/{util => Util}/DoubleCheckedLockingTest.php | 0 tests/{util => Util}/LockUtilTest.php | 0 tests/{util => Util}/LoopTest.php | 0 tests/{util => Util}/PcntlTimeoutTest.php | 0 42 files changed, 0 insertions(+), 0 deletions(-) rename src/{exception => Exception}/DeadlineException.php (100%) rename src/{exception => Exception}/ExecutionOutsideLockException.php (100%) rename src/{exception => Exception}/LockAcquireException.php (100%) rename src/{exception => Exception}/LockReleaseException.php (100%) rename src/{exception => Exception}/MutexException.php (100%) rename src/{exception => Exception}/PhpLockException.php (100%) rename src/{exception => Exception}/TimeoutException.php (100%) rename src/{mutex => Mutex}/CASMutex.php (100%) rename src/{mutex => Mutex}/FlockMutex.php (100%) rename src/{mutex => Mutex}/LockMutex.php (100%) rename src/{mutex => Mutex}/MemcachedMutex.php (100%) rename src/{mutex => Mutex}/Mutex.php (100%) rename src/{mutex => Mutex}/MySQLMutex.php (100%) rename src/{mutex => Mutex}/NoMutex.php (100%) rename src/{mutex => Mutex}/PHPRedisMutex.php (100%) rename src/{mutex => Mutex}/PgAdvisoryLockMutex.php (100%) rename src/{mutex => Mutex}/PredisMutex.php (100%) rename src/{mutex => Mutex}/RedisMutex.php (100%) rename src/{mutex => Mutex}/SemaphoreMutex.php (100%) rename src/{mutex => Mutex}/SpinlockMutex.php (100%) rename src/{mutex => Mutex}/TransactionalMutex.php (100%) rename src/{util => Util}/DoubleCheckedLocking.php (100%) rename src/{util => Util}/LockUtil.php (100%) rename src/{util => Util}/Loop.php (100%) rename src/{util => Util}/PcntlTimeout.php (100%) rename tests/{mutex => Mutex}/CASMutexTest.php (100%) rename tests/{mutex => Mutex}/FlockMutexTest.php (100%) rename tests/{mutex => Mutex}/LockMutexTest.php (100%) rename tests/{mutex => Mutex}/MemcachedMutexTest.php (100%) rename tests/{mutex => Mutex}/MutexConcurrencyTest.php (100%) rename tests/{mutex => Mutex}/MutexTest.php (100%) rename tests/{mutex => Mutex}/MySQLMutexTest.php (100%) rename tests/{mutex => Mutex}/PHPRedisMutexTest.php (100%) rename tests/{mutex => Mutex}/PgAdvisoryLockMutexTest.php (100%) rename tests/{mutex => Mutex}/PredisMutexTest.php (100%) rename tests/{mutex => Mutex}/RedisMutexTest.php (100%) rename tests/{mutex => Mutex}/SpinlockMutexTest.php (100%) rename tests/{mutex => Mutex}/TransactionalMutexTest.php (100%) rename tests/{util => Util}/DoubleCheckedLockingTest.php (100%) rename tests/{util => Util}/LockUtilTest.php (100%) rename tests/{util => Util}/LoopTest.php (100%) rename tests/{util => Util}/PcntlTimeoutTest.php (100%) diff --git a/src/exception/DeadlineException.php b/src/Exception/DeadlineException.php similarity index 100% rename from src/exception/DeadlineException.php rename to src/Exception/DeadlineException.php diff --git a/src/exception/ExecutionOutsideLockException.php b/src/Exception/ExecutionOutsideLockException.php similarity index 100% rename from src/exception/ExecutionOutsideLockException.php rename to src/Exception/ExecutionOutsideLockException.php diff --git a/src/exception/LockAcquireException.php b/src/Exception/LockAcquireException.php similarity index 100% rename from src/exception/LockAcquireException.php rename to src/Exception/LockAcquireException.php diff --git a/src/exception/LockReleaseException.php b/src/Exception/LockReleaseException.php similarity index 100% rename from src/exception/LockReleaseException.php rename to src/Exception/LockReleaseException.php diff --git a/src/exception/MutexException.php b/src/Exception/MutexException.php similarity index 100% rename from src/exception/MutexException.php rename to src/Exception/MutexException.php diff --git a/src/exception/PhpLockException.php b/src/Exception/PhpLockException.php similarity index 100% rename from src/exception/PhpLockException.php rename to src/Exception/PhpLockException.php diff --git a/src/exception/TimeoutException.php b/src/Exception/TimeoutException.php similarity index 100% rename from src/exception/TimeoutException.php rename to src/Exception/TimeoutException.php diff --git a/src/mutex/CASMutex.php b/src/Mutex/CASMutex.php similarity index 100% rename from src/mutex/CASMutex.php rename to src/Mutex/CASMutex.php diff --git a/src/mutex/FlockMutex.php b/src/Mutex/FlockMutex.php similarity index 100% rename from src/mutex/FlockMutex.php rename to src/Mutex/FlockMutex.php diff --git a/src/mutex/LockMutex.php b/src/Mutex/LockMutex.php similarity index 100% rename from src/mutex/LockMutex.php rename to src/Mutex/LockMutex.php diff --git a/src/mutex/MemcachedMutex.php b/src/Mutex/MemcachedMutex.php similarity index 100% rename from src/mutex/MemcachedMutex.php rename to src/Mutex/MemcachedMutex.php diff --git a/src/mutex/Mutex.php b/src/Mutex/Mutex.php similarity index 100% rename from src/mutex/Mutex.php rename to src/Mutex/Mutex.php diff --git a/src/mutex/MySQLMutex.php b/src/Mutex/MySQLMutex.php similarity index 100% rename from src/mutex/MySQLMutex.php rename to src/Mutex/MySQLMutex.php diff --git a/src/mutex/NoMutex.php b/src/Mutex/NoMutex.php similarity index 100% rename from src/mutex/NoMutex.php rename to src/Mutex/NoMutex.php diff --git a/src/mutex/PHPRedisMutex.php b/src/Mutex/PHPRedisMutex.php similarity index 100% rename from src/mutex/PHPRedisMutex.php rename to src/Mutex/PHPRedisMutex.php diff --git a/src/mutex/PgAdvisoryLockMutex.php b/src/Mutex/PgAdvisoryLockMutex.php similarity index 100% rename from src/mutex/PgAdvisoryLockMutex.php rename to src/Mutex/PgAdvisoryLockMutex.php diff --git a/src/mutex/PredisMutex.php b/src/Mutex/PredisMutex.php similarity index 100% rename from src/mutex/PredisMutex.php rename to src/Mutex/PredisMutex.php diff --git a/src/mutex/RedisMutex.php b/src/Mutex/RedisMutex.php similarity index 100% rename from src/mutex/RedisMutex.php rename to src/Mutex/RedisMutex.php diff --git a/src/mutex/SemaphoreMutex.php b/src/Mutex/SemaphoreMutex.php similarity index 100% rename from src/mutex/SemaphoreMutex.php rename to src/Mutex/SemaphoreMutex.php diff --git a/src/mutex/SpinlockMutex.php b/src/Mutex/SpinlockMutex.php similarity index 100% rename from src/mutex/SpinlockMutex.php rename to src/Mutex/SpinlockMutex.php diff --git a/src/mutex/TransactionalMutex.php b/src/Mutex/TransactionalMutex.php similarity index 100% rename from src/mutex/TransactionalMutex.php rename to src/Mutex/TransactionalMutex.php diff --git a/src/util/DoubleCheckedLocking.php b/src/Util/DoubleCheckedLocking.php similarity index 100% rename from src/util/DoubleCheckedLocking.php rename to src/Util/DoubleCheckedLocking.php diff --git a/src/util/LockUtil.php b/src/Util/LockUtil.php similarity index 100% rename from src/util/LockUtil.php rename to src/Util/LockUtil.php diff --git a/src/util/Loop.php b/src/Util/Loop.php similarity index 100% rename from src/util/Loop.php rename to src/Util/Loop.php diff --git a/src/util/PcntlTimeout.php b/src/Util/PcntlTimeout.php similarity index 100% rename from src/util/PcntlTimeout.php rename to src/Util/PcntlTimeout.php diff --git a/tests/mutex/CASMutexTest.php b/tests/Mutex/CASMutexTest.php similarity index 100% rename from tests/mutex/CASMutexTest.php rename to tests/Mutex/CASMutexTest.php diff --git a/tests/mutex/FlockMutexTest.php b/tests/Mutex/FlockMutexTest.php similarity index 100% rename from tests/mutex/FlockMutexTest.php rename to tests/Mutex/FlockMutexTest.php diff --git a/tests/mutex/LockMutexTest.php b/tests/Mutex/LockMutexTest.php similarity index 100% rename from tests/mutex/LockMutexTest.php rename to tests/Mutex/LockMutexTest.php diff --git a/tests/mutex/MemcachedMutexTest.php b/tests/Mutex/MemcachedMutexTest.php similarity index 100% rename from tests/mutex/MemcachedMutexTest.php rename to tests/Mutex/MemcachedMutexTest.php diff --git a/tests/mutex/MutexConcurrencyTest.php b/tests/Mutex/MutexConcurrencyTest.php similarity index 100% rename from tests/mutex/MutexConcurrencyTest.php rename to tests/Mutex/MutexConcurrencyTest.php diff --git a/tests/mutex/MutexTest.php b/tests/Mutex/MutexTest.php similarity index 100% rename from tests/mutex/MutexTest.php rename to tests/Mutex/MutexTest.php diff --git a/tests/mutex/MySQLMutexTest.php b/tests/Mutex/MySQLMutexTest.php similarity index 100% rename from tests/mutex/MySQLMutexTest.php rename to tests/Mutex/MySQLMutexTest.php diff --git a/tests/mutex/PHPRedisMutexTest.php b/tests/Mutex/PHPRedisMutexTest.php similarity index 100% rename from tests/mutex/PHPRedisMutexTest.php rename to tests/Mutex/PHPRedisMutexTest.php diff --git a/tests/mutex/PgAdvisoryLockMutexTest.php b/tests/Mutex/PgAdvisoryLockMutexTest.php similarity index 100% rename from tests/mutex/PgAdvisoryLockMutexTest.php rename to tests/Mutex/PgAdvisoryLockMutexTest.php diff --git a/tests/mutex/PredisMutexTest.php b/tests/Mutex/PredisMutexTest.php similarity index 100% rename from tests/mutex/PredisMutexTest.php rename to tests/Mutex/PredisMutexTest.php diff --git a/tests/mutex/RedisMutexTest.php b/tests/Mutex/RedisMutexTest.php similarity index 100% rename from tests/mutex/RedisMutexTest.php rename to tests/Mutex/RedisMutexTest.php diff --git a/tests/mutex/SpinlockMutexTest.php b/tests/Mutex/SpinlockMutexTest.php similarity index 100% rename from tests/mutex/SpinlockMutexTest.php rename to tests/Mutex/SpinlockMutexTest.php diff --git a/tests/mutex/TransactionalMutexTest.php b/tests/Mutex/TransactionalMutexTest.php similarity index 100% rename from tests/mutex/TransactionalMutexTest.php rename to tests/Mutex/TransactionalMutexTest.php diff --git a/tests/util/DoubleCheckedLockingTest.php b/tests/Util/DoubleCheckedLockingTest.php similarity index 100% rename from tests/util/DoubleCheckedLockingTest.php rename to tests/Util/DoubleCheckedLockingTest.php diff --git a/tests/util/LockUtilTest.php b/tests/Util/LockUtilTest.php similarity index 100% rename from tests/util/LockUtilTest.php rename to tests/Util/LockUtilTest.php diff --git a/tests/util/LoopTest.php b/tests/Util/LoopTest.php similarity index 100% rename from tests/util/LoopTest.php rename to tests/Util/LoopTest.php diff --git a/tests/util/PcntlTimeoutTest.php b/tests/Util/PcntlTimeoutTest.php similarity index 100% rename from tests/util/PcntlTimeoutTest.php rename to tests/Util/PcntlTimeoutTest.php From 3742199a29e8d2b353655b82610bc089da4417d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 6 Dec 2024 21:57:16 +0100 Subject: [PATCH 3/3] fix phpstan --- phpstan.neon.dist | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 792b80d8..5ea53027 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -12,27 +12,27 @@ parameters: ignoreErrors: # TODO - - path: 'src/mutex/RedisMutex.php' + path: 'src/Mutex/RedisMutex.php' identifier: if.condNotBoolean message: '~^Only booleans are allowed in an if condition, mixed given\.$~' count: 1 - - path: 'src/mutex/TransactionalMutex.php' + path: 'src/Mutex/TransactionalMutex.php' identifier: if.condNotBoolean message: '~^Only booleans are allowed in an if condition, mixed given\.$~' count: 1 - 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)\(\)$~' identifier: method.childParameterType - path: 'src/mutex/PHPRedisMutex.php' + path: 'src/Mutex/PHPRedisMutex.php' count: 2 - 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)\(\)$~' identifier: method.childParameterType - path: 'src/mutex/PredisMutex.php' + path: 'src/Mutex/PredisMutex.php' count: 2 - - path: 'tests/mutex/*Test.php' + path: 'tests/Mutex/*Test.php' identifier: empty.notAllowed message: '~^Construct empty\(\) is not allowed\. Use more strict comparison\.$~' count: 6