From 0497534a6e5c7c856faf2f4a1939ab34a7f59a8f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 8 May 2015 14:27:22 +0200 Subject: [PATCH] more type hints --- lib/private/files/node/root.php | 4 ++-- lib/private/hooks/emitter.php | 4 ++-- lib/private/hooks/forwardingemitter.php | 4 ++-- lib/private/hooks/legacyemitter.php | 2 +- lib/private/hooks/publicemitter.php | 2 +- lib/private/user/session.php | 4 ++-- tests/lib/hooks/forwardingemitter.php | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/private/files/node/root.php b/lib/private/files/node/root.php index e47f98b0f2..7ffb3674a8 100644 --- a/lib/private/files/node/root.php +++ b/lib/private/files/node/root.php @@ -94,7 +94,7 @@ class Root extends Folder implements IRootFolder { * @param string $method * @param callable $callback */ - public function listen($scope, $method, $callback) { + public function listen($scope, $method, callable $callback) { $this->emitter->listen($scope, $method, $callback); } @@ -103,7 +103,7 @@ class Root extends Folder implements IRootFolder { * @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) { $this->emitter->removeListener($scope, $method, $callback); } diff --git a/lib/private/hooks/emitter.php b/lib/private/hooks/emitter.php index 895bd2d9ca..bea3f289b8 100644 --- a/lib/private/hooks/emitter.php +++ b/lib/private/hooks/emitter.php @@ -37,7 +37,7 @@ interface Emitter { * @param callable $callback * @return void */ - public function listen($scope, $method, $callback); + public function listen($scope, $method, callable $callback); /** * @param string $scope optional @@ -45,5 +45,5 @@ interface Emitter { * @param callable $callback optional * @return void */ - public function removeListener($scope = null, $method = null, $callback = null); + public function removeListener($scope = null, $method = null, callable $callback = null); } diff --git a/lib/private/hooks/forwardingemitter.php b/lib/private/hooks/forwardingemitter.php index 853004310f..90c1970f48 100644 --- a/lib/private/hooks/forwardingemitter.php +++ b/lib/private/hooks/forwardingemitter.php @@ -40,7 +40,7 @@ abstract class ForwardingEmitter extends BasicEmitter { * @param string $method * @param callable $callback */ - public function listen($scope, $method, $callback) { + public function listen($scope, $method, callable $callback) { parent::listen($scope, $method, $callback); foreach ($this->forwardEmitters as $emitter) { $emitter->listen($scope, $method, $callback); @@ -50,7 +50,7 @@ abstract class ForwardingEmitter extends BasicEmitter { /** * @param \OC\Hooks\Emitter $emitter */ - protected function forward($emitter) { + protected function forward(Emitter $emitter) { $this->forwardEmitters[] = $emitter; //forward all previously connected hooks diff --git a/lib/private/hooks/legacyemitter.php b/lib/private/hooks/legacyemitter.php index b0912d740d..b28854f463 100644 --- a/lib/private/hooks/legacyemitter.php +++ b/lib/private/hooks/legacyemitter.php @@ -23,7 +23,7 @@ namespace OC\Hooks; abstract class LegacyEmitter extends BasicEmitter { - protected function emit($scope, $method, $arguments = array()) { + protected function emit($scope, $method, array $arguments = array()) { \OC_Hook::emit($scope, $method, $arguments); parent::emit($scope, $method, $arguments); } diff --git a/lib/private/hooks/publicemitter.php b/lib/private/hooks/publicemitter.php index 71641c9d5e..12de07b27c 100644 --- a/lib/private/hooks/publicemitter.php +++ b/lib/private/hooks/publicemitter.php @@ -28,7 +28,7 @@ class PublicEmitter extends BasicEmitter { * @param string $method * @param array $arguments optional */ - public function emit($scope, $method, $arguments = array()) { + public function emit($scope, $method, array $arguments = array()) { parent::emit($scope, $method, $arguments); } } diff --git a/lib/private/user/session.php b/lib/private/user/session.php index a66ae6bd8a..75a884fb45 100644 --- a/lib/private/user/session.php +++ b/lib/private/user/session.php @@ -81,7 +81,7 @@ class Session implements IUserSession, Emitter { * @param string $method * @param callable $callback */ - public function listen($scope, $method, $callback) { + public function listen($scope, $method, callable $callback) { $this->manager->listen($scope, $method, $callback); } @@ -90,7 +90,7 @@ class Session implements IUserSession, Emitter { * @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) { $this->manager->removeListener($scope, $method, $callback); } diff --git a/tests/lib/hooks/forwardingemitter.php b/tests/lib/hooks/forwardingemitter.php index decf6bb354..5e8e252d3e 100644 --- a/tests/lib/hooks/forwardingemitter.php +++ b/tests/lib/hooks/forwardingemitter.php @@ -17,7 +17,7 @@ class DummyForwardingEmitter extends \OC\Hooks\ForwardingEmitter { /** * @param \OC\Hooks\Emitter $emitter */ - public function forward($emitter) { + public function forward(\OC\Hooks\Emitter $emitter) { parent::forward($emitter); } }