Skip to content

Commit

Permalink
Modernize code
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed May 22, 2023
1 parent 8206978 commit a86d9ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/SleeperHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ class SleeperHandler{
* @var ThreadSafeArray
* @phpstan-var ThreadSafeArray<int, int>
*/
private $sharedObject;
private readonly ThreadSafeArray $sharedObject;

/**
* @var \Closure[]
* @phpstan-var array<int, \Closure() : void>
*/
private $handlers = [];
private array $handlers = [];

/** @var int */
private $nextSleeperId = 0;
private int $nextSleeperId = 0;

public function __construct(){
$this->sharedObject = new ThreadSafeArray();
Expand Down
4 changes: 2 additions & 2 deletions src/SleeperHandlerEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ final class SleeperHandlerEntry extends ThreadSafe{
* @phpstan-param ThreadSafeArray<int, int> $sharedObject
*/
public function __construct(
private ThreadSafeArray $sharedObject,
private int $id
private readonly ThreadSafeArray $sharedObject,
private readonly int $id
){}

final public function getNotifierId() : int{
Expand Down
4 changes: 2 additions & 2 deletions src/SleeperNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ final class SleeperNotifier{
* @phpstan-param ThreadSafeArray<int, int> $sharedObject
*/
public function __construct(
private ThreadSafeArray $sharedObject,
private int $notifierId
private readonly ThreadSafeArray $sharedObject,
private readonly int $notifierId
){}

/**
Expand Down

0 comments on commit a86d9ee

Please sign in to comment.