Skip to content

Commit bde0048

Browse files
committed
update code style
1 parent 06862c1 commit bde0048

9 files changed

+15
-24
lines changed

composer.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
parameters:
2-
ignoreErrors:
3-
-
4-
message: '#PHPDoc tag @return contains unresolvable type#'
5-
path: %currentWorkingDirectory%/src

psalm.xml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
useDocblockPropertyTypes="true"
66
allowPhpStormGenerics="true"
77
requireVoidReturnType="true"
8+
strictBinaryOperands="true"
89
ignoreInternalFunctionFalseReturn="false"
910
ignoreInternalFunctionNullReturn="false"
1011
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

src/AmpLock.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class AmpLock implements Lock
3232
*
3333
* @var \Closure|null
3434
*/
35-
private ?\Closure $releaser;
35+
private ?\Closure $releaser = null;
3636

3737
public function __construct(string $id, ?\Closure $releaser)
3838
{
@@ -45,7 +45,7 @@ public function __construct(string $id, ?\Closure $releaser)
4545
*/
4646
public function released(): bool
4747
{
48-
return null === $this->releaser;
48+
return $this->releaser === null;
4949
}
5050

5151
/**
@@ -64,7 +64,7 @@ public function release(): Promise
6464
return call(
6565
function (): \Generator
6666
{
67-
if (true === isset($this->releaser))
67+
if ($this->releaser !== null)
6868
{
6969
$releaser = $this->releaser;
7070
$this->releaser = null;
@@ -77,7 +77,7 @@ function (): \Generator
7777

7878
public function __destruct()
7979
{
80-
if (true === isset($this->releaser))
80+
if ($this->releaser !== null)
8181
{
8282
$this->release();
8383
}

src/FilesystemMutex.php

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ public function __destruct()
7272
}
7373

7474
/**
75-
* @psalm-suppress MixedTypeCoercion
76-
*
7775
* {@inheritdoc}
7876
*/
7977
public function acquire(): Promise

src/InMemoryMutex.php

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ public function __destruct()
4444
}
4545

4646
/**
47-
* @psalm-suppress MixedTypeCoercion
48-
*
4947
* {@inheritdoc}
5048
*/
5149
public function acquire(): Promise

src/Lock.php

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public function released(): bool;
3333

3434
/**
3535
* Releases the lock. No-op if the lock has already been released.
36-
*
37-
* @return Promise
3836
*/
3937
public function release(): Promise;
4038
}

src/Mutex.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ interface Mutex
2222
/**
2323
* Acquires a lock on the mutex.
2424
*
25-
* @throws \ServiceBus\Mutex\Exceptions\SyncException An error occurs when attempting to obtain the lock
25+
* Returns \ServiceBus\Mutex\Lock
2626
*
27-
* @return \Amp\Promise<\ServiceBus\Mutex\Lock>
27+
* @throws \ServiceBus\Mutex\Exceptions\SyncException An error occurs when attempting to obtain the lock
2828
*/
2929
public function acquire(): Promise;
3030
}

src/Storage/InMemoryMutexStorage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ final class InMemoryMutexStorage
2222
*/
2323
private array $localStorage = [];
2424

25-
private static ?self $instance;
25+
private static ?self $instance = null;
2626

2727
/**
2828
* @return self
2929
*/
3030
public static function instance(): self
3131
{
32-
if (false === isset(self::$instance))
32+
if (self::$instance === null)
3333
{
3434
self::$instance = new self();
3535
}

0 commit comments

Comments
 (0)