From 84cfc8beebe1351b2671cb7b412b8939391d9d99 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 22 Sep 2023 11:08:02 +0800 Subject: [PATCH] MDL-78129 communication: Fix all phpcs isuses This is a brand new subsystem, plugin-type, and plugin. They are written from the ground up by us. They should not contain any coding style violations. --- .../manage_communication_providers_page.php | 41 +++++++++++++------ communication/classes/api.php | 18 ++++---- .../classes/communication_provider.php | 1 - communication/classes/form/configure_form.php | 3 +- communication/classes/form_provider.php | 1 - communication/classes/privacy/provider.php | 8 ++-- communication/classes/processor.php | 3 +- communication/classes/room_chat_provider.php | 1 - .../classes/task/add_members_to_room_task.php | 3 +- .../task/create_and_configure_room_task.php | 3 +- .../classes/task/delete_room_task.php | 3 +- .../classes/task/remove_members_from_room.php | 3 +- .../task/update_room_membership_task.php | 3 +- .../classes/task/update_room_task.php | 3 +- communication/classes/user_provider.php | 1 - communication/configure.php | 5 +-- .../classes/communication_feature.php | 21 ++++++---- .../customlink/classes/privacy/provider.php | 1 - .../tests/communication_feature_test.php | 1 - .../matrix/classes/communication_feature.php | 15 +++---- .../spec/features/matrix/create_room_v3.php | 1 - .../features/matrix/get_room_members_v3.php | 1 - .../get_room_powerlevels_from_sync_v3.php | 1 - .../spec/features/matrix/media_create_v1.php | 1 - .../matrix/remove_member_from_room_v3.php | 1 - .../features/matrix/update_room_avatar_v3.php | 2 - .../features/matrix/update_room_name_v3.php | 1 - .../matrix/update_room_power_levels_v3.php | 2 - .../features/matrix/update_room_topic_v3.php | 2 - .../features/matrix/upload_content_v3.php | 1 - .../spec/features/synapse/create_user_v2.php | 2 - .../features/synapse/get_room_info_v1.php | 1 - .../features/synapse/get_user_info_v2.php | 2 - .../synapse/invite_member_to_room_v1.php | 1 - .../matrix/classes/local/spec/v1p7.php | 1 - .../provider/matrix/classes/matrix_client.php | 1 - .../matrix/classes/matrix_constants.php | 1 - .../provider/matrix/classes/matrix_room.php | 1 - .../matrix/classes/matrix_user_manager.php | 7 ++-- .../matrix/classes/privacy/provider.php | 1 - communication/provider/matrix/db/access.php | 2 +- communication/provider/matrix/db/upgrade.php | 1 - .../behat/behat_communication_matrix.php | 3 +- .../tests/communication_feature_test.php | 3 ++ .../matrix/tests/local/command_test.php | 2 +- .../matrix/tests/matrix_client_test.php | 2 +- .../matrix/tests/matrix_client_test_trait.php | 2 +- .../matrix/tests/matrix_room_test.php | 2 - .../matrix/tests/matrix_test_helper_trait.php | 20 +++++---- communication/tests/api_test.php | 5 +-- .../tests/behat/behat_communication.php | 3 +- .../tests/communication_test_helper_trait.php | 3 +- communication/tests/processor_test.php | 14 ++++--- 53 files changed, 108 insertions(+), 123 deletions(-) diff --git a/communication/classes/admin/manage_communication_providers_page.php b/communication/classes/admin/manage_communication_providers_page.php index 384f8d2b12a..d84c4defae5 100644 --- a/communication/classes/admin/manage_communication_providers_page.php +++ b/communication/classes/admin/manage_communication_providers_page.php @@ -32,11 +32,14 @@ use moodle_url; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class manage_communication_providers_page extends admin_setting { - public function __construct() { $this->nosave = true; - parent::__construct('managecommunications', - new \lang_string('managecommunicationproviders', 'core_communication'), '', ''); + parent::__construct( + 'managecommunications', + new \lang_string('managecommunicationproviders', 'core_communication'), + '', + '' + ); } public function get_setting(): bool { @@ -71,20 +74,26 @@ class manage_communication_providers_page extends admin_setting { foreach ($plugins as $plugin) { $class = ''; $actionurl = new moodle_url('/admin/communication.php', ['sesskey' => sesskey(), 'name' => $plugin->name]); - if ($pluginmanager->get_plugin_info('communication_' . $plugin->name)->get_status() === - core_plugin_manager::PLUGIN_STATUS_MISSING) { + if ( + $pluginmanager->get_plugin_info('communication_' . $plugin->name)->get_status() === + core_plugin_manager::PLUGIN_STATUS_MISSING + ) { $strtypename = $plugin->displayname . ' (' . get_string('missingfromdisk') . ')'; } else { $strtypename = $plugin->displayname; } if ($plugin->is_enabled()) { - $hideshow = html_writer::link($actionurl->out(false, ['action' => 'disable']), - $OUTPUT->pix_icon('t/hide', get_string('disable'), 'moodle', ['class' => 'iconsmall'])); + $hideshow = html_writer::link( + $actionurl->out(false, ['action' => 'disable']), + $OUTPUT->pix_icon('t/hide', get_string('disable'), 'moodle', ['class' => 'iconsmall']) + ); } else { $class = 'dimmed_text'; - $hideshow = html_writer::link($actionurl->out(false, ['action' => 'enable']), - $OUTPUT->pix_icon('t/show', get_string('enable'), 'moodle', ['class' => 'iconsmall'])); + $hideshow = html_writer::link( + $actionurl->out(false, ['action' => 'enable']), + $OUTPUT->pix_icon('t/show', get_string('enable'), 'moodle', ['class' => 'iconsmall']) + ); } $settings = ''; @@ -93,8 +102,12 @@ class manage_communication_providers_page extends admin_setting { } $uninstall = ''; - if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url( - 'communication_' . $plugin->name, 'manage')) { + if ( + $uninstallurl = core_plugin_manager::instance()->get_uninstall_url( + 'communication_' . $plugin->name, + 'manage' + ) + ) { $uninstall = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin')); } @@ -114,8 +127,10 @@ class manage_communication_providers_page extends admin_setting { } $types = core_plugin_manager::instance()->get_plugins_of_type('communication'); foreach ($types as $type) { - if (strpos($type->component, $query) !== false || - strpos(core_text::strtolower($type->displayname), $query) !== false) { + if ( + strpos($type->component, $query) !== false || + strpos(core_text::strtolower($type->displayname), $query) !== false + ) { return true; } } diff --git a/communication/classes/api.php b/communication/classes/api.php index 4d2fa922666..0a285314530 100644 --- a/communication/classes/api.php +++ b/communication/classes/api.php @@ -40,7 +40,6 @@ use stdClass; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class api { - /** * @var null|processor $communication The communication settings object */ @@ -167,7 +166,7 @@ class api { $selection[processor::PROVIDER_NONE] = get_string('nocommunicationselected', 'communication'); $communicationplugins = \core\plugininfo\communication::get_enabled_plugins(); foreach ($communicationplugins as $pluginname => $notusing) { - $selection['communication_' . $pluginname] = get_string('pluginname', 'communication_'. $pluginname); + $selection['communication_' . $pluginname] = get_string('pluginname', 'communication_' . $pluginname); } return $selection; } @@ -200,8 +199,7 @@ class api { ): void { global $PAGE; - list($communicationproviders, $defaulprovider) = self:: - get_enabled_providers_and_default($selectdefaultcommunication); + [$communicationproviders, $defaulprovider] = self::get_enabled_providers_and_default($selectdefaultcommunication); $PAGE->requires->js_call_amd('core_communication/providerchooser', 'init'); @@ -217,10 +215,12 @@ class api { $mform->setDefault('selectedcommunication', $defaulprovider); $mform->registerNoSubmitButton('updatecommunicationprovider'); - $mform->addElement('submit', + $mform->addElement( + 'submit', 'updatecommunicationprovider', 'update communication', - ['data-communicationchooser-field' => 'updateButton', 'class' => 'd-none',]); + ['data-communicationchooser-field' => 'updateButton', 'class' => 'd-none'] + ); // Just a placeholder for the communication options. $mform->addElement('hidden', 'addcommunicationoptionshere'); @@ -242,7 +242,9 @@ class api { $mform->createElement( 'text', 'communicationroomname', - get_string('communicationroomname', 'communication'), 'maxlength="100" size="20"'), + get_string('communicationroomname', 'communication'), + 'maxlength="100" size="20"' + ), 'addcommunicationoptionshere' ); $mform->addHelpButton('communicationroomname', 'communicationroomname', 'communication'); @@ -250,7 +252,6 @@ class api { processor::set_proider_form_definition($provider[0], $mform); } - } /** @@ -613,7 +614,6 @@ class api { switch ($roomstatus) { case 'pending': - \core\notification::add($message, \core\notification::INFO); break; diff --git a/communication/classes/communication_provider.php b/communication/classes/communication_provider.php index 3fa7127a18d..2023ee3cb5e 100644 --- a/communication/classes/communication_provider.php +++ b/communication/classes/communication_provider.php @@ -28,7 +28,6 @@ namespace core_communication; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ interface communication_provider { - /** * A base communication provider. * diff --git a/communication/classes/form/configure_form.php b/communication/classes/form/configure_form.php index e3cc7f6a4e7..d7fe9a2b943 100644 --- a/communication/classes/form/configure_form.php +++ b/communication/classes/form/configure_form.php @@ -26,13 +26,12 @@ namespace core_communication\form; defined('MOODLE_INTERNAL') || die(); -require_once($CFG->libdir.'/formslib.php'); +require_once($CFG->libdir . '/formslib.php'); /** * Defines the configure communication form. */ class configure_form extends \moodleform { - /** * @var \core_communication\api $communication The communication api object. */ diff --git a/communication/classes/form_provider.php b/communication/classes/form_provider.php index 052608ae675..a4c535d5e6d 100644 --- a/communication/classes/form_provider.php +++ b/communication/classes/form_provider.php @@ -26,7 +26,6 @@ namespace core_communication; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ interface form_provider { - /** * Set the form data to the instance if any data is available. * diff --git a/communication/classes/privacy/provider.php b/communication/classes/privacy/provider.php index ccc426407f0..9c7f4d1659a 100644 --- a/communication/classes/privacy/provider.php +++ b/communication/classes/privacy/provider.php @@ -29,10 +29,10 @@ use core_privacy\local\request\userlist; * @copyright 2023 Huong Nguyen * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class provider implements \core_privacy\local\metadata\provider, - \core_privacy\local\request\subsystem\provider, - \core_privacy\local\request\core_userlist_provider { - +class provider implements + \core_privacy\local\request\core_userlist_provider, + \core_privacy\local\metadata\provider, + \core_privacy\local\request\subsystem\provider { public static function get_metadata(collection $collection): collection { $collection->add_database_table('communication_user', [ diff --git a/communication/classes/processor.php b/communication/classes/processor.php index bde03737975..814678b1c10 100644 --- a/communication/classes/processor.php +++ b/communication/classes/processor.php @@ -29,7 +29,6 @@ use stored_file; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class processor { - /** @var string The magic 'none' provider */ public const PROVIDER_NONE = 'none'; @@ -324,7 +323,7 @@ class processor { $DB->delete_records_select( 'communication_user', - 'commid = ? AND userid IN (' . implode(',', $userids) . ') AND synced = ?' , + 'commid = ? AND userid IN (' . implode(',', $userids) . ') AND synced = ?', [$this->instancedata->id, 0] ); } diff --git a/communication/classes/room_chat_provider.php b/communication/classes/room_chat_provider.php index 234b1c2fc8b..7e1e127a510 100644 --- a/communication/classes/room_chat_provider.php +++ b/communication/classes/room_chat_provider.php @@ -26,7 +26,6 @@ namespace core_communication; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ interface room_chat_provider { - /** * Create a provider room when a instance is created. */ diff --git a/communication/classes/task/add_members_to_room_task.php b/communication/classes/task/add_members_to_room_task.php index b49931c6b18..f11cbc04bb5 100644 --- a/communication/classes/task/add_members_to_room_task.php +++ b/communication/classes/task/add_members_to_room_task.php @@ -27,7 +27,6 @@ use core_communication\processor; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class add_members_to_room_task extends adhoc_task { - public function execute() { // Initialize the custom data operation to be used for the action. $data = $this->get_custom_data(); @@ -55,7 +54,7 @@ class add_members_to_room_task extends adhoc_task { // Add ad-hoc task to update the provider room. $task = new self(); $task->set_custom_data([ - 'id' => $communication->get_id() + 'id' => $communication->get_id(), ]); // Queue the task for the next run. diff --git a/communication/classes/task/create_and_configure_room_task.php b/communication/classes/task/create_and_configure_room_task.php index a65dfee5d46..1646eef8d82 100644 --- a/communication/classes/task/create_and_configure_room_task.php +++ b/communication/classes/task/create_and_configure_room_task.php @@ -29,7 +29,6 @@ use core_communication\processor; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class create_and_configure_room_task extends adhoc_task { - public function execute() { $data = $this->get_custom_data(); @@ -66,7 +65,7 @@ class create_and_configure_room_task extends adhoc_task { // Add ad-hoc task to update the provider room. $task = new self(); $task->set_custom_data([ - 'id' => $communication->get_id() + 'id' => $communication->get_id(), ]); // Queue the task for the next run. diff --git a/communication/classes/task/delete_room_task.php b/communication/classes/task/delete_room_task.php index fea70c04a68..d8cb3eb9445 100644 --- a/communication/classes/task/delete_room_task.php +++ b/communication/classes/task/delete_room_task.php @@ -29,7 +29,6 @@ use core_communication\processor; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class delete_room_task extends adhoc_task { - public function execute() { $data = $this->get_custom_data(); @@ -63,7 +62,7 @@ class delete_room_task extends adhoc_task { // Add ad-hoc task to update the provider room. $task = new self(); $task->set_custom_data([ - 'id' => $communication->get_id() + 'id' => $communication->get_id(), ]); // Queue the task for the next run. diff --git a/communication/classes/task/remove_members_from_room.php b/communication/classes/task/remove_members_from_room.php index 72866b40e2e..1d6d444c3db 100644 --- a/communication/classes/task/remove_members_from_room.php +++ b/communication/classes/task/remove_members_from_room.php @@ -27,7 +27,6 @@ use core_communication\processor; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class remove_members_from_room extends adhoc_task { - public function execute() { // Initialize the custom data operation to be used for the action. $data = $this->get_custom_data(); @@ -58,7 +57,7 @@ class remove_members_from_room extends adhoc_task { // Add ad-hoc task to update the provider room. $task = new self(); $task->set_custom_data([ - 'id' => $communication->get_id() + 'id' => $communication->get_id(), ]); // Queue the task for the next run. diff --git a/communication/classes/task/update_room_membership_task.php b/communication/classes/task/update_room_membership_task.php index e65136d8e15..eb62f09ceb0 100644 --- a/communication/classes/task/update_room_membership_task.php +++ b/communication/classes/task/update_room_membership_task.php @@ -27,7 +27,6 @@ use core_communication\processor; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class update_room_membership_task extends adhoc_task { - public function execute() { // Initialize the custom data operation to be used for the action. $data = $this->get_custom_data(); @@ -55,7 +54,7 @@ class update_room_membership_task extends adhoc_task { // Add ad-hoc task to update the provider room. $task = new self(); $task->set_custom_data([ - 'id' => $communication->get_id() + 'id' => $communication->get_id(), ]); // Queue the task for the next run. diff --git a/communication/classes/task/update_room_task.php b/communication/classes/task/update_room_task.php index b487e28e4d9..bb2cb18edbb 100644 --- a/communication/classes/task/update_room_task.php +++ b/communication/classes/task/update_room_task.php @@ -29,7 +29,6 @@ use core_communication\processor; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class update_room_task extends adhoc_task { - public function execute() { $data = $this->get_custom_data(); @@ -56,7 +55,7 @@ class update_room_task extends adhoc_task { // Add ad-hoc task to update the provider room. $task = new self(); $task->set_custom_data([ - 'id' => $communication->get_id() + 'id' => $communication->get_id(), ]); // Queue the task for the next run. diff --git a/communication/classes/user_provider.php b/communication/classes/user_provider.php index d59df679f61..4817f1d9a5e 100644 --- a/communication/classes/user_provider.php +++ b/communication/classes/user_provider.php @@ -24,7 +24,6 @@ namespace core_communication; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ interface user_provider { - /** * Create members. * diff --git a/communication/configure.php b/communication/configure.php index 36724e082f8..d6f1f27a38b 100644 --- a/communication/configure.php +++ b/communication/configure.php @@ -51,7 +51,7 @@ if (!$communication) { } // Set variables according to the component callback and use them on the page. -list($instance, $context, $heading, $returnurl) = component_callback( +[$instance, $context, $heading, $returnurl] = component_callback( $component, 'get_communication_instance_data', [$instanceid] @@ -70,11 +70,8 @@ $instanceinfo['instance'] = $instance; $form = new \core_communication\form\configure_form(null, $instanceinfo); if ($form->is_cancelled()) { - redirect($returnurl); - } else if ($data = $form->get_data()) { - component_callback($component, 'update_communication_instance_data', [$data]); redirect($returnurl); } diff --git a/communication/provider/customlink/classes/communication_feature.php b/communication/provider/customlink/classes/communication_feature.php index a85a320a72a..3250be4a60a 100644 --- a/communication/provider/customlink/classes/communication_feature.php +++ b/communication/provider/customlink/classes/communication_feature.php @@ -27,9 +27,8 @@ use core_communication\processor; */ class communication_feature implements \core_communication\communication_provider, - \core_communication\room_chat_provider, - \core_communication\form_provider { - + \core_communication\form_provider, + \core_communication\room_chat_provider { /** @var string The database table storing custom link specific data */ protected const CUSTOMLINK_TABLE = 'communication_customlink'; @@ -132,7 +131,6 @@ class communication_feature implements // Create the record if it does not exist. $newrecord->commid = $commid; $DB->insert_record(self::CUSTOMLINK_TABLE, $newrecord); - } else if ($newrecord->url !== $existingrecord->url) { // Update record if the URL has changed. $newrecord->id = $existingrecord->id; @@ -154,15 +152,22 @@ class communication_feature implements public static function set_form_definition(\MoodleQuickForm $mform): void { // Custom link description for the communication provider. - $mform->insertElementBefore($mform->createElement('text', 'customlinkurl', + $mform->insertElementBefore($mform->createElement( + 'text', + 'customlinkurl', get_string('customlinkurl', 'communication_customlink'), - 'maxlength="255" size="40"'), 'addcommunicationoptionshere'); + 'maxlength="255" size="40"' + ), 'addcommunicationoptionshere'); $mform->addHelpButton('customlinkurl', 'customlinkurl', 'communication_customlink'); $mform->setType('customlinkurl', PARAM_URL); $mform->addRule('customlinkurl', get_string('required'), 'required', null, 'client'); $mform->addRule('customlinkurl', get_string('maximumchars', '', 255), 'maxlength', 255); - $mform->insertElementBefore($mform->createElement('static', 'customlinkurlinfo', '', + $mform->insertElementBefore($mform->createElement( + 'static', + 'customlinkurlinfo', + '', get_string('customlinkurlinfo', 'communication_customlink'), - 'addcommunicationoptionshere'), 'addcommunicationoptionshere'); + 'addcommunicationoptionshere' + ), 'addcommunicationoptionshere'); } } diff --git a/communication/provider/customlink/classes/privacy/provider.php b/communication/provider/customlink/classes/privacy/provider.php index 898502d85e7..f2b18cc92d0 100644 --- a/communication/provider/customlink/classes/privacy/provider.php +++ b/communication/provider/customlink/classes/privacy/provider.php @@ -26,7 +26,6 @@ use core_privacy\local\metadata\null_provider; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements null_provider { - /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. diff --git a/communication/provider/customlink/tests/communication_feature_test.php b/communication/provider/customlink/tests/communication_feature_test.php index 60d0cbd21cd..e3957e38c4f 100644 --- a/communication/provider/customlink/tests/communication_feature_test.php +++ b/communication/provider/customlink/tests/communication_feature_test.php @@ -33,7 +33,6 @@ require_once(__DIR__ . '/../../../tests/communication_test_helper_trait.php'); * @coversDefaultClass \communication_customlink\communication_feature */ class communication_feature_test extends \advanced_testcase { - use communication_test_helper_trait; public function setUp(): void { diff --git a/communication/provider/matrix/classes/communication_feature.php b/communication/provider/matrix/classes/communication_feature.php index 8d9632f7518..92cf7a00fd1 100644 --- a/communication/provider/matrix/classes/communication_feature.php +++ b/communication/provider/matrix/classes/communication_feature.php @@ -45,11 +45,10 @@ use GuzzleHttp\Psr7\Response; */ class communication_feature implements \core_communication\communication_provider, - \core_communication\user_provider, + \core_communication\form_provider, \core_communication\room_chat_provider, \core_communication\room_user_provider, - \core_communication\form_provider { - + \core_communication\user_provider { /** @var ?matrix_room $room The matrix room object to update room information */ private ?matrix_room $room = null; @@ -166,7 +165,7 @@ class communication_feature implements threepids: [(object) [ 'medium' => 'email', 'address' => $user->email, - ]], + ], ], externalids: [], ); $body = json_decode($response->getBody()); @@ -542,9 +541,12 @@ class communication_feature implements public static function set_form_definition(\MoodleQuickForm $mform): void { // Room description for the communication provider. - $mform->insertElementBefore($mform->createElement('text', 'matrixroomtopic', + $mform->insertElementBefore($mform->createElement( + 'text', + 'matrixroomtopic', get_string('matrixroomtopic', 'communication_matrix'), - 'maxlength="255" size="20"'), 'addcommunicationoptionshere'); + 'maxlength="255" size="20"' + ), 'addcommunicationoptionshere'); $mform->addHelpButton('matrixroomtopic', 'matrixroomtopic', 'communication_matrix'); $mform->setType('matrixroomtopic', PARAM_TEXT); } @@ -645,7 +647,6 @@ class communication_feature implements } }, ); - } /** diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/create_room_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/create_room_v3.php index 57980c8d121..b410900c689 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/create_room_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/create_room_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait create_room_v3 { - /** * Create a new room. * diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/get_room_members_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/get_room_members_v3.php index 60da91df446..1ad00326c24 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/get_room_members_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/get_room_members_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait get_room_members_v3 { - /** * Get a list of room members. * diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/get_room_powerlevels_from_sync_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/get_room_powerlevels_from_sync_v3.php index 471619f8623..a01765d4379 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/get_room_powerlevels_from_sync_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/get_room_powerlevels_from_sync_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait get_room_powerlevels_from_sync_v3 { - /** * Get a list of room members. * diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/media_create_v1.php b/communication/provider/matrix/classes/local/spec/features/matrix/media_create_v1.php index c47f0142112..dfcfb57731e 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/media_create_v1.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/media_create_v1.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait media_create_v1 { - /** * Create a media URI. * diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/remove_member_from_room_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/remove_member_from_room_v3.php index 89e6b89cc9d..fa331e19f43 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/remove_member_from_room_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/remove_member_from_room_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait remove_member_from_room_v3 { - /** * Remove a member from a room. * diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_avatar_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_avatar_v3.php index 1df828f793e..f7fe1239cf3 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_avatar_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_avatar_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait update_room_avatar_v3 { - /** * Set the avatar for a room to the specified URL. * @@ -56,5 +55,4 @@ trait update_room_avatar_v3 { params: $params, )); } - } diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_name_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_name_v3.php index e7235ed9a89..674de6f71ad 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_name_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_name_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait update_room_name_v3 { - /** * Set the name for a room. * diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_power_levels_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_power_levels_v3.php index e840de49ce1..0f903756bf9 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_power_levels_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_power_levels_v3.php @@ -34,7 +34,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait update_room_power_levels_v3 { - /** * Set the avatar for a room to the specified URL. * @@ -75,5 +74,4 @@ trait update_room_power_levels_v3 { params: $params, )); } - } diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_topic_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_topic_v3.php index c68f45316a1..fddacd0cb76 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/update_room_topic_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/update_room_topic_v3.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait update_room_topic_v3 { - /** * Set the topic for a room. * @@ -51,6 +50,5 @@ trait update_room_topic_v3 { endpoint: '_matrix/client/v3/rooms/:roomid/state/m.room.topic', params: $params, )); - } } diff --git a/communication/provider/matrix/classes/local/spec/features/matrix/upload_content_v3.php b/communication/provider/matrix/classes/local/spec/features/matrix/upload_content_v3.php index f44df6e342d..a553ed372f8 100644 --- a/communication/provider/matrix/classes/local/spec/features/matrix/upload_content_v3.php +++ b/communication/provider/matrix/classes/local/spec/features/matrix/upload_content_v3.php @@ -32,7 +32,6 @@ use GuzzleHttp\Psr7\Utils; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait upload_content_v3 { - /** * Upload the content in the matrix/synapse server. * diff --git a/communication/provider/matrix/classes/local/spec/features/synapse/create_user_v2.php b/communication/provider/matrix/classes/local/spec/features/synapse/create_user_v2.php index 9d89a1a857c..75407b47c23 100644 --- a/communication/provider/matrix/classes/local/spec/features/synapse/create_user_v2.php +++ b/communication/provider/matrix/classes/local/spec/features/synapse/create_user_v2.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait create_user_v2 { - /** * Create a new user. * @@ -63,5 +62,4 @@ trait create_user_v2 { params: $params, )); } - } diff --git a/communication/provider/matrix/classes/local/spec/features/synapse/get_room_info_v1.php b/communication/provider/matrix/classes/local/spec/features/synapse/get_room_info_v1.php index 4903c4d632d..1201ac9831a 100644 --- a/communication/provider/matrix/classes/local/spec/features/synapse/get_room_info_v1.php +++ b/communication/provider/matrix/classes/local/spec/features/synapse/get_room_info_v1.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait get_room_info_v1 { - /** * Get room info. * diff --git a/communication/provider/matrix/classes/local/spec/features/synapse/get_user_info_v2.php b/communication/provider/matrix/classes/local/spec/features/synapse/get_user_info_v2.php index 2b73867c90d..67e2796acfa 100644 --- a/communication/provider/matrix/classes/local/spec/features/synapse/get_user_info_v2.php +++ b/communication/provider/matrix/classes/local/spec/features/synapse/get_user_info_v2.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait get_user_info_v2 { - /** * Get user info. * @@ -49,5 +48,4 @@ trait get_user_info_v2 { ], )); } - } diff --git a/communication/provider/matrix/classes/local/spec/features/synapse/invite_member_to_room_v1.php b/communication/provider/matrix/classes/local/spec/features/synapse/invite_member_to_room_v1.php index bce95b7eb4a..ad002ca0f9c 100644 --- a/communication/provider/matrix/classes/local/spec/features/synapse/invite_member_to_room_v1.php +++ b/communication/provider/matrix/classes/local/spec/features/synapse/invite_member_to_room_v1.php @@ -31,7 +31,6 @@ use GuzzleHttp\Psr7\Response; * This code does not warrant being tested. Testing offers no discernible benefit given its usage is tested. */ trait invite_member_to_room_v1 { - /** * Join a user to a room. * diff --git a/communication/provider/matrix/classes/local/spec/v1p7.php b/communication/provider/matrix/classes/local/spec/v1p7.php index 0f2acf82c81..f4f2195d536 100644 --- a/communication/provider/matrix/classes/local/spec/v1p7.php +++ b/communication/provider/matrix/classes/local/spec/v1p7.php @@ -30,6 +30,5 @@ class v1p7 extends v1p6 { // Note: A new Content Upload API was introduced. // See details in the spec: // https://github.com/matrix-org/matrix-spec-proposals/pull/2246. - use features\matrix\media_create_v1; } diff --git a/communication/provider/matrix/classes/matrix_client.php b/communication/provider/matrix/classes/matrix_client.php index 206fe08cff6..a168240fe95 100644 --- a/communication/provider/matrix/classes/matrix_client.php +++ b/communication/provider/matrix/classes/matrix_client.php @@ -36,7 +36,6 @@ use GuzzleHttp\Psr7\Response; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class matrix_client { - /** @var string $serverurl The URL of the home server */ /** @var string $accesstoken The access token of the matrix server */ diff --git a/communication/provider/matrix/classes/matrix_constants.php b/communication/provider/matrix/classes/matrix_constants.php index e14a8ff124b..9a0756366cc 100644 --- a/communication/provider/matrix/classes/matrix_constants.php +++ b/communication/provider/matrix/classes/matrix_constants.php @@ -24,7 +24,6 @@ namespace communication_matrix; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class matrix_constants { - /** * User default power level for matrix. */ diff --git a/communication/provider/matrix/classes/matrix_room.php b/communication/provider/matrix/classes/matrix_room.php index 4ebb0d92ddd..bfaeffaee55 100644 --- a/communication/provider/matrix/classes/matrix_room.php +++ b/communication/provider/matrix/classes/matrix_room.php @@ -26,7 +26,6 @@ use stdClass; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class matrix_room { - private const TABLE = 'matrix_room'; /** @var \stdClass|null $record The matrix room record from db */ diff --git a/communication/provider/matrix/classes/matrix_user_manager.php b/communication/provider/matrix/classes/matrix_user_manager.php index 937f952f63d..6b5b1b77f04 100644 --- a/communication/provider/matrix/classes/matrix_user_manager.php +++ b/communication/provider/matrix/classes/matrix_user_manager.php @@ -24,7 +24,6 @@ namespace communication_matrix; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class matrix_user_manager { - /** * Gets matrix user id from moodle. * @@ -33,7 +32,7 @@ class matrix_user_manager { */ public static function get_matrixid_from_moodle( int $userid, - ) : ?string { + ): ?string { self::load_requirements(); $field = profile_user_record($userid); $matrixprofilefield = get_config('communication_matrix', 'matrixuserid_field'); @@ -141,7 +140,7 @@ class matrix_user_manager { // Check if matrixuserid exists in user_info_field table. $matrixuserid = $DB->count_records('user_info_field', [ 'shortname' => 'matrixuserid', - 'categoryid' => $categoryid + 'categoryid' => $categoryid, ]); if ($matrixuserid < 1) { @@ -158,7 +157,7 @@ class matrix_user_manager { 'visible' => 0, 'locked' => 1, 'param1' => 30, - 'param2' => 2048 + 'param2' => 2048, ]; $profileclass->define_save($data); diff --git a/communication/provider/matrix/classes/privacy/provider.php b/communication/provider/matrix/classes/privacy/provider.php index 7ba1d520aeb..243eb04bc8d 100644 --- a/communication/provider/matrix/classes/privacy/provider.php +++ b/communication/provider/matrix/classes/privacy/provider.php @@ -27,7 +27,6 @@ use core_privacy\local\metadata\null_provider; * @codeCoverageIgnore */ class provider implements null_provider { - /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. diff --git a/communication/provider/matrix/db/access.php b/communication/provider/matrix/db/access.php index bb7c6dcae69..8c95a5dcba5 100644 --- a/communication/provider/matrix/db/access.php +++ b/communication/provider/matrix/db/access.php @@ -34,6 +34,6 @@ $capabilities = [ 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW, 'teacher' => CAP_ALLOW, - ] + ], ], ]; diff --git a/communication/provider/matrix/db/upgrade.php b/communication/provider/matrix/db/upgrade.php index 07f40633a4f..705475d2dcf 100644 --- a/communication/provider/matrix/db/upgrade.php +++ b/communication/provider/matrix/db/upgrade.php @@ -52,5 +52,4 @@ function xmldb_communication_matrix_upgrade($oldversion) { } return true; - } diff --git a/communication/provider/matrix/tests/behat/behat_communication_matrix.php b/communication/provider/matrix/tests/behat/behat_communication_matrix.php index ac89fafbaf6..a16474b908d 100644 --- a/communication/provider/matrix/tests/behat/behat_communication_matrix.php +++ b/communication/provider/matrix/tests/behat/behat_communication_matrix.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace + use Behat\Behat\Hook\Scope\BeforeScenarioScope; use communication_matrix\matrix_test_helper_trait; use Moodle\BehatExtension\Exception\SkippedException; @@ -31,7 +33,6 @@ require_once(__DIR__ . '/../../../../tests/communication_test_helper_trait.php') * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class behat_communication_matrix extends \behat_base { - use \core_communication\communication_test_helper_trait; use matrix_test_helper_trait; diff --git a/communication/provider/matrix/tests/communication_feature_test.php b/communication/provider/matrix/tests/communication_feature_test.php index d6ff8fce725..ee75b81d8e8 100644 --- a/communication/provider/matrix/tests/communication_feature_test.php +++ b/communication/provider/matrix/tests/communication_feature_test.php @@ -33,6 +33,7 @@ require_once(__DIR__ . '/../../../tests/communication_test_helper_trait.php'); * @category test * @copyright 2023 Safat Shahin * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \communication_matrix\communication_feature * @coversDefaultClass \communication_matrix\communication_feature */ class communication_feature_test extends \advanced_testcase { @@ -67,6 +68,7 @@ class communication_feature_test extends \advanced_testcase { ], ); + // phpcs:ignore moodle.Commenting.InlineComment.DocBlock /** @var communication_feature */ $provider = $communication->get_room_provider(); $this->assertInstanceOf( @@ -125,6 +127,7 @@ class communication_feature_test extends \advanced_testcase { roomtopic: 'Our room topic', ); + // phpcs:ignore moodle.Commenting.InlineComment.DocBlock /** @var communication_feature */ $provider = $communication->get_room_provider(); $this->assertInstanceOf( diff --git a/communication/provider/matrix/tests/local/command_test.php b/communication/provider/matrix/tests/local/command_test.php index 66eac20f75b..c2a2329a36f 100644 --- a/communication/provider/matrix/tests/local/command_test.php +++ b/communication/provider/matrix/tests/local/command_test.php @@ -266,7 +266,7 @@ class command_test extends \advanced_testcase { mock: $mock, ); - $mock->append(function(Request $request) use ($expected): Response { + $mock->append(function (Request $request) use ($expected): Response { $this->assertSame( $expected, $request->getUri()->getQuery(), diff --git a/communication/provider/matrix/tests/matrix_client_test.php b/communication/provider/matrix/tests/matrix_client_test.php index f7b68261e08..44072ba9018 100644 --- a/communication/provider/matrix/tests/matrix_client_test.php +++ b/communication/provider/matrix/tests/matrix_client_test.php @@ -301,7 +301,7 @@ class matrix_client_test extends \advanced_testcase { */ public function require_features_provider(): array { // We'll just add to the standard testcases. - $testcases = array_map(static function(array $testcase): array { + $testcases = array_map(static function (array $testcase): array { $testcase[1] = [$testcase[1]]; return $testcase; }, $this->implements_feature_provider()); diff --git a/communication/provider/matrix/tests/matrix_client_test_trait.php b/communication/provider/matrix/tests/matrix_client_test_trait.php index 72bda517c54..21e6bc0f296 100644 --- a/communication/provider/matrix/tests/matrix_client_test_trait.php +++ b/communication/provider/matrix/tests/matrix_client_test_trait.php @@ -47,7 +47,7 @@ trait matrix_client_test_trait { mocked_matrix_client::reset_client(); } - public function tearDown():void { + public function tearDown(): void { parent::tearDown(); // Reset the test client. diff --git a/communication/provider/matrix/tests/matrix_room_test.php b/communication/provider/matrix/tests/matrix_room_test.php index a017d0f0602..ee374c230ca 100644 --- a/communication/provider/matrix/tests/matrix_room_test.php +++ b/communication/provider/matrix/tests/matrix_room_test.php @@ -26,7 +26,6 @@ namespace communication_matrix; * @coversDefaultClass \communication_matrix\matrix_room */ class matrix_room_test extends \advanced_testcase { - /** * Test for load_by_processor_id with no record. * @@ -84,7 +83,6 @@ class matrix_room_test extends \advanced_testcase { $this->assertEquals(54321, $reloadedroom->get_processor_id()); $this->assertEquals('The topic of this room is thusly', $reloadedroom->get_topic()); $this->assertEquals('This is a roomid', $reloadedroom->get_room_id()); - } /** diff --git a/communication/provider/matrix/tests/matrix_test_helper_trait.php b/communication/provider/matrix/tests/matrix_test_helper_trait.php index 8aa7bbd942b..14b6a2fe7f0 100644 --- a/communication/provider/matrix/tests/matrix_test_helper_trait.php +++ b/communication/provider/matrix/tests/matrix_test_helper_trait.php @@ -26,7 +26,6 @@ use GuzzleHttp\Psr7\Response; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ trait matrix_test_helper_trait { - /** * @var string $accesstoken The token for matrix connection */ @@ -46,7 +45,7 @@ trait matrix_test_helper_trait { $this->matrixhomeserverurl = TEST_COMMUNICATION_MATRIX_MOCK_SERVER; set_config('matrixhomeserverurl', $this->matrixhomeserverurl, 'communication_matrix'); $request = $this->request(); - $response = $request->post($this->matrixhomeserverurl. '/backoffice/create-admin'); + $response = $request->post($this->matrixhomeserverurl . '/backoffice/create-admin'); $admindata = json_decode($response->getBody()); $json = [ 'identifier' => [ @@ -57,7 +56,7 @@ trait matrix_test_helper_trait { 'password' => $admindata->password, ]; $request = $this->request($json); - $response = $request->post($this->matrixhomeserverurl. '/_matrix/client/r0/login'); + $response = $request->post($this->matrixhomeserverurl . '/_matrix/client/r0/login'); $response = json_decode($response->getBody()); if (empty($response->access_token)) { $this->markTestSkipped( @@ -161,10 +160,15 @@ trait matrix_test_helper_trait { array $rooms = [], ): Response { $client = new \core\http_client(); - return $client->put($this->get_backoffice_uri('create'), ['json' => [ - 'users' => $users, - 'rooms' => $rooms, - ]]); + return $client->put( + $this->get_backoffice_uri('create'), + [ + 'json' => [ + 'users' => $users, + 'rooms' => $rooms, + ], + ], + ); } /** @@ -225,7 +229,7 @@ trait matrix_test_helper_trait { public function reset_mock(): void { if (defined('TEST_COMMUNICATION_MATRIX_MOCK_SERVER')) { $request = $this->request(); - $response = $request->post(TEST_COMMUNICATION_MATRIX_MOCK_SERVER. '/backoffice/reset'); + $response = $request->post(TEST_COMMUNICATION_MATRIX_MOCK_SERVER . '/backoffice/reset'); $response = json_decode($response->getBody()); if (empty($response->reset)) { $this->markTestSkipped( diff --git a/communication/tests/api_test.php b/communication/tests/api_test.php index be95a54c164..adafe0bd634 100644 --- a/communication/tests/api_test.php +++ b/communication/tests/api_test.php @@ -27,10 +27,9 @@ require_once(__DIR__ . '/communication_test_helper_trait.php'); * @category test * @copyright 2023 Safat Shahin * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass \core_communication\api + * @covers \core_communication\api */ class api_test extends \advanced_testcase { - use communication_test_helper_trait; public function setUp(): void { @@ -284,7 +283,7 @@ class api_test extends \advanced_testcase { * Test the enabled communication plugin list and default. */ public function test_get_enabled_providers_and_default(): void { - list($communicationproviders, $defaulprovider) = \core_communication\api::get_enabled_providers_and_default(); + [$communicationproviders, $defaulprovider] = \core_communication\api::get_enabled_providers_and_default(); // Get the communication plugins. $plugins = \core_component::get_plugin_list('communication'); // Check the number of plugins matches plus 1 as we have none in the selection. diff --git a/communication/tests/behat/behat_communication.php b/communication/tests/behat/behat_communication.php index c3f3bd5e8a8..165d393897b 100644 --- a/communication/tests/behat/behat_communication.php +++ b/communication/tests/behat/behat_communication.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace + require_once(__DIR__ . '/../../../lib/behat/behat_base.php'); require_once(__DIR__ . '/../../tests/communication_test_helper_trait.php'); @@ -26,7 +28,6 @@ require_once(__DIR__ . '/../../tests/communication_test_helper_trait.php'); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class behat_communication extends \behat_base { - use \core_communication\communication_test_helper_trait; /** diff --git a/communication/tests/communication_test_helper_trait.php b/communication/tests/communication_test_helper_trait.php index 8f6a3ff0e82..62c5fbc5c20 100644 --- a/communication/tests/communication_test_helper_trait.php +++ b/communication/tests/communication_test_helper_trait.php @@ -25,7 +25,6 @@ namespace core_communication; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ trait communication_test_helper_trait { - /** * Setup necessary configs for communication subsystem. * @@ -83,7 +82,7 @@ trait communication_test_helper_trait { $records = [ 'firstname' => $firstname, 'lastname' => $lastname, - 'username' => $username + 'username' => $username, ]; return $this->getDataGenerator()->create_user($records); diff --git a/communication/tests/processor_test.php b/communication/tests/processor_test.php index 1a75530b96b..145ea33e041 100644 --- a/communication/tests/processor_test.php +++ b/communication/tests/processor_test.php @@ -30,7 +30,6 @@ require_once(__DIR__ . '/communication_test_helper_trait.php'); * @coversDefaultClass \core_communication\processor */ class processor_test extends \advanced_testcase { - use communication_test_helper_trait; /** @@ -61,8 +60,10 @@ class processor_test extends \advanced_testcase { ); // Now test the record against the database. - $communicationrecord = $DB->get_record('communication', - ['instanceid' => $instanceid, 'component' => $component, 'instancetype' => $instancetype]); + $communicationrecord = $DB->get_record( + 'communication', + ['instanceid' => $instanceid, 'component' => $component, 'instancetype' => $instancetype] + ); // Test against the set data. $this->assertNotEmpty($communicationrecord); @@ -114,7 +115,7 @@ class processor_test extends \advanced_testcase { $communicationrecord = $DB->get_record('communication', [ 'instanceid' => $instanceid, 'component' => $component, - 'instancetype' => $instancetype + 'instancetype' => $instancetype, ]); // Test against the set data. @@ -163,7 +164,7 @@ class processor_test extends \advanced_testcase { $communicationrecord = $DB->get_record('communication', [ 'instanceid' => $instanceid, 'component' => $component, - 'instancetype' => $instancetype + 'instancetype' => $instancetype, ]); // Test against the set data. @@ -173,7 +174,8 @@ class processor_test extends \advanced_testcase { $communicationprocessor = processor::load_by_instance( $component, $instancetype, - $instanceid); + $instanceid + ); $this->assertNull($communicationprocessor); }