Skip to content

Commit

Permalink
phpcs: add blank line after header; explicit nullable types; ignore t…
Browse files Browse the repository at this point in the history
…est methods
  • Loading branch information
jrchamp committed Apr 8, 2024
1 parent 5f46466 commit e4b7807
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 23 deletions.
6 changes: 3 additions & 3 deletions classes/invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public function __construct($invitation) {
* Get the display string to show on the module page.
*
* @param int $coursemoduleid Course module where the user will view the invitation.
* @param int|null $userid Optionally supply the intended user to view the string. Defaults to global $USER.
* @return string|null
* @param ?int $userid Optionally supply the intended user to view the string. Defaults to global $USER.
* @return ?string
*/
public function get_display_string(int $coursemoduleid, int $userid = null) {
public function get_display_string(int $coursemoduleid, ?int $userid = null) {
if (empty($this->invitation)) {
return null;
}
Expand Down
18 changes: 9 additions & 9 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ function zoom_supports($feature) {
* will create a new instance and return the id number of the new instance.
*
* @param stdClass $zoom Submitted data from the form in mod_form.php
* @param mod_zoom_mod_form $mform The form instance (included because the function is used as a callback)
* @param ?mod_zoom_mod_form $mform The form instance (included because the function is used as a callback)
* @return int The id of the newly inserted zoom record
*/
function zoom_add_instance(stdClass $zoom, mod_zoom_mod_form $mform = null) {
function zoom_add_instance(stdClass $zoom, ?mod_zoom_mod_form $mform = null) {
global $CFG, $DB;
require_once($CFG->dirroot . '/mod/zoom/locallib.php');

Expand Down Expand Up @@ -143,10 +143,10 @@ function zoom_add_instance(stdClass $zoom, mod_zoom_mod_form $mform = null) {
* will update an existing instance with new data.
*
* @param stdClass $zoom An object from the form in mod_form.php
* @param mod_zoom_mod_form $mform The form instance (included because the function is used as a callback)
* @param ?mod_zoom_mod_form $mform The form instance (included because the function is used as a callback)
* @return boolean Success/Failure
*/
function zoom_update_instance(stdClass $zoom, mod_zoom_mod_form $mform = null) {
function zoom_update_instance(stdClass $zoom, ?mod_zoom_mod_form $mform = null) {
global $CFG, $DB;
require_once($CFG->dirroot . '/mod/zoom/locallib.php');

Expand Down Expand Up @@ -586,10 +586,10 @@ function zoom_get_monthweek_options() {
* Populate the calendar event object, based on the zoom instance
*
* @param stdClass $zoom The zoom instance.
* @param stdClass $occurrence The occurrence object passed from the zoom api.
* @param ?stdClass $occurrence The occurrence object passed from the zoom api.
* @return stdClass The calendar event object.
*/
function zoom_populate_calender_item(stdClass $zoom, stdClass $occurrence = null) {
function zoom_populate_calender_item(stdClass $zoom, ?stdClass $occurrence = null) {
$event = new stdClass();
$event->type = CALENDAR_EVENT_TYPE_ACTION;
$event->modulename = 'zoom';
Expand Down Expand Up @@ -873,7 +873,7 @@ function zoom_reset_userdata($data) {
*
* @param object $mform the course reset form that is being built.
*/
function zoom_reset_course_form_definition(&$mform) {
function zoom_reset_course_form_definition($mform) {
$mform->addElement('header', 'zoomheader', get_string('modulenameplural', 'zoom'));

$mform->addElement('checkbox', 'reset_zoom_all', get_string('resetzoomsall', 'zoom'));
Expand Down Expand Up @@ -973,9 +973,9 @@ function zoom_extend_navigation(navigation_node $navref, stdClass $course, stdCl
* so it is safe to rely on the $PAGE.
*
* @param settings_navigation $settingsnav complete settings navigation tree
* @param navigation_node $zoomnode zoom administration node
* @param ?navigation_node $zoomnode zoom administration node
*/
function zoom_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $zoomnode = null) {
function zoom_extend_settings_navigation(settings_navigation $settingsnav, ?navigation_node $zoomnode = null) {
}

/**
Expand Down
1 change: 0 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,6 @@ function zoom_get_registrant_join_url($useremail, $meetingid, $iswebinar) {
* Get the display name for a Zoom user.
* This is wrapped in a function to avoid unnecessary API calls.
*
* @package mod_zoom
* @param string $zoomuserid Zoom user ID.
* @return ?string
*/
Expand Down
8 changes: 6 additions & 2 deletions participants.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @copyright 2015 UC Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/lib.php');
require_once(__DIR__ . '/locallib.php');
Expand Down Expand Up @@ -166,8 +167,11 @@
'export' => 'xls',
]);
$xlsstring = get_string('application/vnd.ms-excel', 'mimetypes');
$xlsicon = html_writer::img($OUTPUT->image_url('f/spreadsheet'), $xlsstring,
['title' => $xlsstring, 'class' => 'mimetypeicon']);
$xlsicon = html_writer::img(
$OUTPUT->image_url('f/spreadsheet'),
$xlsstring,
['title' => $xlsstring, 'class' => 'mimetypeicon']
);
echo get_string('export', 'mod_zoom') . ': ' . html_writer::link($exporturl, $xlsicon);

echo $OUTPUT->footer();
Expand Down
1 change: 1 addition & 0 deletions recreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @copyright 2017 UC Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/lib.php');
require_once(__DIR__ . '/locallib.php');
Expand Down
1 change: 1 addition & 0 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @copyright 2015 UC Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/lib.php');
require_once(__DIR__ . '/locallib.php');
Expand Down
4 changes: 2 additions & 2 deletions tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class mod_zoom_generator extends testing_module_generator {
/**
* Creates new Zoom module instance.
* @param array|stdClass $record
* @param array $options
* @param ?array $options
* @return stdClass Zoom instance
*/
public function create_instance($record = null, array $options = null) {
public function create_instance($record = null, ?array $options = null) {
global $CFG;
require_once($CFG->dirroot . '/mod/zoom/locallib.php');

Expand Down
12 changes: 6 additions & 6 deletions tests/mod_zoom_webservice_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function setUp(): void {
set_config('clientsecret', 'test', 'zoom');
set_config('accountid', 'test', 'zoom');

// @codingStandardsIgnoreStart
$this->notfoundmockcurl = new class {
// @codingStandardsIgnoreStart
/**
* Stub for curl setHeader().
* @param string $unusedparam
Expand Down Expand Up @@ -169,8 +169,8 @@ public function test_user_not_found_exception(): void {
* Tests whether invalid user errors are parsed properly
*/
public function test_invalid_user_exception(): void {
// @codingStandardsIgnoreStart
$invalidmockcurl = new class {
// @codingStandardsIgnoreStart
/**
* Stub for curl setHeader().
* @param string $unusedparam
Expand Down Expand Up @@ -230,9 +230,9 @@ public function get_info() {
* is in the curl response to specify the time that the retry should be sent.
*/
public function test_retry_with_header(): void {
// @codingStandardsIgnoreStart
$retrywithheadermockcurl = new class {
public $numgetinfocalls = 0;
// @codingStandardsIgnoreStart
/**
* Stub for curl setHeader().
* @param string $unusedparam
Expand Down Expand Up @@ -309,9 +309,9 @@ public function getResponse() {
* header is not sent in the curl response.
*/
public function test_retry_without_header(): void {
// @codingStandardsIgnoreStart
$retrynoheadermockcurl = new class {
public $numgetinfocalls = 0;
// @codingStandardsIgnoreStart
/**
* Stub for curl setHeader().
* @param string $unusedparam
Expand Down Expand Up @@ -377,9 +377,9 @@ public function getResponse() {
* Tests that we throw error if we tried more than max retries.
*/
public function test_retry_exception(): void {
// @codingStandardsIgnoreStart
$retryfailuremockcurl = new class {
public $urlpath = null;
// @codingStandardsIgnoreStart
/**
* Stub for curl setHeader().
* @param string $unusedparam
Expand Down Expand Up @@ -464,9 +464,9 @@ public function getResponse() {
* Tests that we are waiting 1 minute for QPS rate limit types.
*/
public function test_retryqps_exception(): void {
// @codingStandardsIgnoreStart
$retryqpsmockcurl = new class {
public $urlpath = null;
// @codingStandardsIgnoreStart
/**
* Stub for curl setHeader().
* @param string $unusedparam
Expand Down
1 change: 1 addition & 0 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @copyright 2015 UC Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/lib.php');
require_once(__DIR__ . '/locallib.php');
Expand Down

0 comments on commit e4b7807

Please sign in to comment.