aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Hooks/EmitterTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Hooks/EmitterTrait.php')
-rw-r--r--lib/private/Hooks/EmitterTrait.php29
1 files changed, 6 insertions, 23 deletions
diff --git a/lib/private/Hooks/EmitterTrait.php b/lib/private/Hooks/EmitterTrait.php
index de012cca044..7b2ec4ad7fe 100644
--- a/lib/private/Hooks/EmitterTrait.php
+++ b/lib/private/Hooks/EmitterTrait.php
@@ -1,25 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Hooks;
@@ -27,7 +11,6 @@ namespace OC\Hooks;
* @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service
*/
trait EmitterTrait {
-
/**
* @var callable[][] $listeners
*/
@@ -44,7 +27,7 @@ trait EmitterTrait {
if (!isset($this->listeners[$eventName])) {
$this->listeners[$eventName] = [];
}
- if (array_search($callback, $this->listeners[$eventName], true) === false) {
+ if (!in_array($callback, $this->listeners[$eventName], true)) {
$this->listeners[$eventName][] = $callback;
}
}
@@ -55,7 +38,7 @@ trait EmitterTrait {
* @param callable $callback optional
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
*/
- public function removeListener($scope = null, $method = null, callable $callback = null) {
+ public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$names = [];
$allNames = array_keys($this->listeners);
if ($scope and $method) {