diff --git a/admin/tool/behat/tests/manager_util_test.php b/admin/tool/behat/tests/manager_util_test.php index 50563c4dc98..39fc8e09de2 100644 --- a/admin/tool/behat/tests/manager_util_test.php +++ b/admin/tool/behat/tests/manager_util_test.php @@ -1,5 +1,5 @@ libdir.'/enrollib.php'); require_once($CFG->libdir . '/filelib.php'); diff --git a/error/index.php b/error/index.php index 1458b290b31..36901588848 100644 --- a/error/index.php +++ b/error/index.php @@ -27,9 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -// @codingStandardsIgnoreStart -require('../config.php'); -// @codingStandardsIgnoreEnd +require('../config.php'); // phpcs:ignore $context = context_system::instance(); $title = get_string('pagenotexisttitle', 'error'); diff --git a/error/plainpage.php b/error/plainpage.php index 3d2cbf56c60..f67ac973d8c 100644 --- a/error/plainpage.php +++ b/error/plainpage.php @@ -30,7 +30,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -// @codingStandardsIgnoreStart +// phpcs:ignoreFile ?> > diff --git a/lib/classes/chart_axis.php b/lib/classes/chart_axis.php index f4407c74146..1703472bad6 100644 --- a/lib/classes/chart_axis.php +++ b/lib/classes/chart_axis.php @@ -129,7 +129,7 @@ class chart_axis implements JsonSerializable { * * @return array */ - public function jsonSerialize() { // @codingStandardsIgnoreLine (CONTRIB-6469). + public function jsonSerialize() { return [ 'label' => $this->label, 'labels' => $this->labels, diff --git a/lib/classes/chart_bar.php b/lib/classes/chart_bar.php index 034d274cb0a..aef8adf1c81 100644 --- a/lib/classes/chart_bar.php +++ b/lib/classes/chart_bar.php @@ -43,7 +43,7 @@ class chart_bar extends chart_base { * * @return array */ - public function jsonSerialize() { // @codingStandardsIgnoreLine (CONTRIB-6469). + public function jsonSerialize() { $data = parent::jsonSerialize(); $data['horizontal'] = $this->get_horizontal(); $data['stacked'] = $this->get_stacked(); diff --git a/lib/classes/chart_base.php b/lib/classes/chart_base.php index e052efdba96..687a2748a75 100644 --- a/lib/classes/chart_base.php +++ b/lib/classes/chart_base.php @@ -77,7 +77,7 @@ class chart_base implements JsonSerializable, renderable { * * @return array */ - public function jsonSerialize() { // @codingStandardsIgnoreLine (CONTRIB-6469). + public function jsonSerialize() { global $CFG; return [ 'type' => $this->get_type(), diff --git a/lib/classes/chart_line.php b/lib/classes/chart_line.php index 4f5525e46da..5a55e0e98e6 100644 --- a/lib/classes/chart_line.php +++ b/lib/classes/chart_line.php @@ -42,7 +42,7 @@ class chart_line extends chart_base { * * @return array */ - public function jsonSerialize() { // @codingStandardsIgnoreLine (CONTRIB-6469). + public function jsonSerialize() { $data = parent::jsonSerialize(); $data['smooth'] = $this->get_smooth(); return $data; diff --git a/lib/classes/chart_pie.php b/lib/classes/chart_pie.php index b4c20410337..1ad6e560f94 100644 --- a/lib/classes/chart_pie.php +++ b/lib/classes/chart_pie.php @@ -42,7 +42,7 @@ class chart_pie extends chart_base { * * @return array */ - public function jsonSerialize() { // @codingStandardsIgnoreLine (CONTRIB-6469). + public function jsonSerialize() { $data = parent::jsonSerialize(); $data['doughnut'] = $this->get_doughnut(); return $data; diff --git a/lib/classes/chart_series.php b/lib/classes/chart_series.php index 5db4ede4aed..a493748ec6e 100644 --- a/lib/classes/chart_series.php +++ b/lib/classes/chart_series.php @@ -183,7 +183,7 @@ class chart_series implements JsonSerializable { * * @return array */ - public function jsonSerialize() { // @codingStandardsIgnoreLine (CONTRIB-6469). + public function jsonSerialize() { $data = [ 'label' => $this->label, 'labels' => $this->labels, diff --git a/lib/classes/session/manager.php b/lib/classes/session/manager.php index eb623cdcfbc..db17fc4252d 100644 --- a/lib/classes/session/manager.php +++ b/lib/classes/session/manager.php @@ -711,9 +711,7 @@ class manager { } // This will emit an error if debugging is on, even if $CFG->enable_read_only_sessions // is not true as we need to surface this class of errors. - // @codingStandardsIgnoreStart - error_log($error); - // @codingStandardsIgnoreEnd + error_log($error); // phpcs:ignore } } } diff --git a/lib/classes/session/redis.php b/lib/classes/session/redis.php index 93628b51882..be1851324b0 100644 --- a/lib/classes/session/redis.php +++ b/lib/classes/session/redis.php @@ -476,10 +476,9 @@ class redis extends handler { // It should not happen very often - all pages that need long time to execute // should close session immediately after access control checks. $whohaslock = $this->connection->get($lockkey); - // @codingStandardsIgnoreStart + // phpcs:ignore error_log("Cannot obtain session lock for sid: $id within $this->acquiretimeout seconds. " . "It is likely another page ($whohaslock) has a long session lock, or the session lock was never released."); - // @codingStandardsIgnoreEnd throw new exception("Unable to obtain session lock"); } diff --git a/lib/classes/shutdown_manager.php b/lib/classes/shutdown_manager.php index ffd0da99485..437d8a4451c 100644 --- a/lib/classes/shutdown_manager.php +++ b/lib/classes/shutdown_manager.php @@ -102,9 +102,8 @@ class core_shutdown_manager { array_unshift($params, $signo); $shouldexit = call_user_func_array($callback, $params) && $shouldexit; } catch (Throwable $e) { - // @codingStandardsIgnoreStart + // phpcs:ignore error_log('Exception ignored in signal function ' . get_callable_name($callback) . ': ' . $e->getMessage()); - // @codingStandardsIgnoreEnd } } @@ -124,9 +123,7 @@ class core_shutdown_manager { */ public static function register_signal_handler($callback, array $params = null): void { if (!is_callable($callback)) { - // @codingStandardsIgnoreStart - error_log('Invalid custom signal function detected ' . var_export($callback, true)); - // @codingStandardsIgnoreEnd + error_log('Invalid custom signal function detected ' . var_export($callback, true)); // phpcs:ignore } self::$signalcallbacks[] = [$callback, $params ?? []]; } @@ -140,9 +137,7 @@ class core_shutdown_manager { */ public static function register_function($callback, array $params = null): void { if (!is_callable($callback)) { - // @codingStandardsIgnoreStart - error_log('Invalid custom shutdown function detected '.var_export($callback, true)); - // @codingStandardsIgnoreEnd + error_log('Invalid custom shutdown function detected '.var_export($callback, true)); // phpcs:ignore } self::$callbacks[] = [$callback, $params ? array_values($params) : []]; } @@ -159,9 +154,8 @@ class core_shutdown_manager { try { call_user_func_array($callback, $params); } catch (Throwable $e) { - // @codingStandardsIgnoreStart + // phpcs:ignore error_log('Exception ignored in shutdown function '.get_callable_name($callback).': '.$e->getMessage()); - // @codingStandardsIgnoreEnd } } diff --git a/lib/dml/moodle_read_slave_trait.php b/lib/dml/moodle_read_slave_trait.php index 17861511b32..cba970ed624 100644 --- a/lib/dml/moodle_read_slave_trait.php +++ b/lib/dml/moodle_read_slave_trait.php @@ -195,15 +195,13 @@ trait moodle_read_slave_trait { } $dboptions['dbport'] = isset($slave['dbport']) ? $slave['dbport'] : $dbport; - // @codingStandardsIgnoreStart try { $this->raw_connect($rodb['dbhost'], $rodb['dbuser'], $rodb['dbpass'], $dbname, $prefix, $dboptions); $this->dbhreadonly = $this->get_db_handle(); break; - } catch (dml_connection_exception $e) { + } catch (dml_connection_exception $e) { // phpcs:ignore // If readonly slave is not connectable we'll have to do without it. } - // @codingStandardsIgnoreEnd } // ... lock_db queries always go to master. // Since it is a lock and as such marshalls concurrent connections, diff --git a/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php b/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php index 27a729343ee..530e71a9816 100644 --- a/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php +++ b/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php @@ -36,14 +36,12 @@ require_once(__DIR__.'/../../pgsql_native_moodle_database.php'); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ trait test_moodle_read_slave_trait { - // @codingStandardsIgnoreStart /** * Constructs a mock db driver * * @param bool $external */ public function __construct($external = false) { - // @codingStandardsIgnoreEnd parent::__construct($external); $rw = fopen("php://memory", 'r+'); diff --git a/lib/dml/tests/fixtures/test_sql_generator.php b/lib/dml/tests/fixtures/test_sql_generator.php index d4bb7b2261d..a1a42aa9de9 100644 --- a/lib/dml/tests/fixtures/test_sql_generator.php +++ b/lib/dml/tests/fixtures/test_sql_generator.php @@ -34,9 +34,11 @@ require_once(__DIR__.'/../../../ddl/sql_generator.php'); * @category ddl * @copyright 2018 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * */ class test_sql_generator extends sql_generator { - // @codingStandardsIgnoreStart + // phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod + /** * Reset a sequence to the id field of a table. * @@ -44,11 +46,9 @@ class test_sql_generator extends sql_generator { * @return array of sql statements */ public function getResetSequenceSQL($table) { - // @codingStandardsIgnoreEnd return []; } - // @codingStandardsIgnoreStart /** * Given one correct xmldb_table, returns the SQL statements * to create temporary table (inside one array). @@ -57,11 +57,9 @@ class test_sql_generator extends sql_generator { * @return array of sql statements */ public function getCreateTempTableSQL($xmldbtable) { - // @codingStandardsIgnoreEnd return []; } - // @codingStandardsIgnoreStart /** * Given one XMLDB Type, length and decimals, returns the DB proper SQL type. * @@ -71,11 +69,9 @@ class test_sql_generator extends sql_generator { * @return string The DB defined data type. */ public function getTypeSQL($xmldbtype, $xmldblength = null, $xmldbdecimals = null) { - // @codingStandardsIgnoreEnd return ''; } - // @codingStandardsIgnoreStart /** * Returns the code (array of statements) needed to add one comment to the table. * @@ -83,11 +79,9 @@ class test_sql_generator extends sql_generator { * @return array Array of SQL statements to add one comment to the table. */ function getCommentSQL ($xmldbtable) { - // @codingStandardsIgnoreEnd return []; } - // @codingStandardsIgnoreStart /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to add its default * (usually invoked from getModifyDefaultSQL() @@ -97,11 +91,9 @@ class test_sql_generator extends sql_generator { * @return array Array of SQL statements to create a field's default. */ public function getCreateDefaultSQL($xmldbtable, $xmldbfield) { - // @codingStandardsIgnoreEnd return []; } - // @codingStandardsIgnoreStart /** * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its default * (usually invoked from getModifyDefaultSQL() @@ -111,17 +103,14 @@ class test_sql_generator extends sql_generator { * @return array Array of SQL statements to create a field's default. */ public function getDropDefaultSQL($xmldbtable, $xmldbfield) { - // @codingStandardsIgnoreEnd return []; } - // @codingStandardsIgnoreStart /** * Returns an array of reserved words (lowercase) for this DB * @return array An array of database specific reserved words */ public static function getReservedWords() { - // @codingStandardsIgnoreEnd return []; } diff --git a/lib/phpunit/classes/base_testcase.php b/lib/phpunit/classes/base_testcase.php index abb7776c45e..1ce5e56db0e 100644 --- a/lib/phpunit/classes/base_testcase.php +++ b/lib/phpunit/classes/base_testcase.php @@ -37,7 +37,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class base_testcase extends PHPUnit\Framework\TestCase { - // @codingStandardsIgnoreStart + // phpcs:disable // Following code is legacy code from phpunit to support assertTag // and assertNotTag. @@ -569,6 +569,5 @@ abstract class base_testcase extends PHPUnit\Framework\TestCase { return str_replace(' ', ' ', $result); } - - // @codingStandardsIgnoreEnd + // phpcs:enable } diff --git a/mod/assign/submission/comments/lib.php b/mod/assign/submission/comments/lib.php index fe6cb76997b..f90f7208f44 100644 --- a/mod/assign/submission/comments/lib.php +++ b/mod/assign/submission/comments/lib.php @@ -146,7 +146,7 @@ function assignsubmission_comments_comment_display($comments, $options) { $a->participantnumber = $anonid; $a->participantfullname = $comment->fullname; $comment->fullname = get_string('blindmarkingviewfullname', 'assignsubmission_comments', $a); - } else if ($USER->id == $comment->userid || $submission->userid == $USER->id || $userinteam) { //@codingStandardsIgnoreLine + } else if ($USER->id == $comment->userid || $submission->userid == $USER->id || $userinteam) { // phpcs:ignore // Do not anonymize the user details for this comment. } else { // Anonymize the comments.