aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/EventSource.php30
-rw-r--r--lib/private/EventSourceFactory.php3
-rw-r--r--lib/public/IEventSource.php2
3 files changed, 15 insertions, 20 deletions
diff --git a/lib/private/EventSource.php b/lib/private/EventSource.php
index 9a62d13a938..b5ab22d026e 100644
--- a/lib/private/EventSource.php
+++ b/lib/private/EventSource.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -34,28 +36,16 @@ use OCP\IEventSource;
use OCP\IRequest;
class EventSource implements IEventSource {
- /**
- * @var bool
- */
- private $fallback;
-
- /**
- * @var int
- */
- private $fallBackId = 0;
-
- /**
- * @var bool
- */
- private $started = false;
-
- private IRequest $request;
+ private bool $fallback = false;
+ private int $fallBackId = 0;
+ private bool $started = false;
- public function __construct(IRequest $request) {
- $this->request = $request;
+ public function __construct(
+ private IRequest $request,
+ ) {
}
- protected function init() {
+ protected function init(): void {
if ($this->started) {
return;
}
@@ -108,7 +98,7 @@ class EventSource implements IEventSource {
*/
public function send($type, $data = null) {
if ($data and !preg_match('/^[A-Za-z0-9_]+$/', $type)) {
- throw new BadMethodCallException('Type needs to be alphanumeric ('. $type .')');
+ throw new \BadMethodCallException('Type needs to be alphanumeric ('. $type .')');
}
$this->init();
if (is_null($data)) {
diff --git a/lib/private/EventSourceFactory.php b/lib/private/EventSourceFactory.php
index 2fff93f7176..52ed0749692 100644
--- a/lib/private/EventSourceFactory.php
+++ b/lib/private/EventSourceFactory.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2023 Daniel Kesselberg <mail@danielkesselberg.de>
*
diff --git a/lib/public/IEventSource.php b/lib/public/IEventSource.php
index 879b365cc77..f24c0311f24 100644
--- a/lib/public/IEventSource.php
+++ b/lib/public/IEventSource.php
@@ -37,6 +37,7 @@ interface IEventSource {
*
* @param string $type One of success, notice, error, failure and done. Used in core/js/update.js
* @param mixed $data
+ * @return void
*
* if only one parameter is given, a typeless message will be send with that parameter as data
* @since 8.0.0
@@ -45,6 +46,7 @@ interface IEventSource {
/**
* close the connection of the event source
+ * @return void
* @since 8.0.0
*/
public function close();