Skip to content

Commit 14a8693

Browse files
authored
Rename namespace to PascalCase (#65)
1 parent da9bd84 commit 14a8693

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+179
-179
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ composer require malkusch/lock
4444

4545
## Usage
4646

47-
This library uses the namespace `malkusch\lock`.
47+
This library uses the namespace `Malkusch\Lock`.
4848

4949
### Mutex
5050

51-
The [`malkusch\lock\mutex\Mutex`][5] class is an abstract class and provides the
51+
The [`Malkusch\Lock\Mutex\Mutex`][5] class is an abstract class and provides the
5252
base API for this library.
5353

5454
#### Mutex::synchronized()
5555

56-
[`malkusch\lock\mutex\Mutex::synchronized()`][6] executes code exclusively. This
56+
[`Malkusch\Lock\Mutex\Mutex::synchronized()`][6] executes code exclusively. This
5757
method guarantees that the code is only executed by one process at once. Other
5858
processes have to wait until the mutex is available. The critical code may throw
5959
an exception, which would release the lock as well.
@@ -82,8 +82,8 @@ $newBalance = $mutex->synchronized(function () use (
8282

8383
#### Mutex::check()
8484

85-
[`malkusch\lock\mutex\Mutex::check()`][7] sets a callable, which will be
86-
executed when [`malkusch\lock\util\DoubleCheckedLocking::then()`][8] is called,
85+
[`Malkusch\Lock\Mutex\Mutex::check()`][7] sets a callable, which will be
86+
executed when [`Malkusch\Lock\Util\DoubleCheckedLocking::then()`][8] is called,
8787
and performs a double-checked locking pattern, where it's return value decides
8888
if the lock needs to be acquired and the synchronized code to be executed.
8989

@@ -92,12 +92,12 @@ detailed explanation of that feature.
9292

9393
If the check's callable returns `false`, no lock will be acquired and the
9494
synchronized code will not be executed. In this case the
95-
[`malkusch\lock\util\DoubleCheckedLocking::then()`][8] method, will also return
95+
[`Malkusch\Lock\Util\DoubleCheckedLocking::then()`][8] method, will also return
9696
`false` to indicate that the check did not pass either before or after acquiring
9797
the lock.
9898

9999
In the case where the check's callable returns a value other than `false`, the
100-
[`malkusch\lock\util\DoubleCheckedLocking::then()`][8] method, will
100+
[`Malkusch\Lock\Util\DoubleCheckedLocking::then()`][8] method, will
101101
try to acquire the lock and on success will perform the check again. Only when
102102
the check returns something other than `false` a second time, the synchronized
103103
code callable, which has been passed to `then()` will be executed. In this case
@@ -127,8 +127,8 @@ if ($newBalance === false) {
127127

128128
### Extracting code result after lock release exception
129129

130-
Mutex implementations based on [`malkush\lock\mutex\LockMutex`][12] will throw
131-
[`malkusch\lock\exception\LockReleaseException`][13] in case of lock release
130+
Mutex implementations based on [`Malkush\Lock\Mutex\LockMutex`][12] will throw
131+
[`Malkusch\Lock\Exception\LockReleaseException`][13] in case of lock release
132132
problem, but the synchronized code block will be already executed at this point.
133133
In order to read the code result (or an exception thrown there),
134134
`LockReleaseException` provides methods to extract it.
@@ -160,7 +160,7 @@ try {
160160

161161
### Implementations
162162

163-
Because the [`malkusch\lock\mutex\Mutex`](#mutex) class is an abstract class,
163+
Because the [`Malkusch\Lock\Mutex\Mutex`](#mutex) class is an abstract class,
164164
you can choose from one of the provided implementations or create/extend your
165165
own implementation.
166166

@@ -179,7 +179,7 @@ own implementation.
179179
The **CASMutex** has to be used with a [Compare-and-swap][10] operation. This
180180
mutex is lock free. It will repeat executing the code until the CAS operation
181181
was successful. The code should therefore notify the mutex by calling
182-
[`malkusch\lock\mutex\CASMutex::notify()`][11].
182+
[`Malkusch\Lock\Mutex\CASMutex::notify()`][11].
183183

184184
As the mutex keeps executing the critical code, it must not have any side
185185
effects as long as the CAS operation was not successful.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@
7171
"prefer-stable": true,
7272
"autoload": {
7373
"psr-4": {
74-
"malkusch\\lock\\": "src/"
74+
"Malkusch\\Lock\\": "src/"
7575
}
7676
},
7777
"autoload-dev": {
7878
"psr-4": {
79-
"malkusch\\lock\\Tests\\": "tests/"
79+
"Malkusch\\Lock\\Tests\\": "tests/"
8080
}
8181
},
8282
"config": {

phpstan.neon.dist

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ parameters:
1212
ignoreErrors:
1313
# TODO
1414
-
15-
path: 'src/mutex/RedisMutex.php'
15+
path: 'src/Mutex/RedisMutex.php'
1616
identifier: if.condNotBoolean
1717
message: '~^Only booleans are allowed in an if condition, mixed given\.$~'
1818
count: 1
1919
-
20-
path: 'src/mutex/TransactionalMutex.php'
20+
path: 'src/Mutex/TransactionalMutex.php'
2121
identifier: if.condNotBoolean
2222
message: '~^Only booleans are allowed in an if condition, mixed given\.$~'
2323
count: 1
2424
-
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)\(\)$~'
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)\(\)$~'
2626
identifier: method.childParameterType
27-
path: 'src/mutex/PHPRedisMutex.php'
27+
path: 'src/Mutex/PHPRedisMutex.php'
2828
count: 2
2929
-
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)\(\)$~'
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)\(\)$~'
3131
identifier: method.childParameterType
32-
path: 'src/mutex/PredisMutex.php'
32+
path: 'src/Mutex/PredisMutex.php'
3333
count: 2
3434
-
35-
path: 'tests/mutex/*Test.php'
35+
path: 'tests/Mutex/*Test.php'
3636
identifier: empty.notAllowed
3737
message: '~^Construct empty\(\) is not allowed\. Use more strict comparison\.$~'
3838
count: 6

src/exception/DeadlineException.php renamed to src/Exception/DeadlineException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
class DeadlineException extends \RuntimeException implements PhpLockException {}

src/exception/ExecutionOutsideLockException.php renamed to src/Exception/ExecutionOutsideLockException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
/**
88
* Execution outside lock exception.
@@ -14,7 +14,7 @@
1414
*
1515
* Should only be used in contexts where the is being released.
1616
*
17-
* @see \malkusch\lock\mutex\SpinlockMutex::unlock()
17+
* @see \Malkusch\Lock\Mutex\SpinlockMutex::unlock()
1818
*/
1919
class ExecutionOutsideLockException extends LockReleaseException
2020
{

src/exception/LockAcquireException.php renamed to src/Exception/LockAcquireException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
/**
88
* Lock acquire exception.

src/exception/LockReleaseException.php renamed to src/Exception/LockReleaseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
/**
88
* Lock release exception.

src/exception/MutexException.php renamed to src/Exception/MutexException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
/**
88
* Mutex exception.

src/exception/PhpLockException.php renamed to src/Exception/PhpLockException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
/**
88
* Common php-lock/lock exception interface.

src/exception/TimeoutException.php renamed to src/Exception/TimeoutException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace malkusch\lock\exception;
5+
namespace Malkusch\Lock\Exception;
66

77
/**
88
* Timeout exception.

0 commit comments

Comments
 (0)