-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
parameters: | ||
level: max | ||
|
||
paths: | ||
- src/ | ||
- test/types/ | ||
|
||
fileExtensions: | ||
- php |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,8 @@ | |
|
||
interface DisposableInterface | ||
{ | ||
/** | ||
* @return void | ||
*/ | ||
public function dispose(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,17 +9,14 @@ | |
*/ | ||
abstract class Notification | ||
{ | ||
private $kind; | ||
|
||
/** | ||
* @param mixed $kind Kind of notification | ||
* @template T | ||
* @param (callable(T): void)|ObserverInterface $observerOrOnNext | ||
* @param (callable(\Throwable): void) $onError | ||
* @param (callable(): void) $onCompleted | ||
* @return void | ||
*/ | ||
public function __construct($kind) | ||
{ | ||
$this->kind = $kind; | ||
} | ||
|
||
public function accept($observerOrOnNext, $onError = null, $onCompleted = null) | ||
public function accept(callable $observerOrOnNext, callable $onError = null, callable $onCompleted = null) | ||
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.3 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.3 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.2 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.2 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.2 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.2 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.1 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.1 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.4 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.4 on ubuntu-20.04)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.2 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.2 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.4 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.4 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.1 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8.1 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.3 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.3 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 8 on windows-2019)
Check failure on line 19 in src/Notification.php GitHub Actions / PHPStan (PHP 7.2 on windows-2019)
|
||
{ | ||
if (null === $onError && null === $onCompleted && $observerOrOnNext instanceof ObserverInterface) { | ||
$this->doAcceptObservable($observerOrOnNext); | ||
|
@@ -35,7 +32,17 @@ public function equals($other): bool | |
return (string)$this === (string)$other; | ||
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 7.3 on ubuntu-20.04)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 8 on ubuntu-20.04)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 7.2 on ubuntu-20.04)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 8.2 on ubuntu-20.04)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 8.1 on ubuntu-20.04)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 7.4 on ubuntu-20.04)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 8.2 on windows-2019)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 7.4 on windows-2019)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 8.1 on windows-2019)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 7.3 on windows-2019)
Check failure on line 32 in src/Notification.php GitHub Actions / PHPStan (PHP 8 on windows-2019)
|
||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
abstract protected function doAcceptObservable(ObserverInterface $observer); | ||
|
||
abstract protected function doAccept($onNext, $onError, $onCompleted); | ||
/** | ||
* @template T | ||
* @param (callable(T): void) $onNext | ||
* @param (callable(\Throwable): void) $onError | ||
* @param (callable(): void) $onCompleted | ||
* @return void | ||
*/ | ||
abstract protected function doAccept(callable $onNext, callable $onError, callable $onCompleted); | ||
} |