Skip to content

Commit

Permalink
Merge pull request #120 from phil-davis/cs-fixer-3.49
Browse files Browse the repository at this point in the history
chore: use php-cs-fixer 3.51
  • Loading branch information
phil-davis authored Mar 4, 2024
2 parents 97296c3 + 45fe5fd commit 2bdd3e8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.38",
"friendsofphp/php-cs-fixer": "^3.51",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
Expand Down
4 changes: 2 additions & 2 deletions lib/EmitterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100)
* @param list<mixed> $arguments
* @param callable():bool|null $continueCallBack
*/
public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool;
public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool;

/**
* Returns the list of listeners for an event.
Expand All @@ -77,5 +77,5 @@ public function removeListener(string $eventName, callable $listener): bool;
* removed. If it is not specified, every listener for every event is
* removed.
*/
public function removeAllListeners(string $eventName = null): void;
public function removeAllListeners(?string $eventName = null): void;
}
6 changes: 3 additions & 3 deletions lib/EmitterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100)
* Lastly, if there are 5 event handlers for an event. The continueCallback
* will be called at most 4 times.
*/
public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool
public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool
{
if (\is_null($continueCallBack)) {
foreach ($this->listeners($eventName) as $listener) {
Expand Down Expand Up @@ -160,7 +160,7 @@ public function removeListener(string $eventName, callable $listener): bool
* removed. If it is not specified, every listener for every event is
* removed.
*/
public function removeAllListeners(string $eventName = null): void
public function removeAllListeners(?string $eventName = null): void
{
if (!\is_null($eventName)) {
unset($this->listeners[$eventName]);
Expand All @@ -172,7 +172,7 @@ public function removeAllListeners(string $eventName = null): void
/**
* The list of listeners.
*
* @var array<string, array{0:boolean, 1:list<mixed>, 2:list<callable>}>
* @var array<string, array{0:bool, 1:list<mixed>, 2:list<callable>}>
*/
protected array $listeners = [];
}
4 changes: 2 additions & 2 deletions lib/Loop/Loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function setTimeout(callable $cb, float $timeout): void
* The value this function returns can be used to stop the interval with
* clearInterval.
*
* @return array{0:string, 1:boolean}
* @return array{0:string, 1:bool}
*/
public function setInterval(callable $cb, float $timeout): array
{
Expand All @@ -88,7 +88,7 @@ public function setInterval(callable $cb, float $timeout): array
/**
* Stops a running interval.
*
* @param array{0:string, 1:boolean} $intervalId
* @param array{0:string, 1:bool} $intervalId
*/
public function clearInterval(array $intervalId): void
{
Expand Down
6 changes: 3 additions & 3 deletions lib/Loop/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function setTimeout(callable $cb, float $timeout): void
* The value this function returns can be used to stop the interval with
* clearInterval.
*
* @return array{0:string, 1:boolean}
* @return array{0:string, 1:bool}
*/
function setInterval(callable $cb, float $timeout): array
{
Expand All @@ -28,7 +28,7 @@ function setInterval(callable $cb, float $timeout): array
/**
* Stops a running interval.
*
* @param array{0:string, 1:boolean} $intervalId
* @param array{0:string, 1:bool} $intervalId
*/
function clearInterval(array $intervalId): void
{
Expand Down Expand Up @@ -134,7 +134,7 @@ function stop(): void
/**
* Retrieves or sets the global Loop object.
*/
function instance(Loop $newLoop = null): Loop
function instance(?Loop $newLoop = null): Loop
{
static $loop;
if ($newLoop instanceof Loop) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Promise
* Each are callbacks that map to $this->fulfill and $this->reject.
* Using the executor is optional.
*/
public function __construct(callable $executor = null)
public function __construct(?callable $executor = null)
{
if (is_callable($executor)) {
$executor(
Expand Down Expand Up @@ -84,7 +84,7 @@ public function __construct(callable $executor = null)
*
* @return Promise<TReturn>
*/
public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
{
// This new subPromise will be returned from this function, and will
// be fulfilled with the result of the onFulfilled or onRejected event
Expand Down Expand Up @@ -225,7 +225,7 @@ public function wait()
*
* @param Promise<TReturn> $subPromise
*/
private function invokeCallback(Promise $subPromise, callable $callBack = null): void
private function invokeCallback(Promise $subPromise, ?callable $callBack = null): void
{
// We use 'nextTick' to ensure that the event handlers are always
// triggered outside of the calling stack in which they were originally
Expand Down
4 changes: 2 additions & 2 deletions lib/WildcardEmitterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100)
* Lastly, if there are 5 event handlers for an event. The continueCallback
* will be called at most 4 times.
*/
public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool
public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool
{
if (\is_null($continueCallBack)) {
foreach ($this->listeners($eventName) as $listener) {
Expand Down Expand Up @@ -195,7 +195,7 @@ public function removeListener(string $eventName, callable $listener): bool
* removed. If it is not specified, every listener for every event is
* removed.
*/
public function removeAllListeners(string $eventName = null): void
public function removeAllListeners(?string $eventName = null): void
{
if (\is_null($eventName)) {
$this->listeners = [];
Expand Down

0 comments on commit 2bdd3e8

Please sign in to comment.