From 8460b91e3141e6ebb8e4e5fb40fcc5fb3f3162f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Fri, 27 Apr 2018 15:14:23 +0200 Subject: [PATCH] MDL-62241 privacy: Do not use scalar type hinting on 3.3 branch The tests do not actually do anything, they just make sure that the method signature is correct on the given PHP version. --- privacy/classes/manager.php | 4 ++-- privacy/tests/manager_test.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/privacy/classes/manager.php b/privacy/classes/manager.php index 3462409adbe..b7132e8f0bf 100644 --- a/privacy/classes/manager.php +++ b/privacy/classes/manager.php @@ -355,7 +355,7 @@ class manager { * @param string $methodname The method to call * @param array $params The params to call */ - public static function plugintype_class_callback(string $plugintype, string $interface, string $methodname, array $params) { + public static function plugintype_class_callback($plugintype, $interface, $methodname, array $params) { $components = \core_component::get_plugin_list($plugintype); foreach (array_keys($components) as $component) { static::component_class_callback("{$plugintype}_{$component}", $interface, $methodname, $params); @@ -371,7 +371,7 @@ class manager { * @param array $params The params to call * @return mixed */ - public static function component_class_callback(string $component, string $interface, string $methodname, array $params) { + public static function component_class_callback($component, $interface, $methodname, array $params) { $classname = static::get_provider_classname_for_component($component); if (class_exists($classname) && is_subclass_of($classname, $interface)) { return component_class_callback($classname, $methodname, $params); diff --git a/privacy/tests/manager_test.php b/privacy/tests/manager_test.php index 8ef4a543ced..47394d41654 100644 --- a/privacy/tests/manager_test.php +++ b/privacy/tests/manager_test.php @@ -213,4 +213,18 @@ class privacy_manager_testcase extends advanced_testcase { $this->expectException(\coding_exception::class); $string = $manager->get_null_provider_reason('mod_testcomponent'); } + + /** + * Test that manager::plugintype_class_callback() can be executed. + */ + public function test_plugintype_class_callback() { + \core_privacy\manager::plugintype_class_callback('doesnotexist', 'unusable', 'foo', ['bar']); + } + + /** + * Test that manager::component_class_callback() can be executed. + */ + public function test_component_class_callback() { + \core_privacy\manager::component_class_callback('foo_bar', 'unusable', 'foo', ['bar']); + } }