diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-05-08 13:51:32 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-06-02 14:07:55 +0200 |
commit | 8926bca0c7f27774959ec831c830c883bd284100 (patch) | |
tree | 93dc052a8425ff9950a87342f04a2a8231472502 /lib/private/hooks | |
parent | 6f47a547d8a86d1425b00ae0d11a692e772ec4ac (diff) | |
download | nextcloud-server-8926bca0c7f27774959ec831c830c883bd284100.tar.gz nextcloud-server-8926bca0c7f27774959ec831c830c883bd284100.zip |
phpdoc, strict and type hints
Diffstat (limited to 'lib/private/hooks')
-rw-r--r-- | lib/private/hooks/emittertrait.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/private/hooks/emittertrait.php b/lib/private/hooks/emittertrait.php index a80d7d5b03e..5d471a3f553 100644 --- a/lib/private/hooks/emittertrait.php +++ b/lib/private/hooks/emittertrait.php @@ -34,12 +34,12 @@ trait EmitterTrait { * @param string $method * @param callable $callback */ - public function listen($scope, $method, $callback) { + public function listen($scope, $method, callable $callback) { $eventName = $scope . '::' . $method; if (!isset($this->listeners[$eventName])) { $this->listeners[$eventName] = array(); } - if (array_search($callback, $this->listeners[$eventName]) === false) { + if (array_search($callback, $this->listeners[$eventName], true) === false) { $this->listeners[$eventName][] = $callback; } } @@ -49,7 +49,7 @@ trait EmitterTrait { * @param string $method optional * @param callable $callback optional */ - public function removeListener($scope = null, $method = null, $callback = null) { + public function removeListener($scope = null, $method = null, callable $callback = null) { $names = array(); $allNames = array_keys($this->listeners); if ($scope and $method) { @@ -77,7 +77,7 @@ trait EmitterTrait { foreach ($names as $name) { if ($callback) { - $index = array_search($callback, $this->listeners[$name]); + $index = array_search($callback, $this->listeners[$name], true); if ($index !== false) { unset($this->listeners[$name][$index]); } @@ -92,7 +92,7 @@ trait EmitterTrait { * @param string $method * @param array $arguments optional */ - protected function emit($scope, $method, $arguments = array()) { + protected function emit($scope, $method, array $arguments = array()) { $eventName = $scope . '::' . $method; if (isset($this->listeners[$eventName])) { foreach ($this->listeners[$eventName] as $callback) { |