From 9ab1c3253e1447900c8d3c45f8a1d0ef89956694 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Wed, 2 Oct 2024 11:38:59 +0100 Subject: [PATCH 01/23] api-code-tidy - Updates for new code checker --- api/controller/DownloadController.php | 17 ++++++++-------- api/controller/GradingController.php | 18 +++++++++-------- api/controller/RenderController.php | 17 ++++++++-------- api/controller/TestController.php | 16 +++++++-------- api/controller/ValidationController.php | 17 ++++++++-------- api/dtos/StackGradingResponse.php | 19 +++++++++++------- api/dtos/StackRenderResponse.php | 15 ++++++++++---- api/dtos/StackTestResponse.php | 2 ++ api/dtos/StackValidationResponse.php | 12 ++++++++---- api/emulation/Constants.php | 11 +++++++---- api/emulation/HtmlWriter.php | 4 +--- api/emulation/Localization.php | 16 +++++++++++---- api/emulation/MoodleEmulation.php | 23 ++++++++++++++++++---- api/emulation/Renderer.php | 13 +++++++++---- api/emulation/libdir/questionlib.php | 11 +++++++---- api/emulation/libdir/weblib.php | 11 +++++++---- api/public/bulktest.php | 13 +++++++++---- api/public/cors.php | 9 +++++++++ api/public/index.php | 11 +++++++---- api/public/stack.php | 13 +++++++++---- api/util/ErrorRenderer.php | 13 +++++++++---- api/util/StackIframeHolder.php | 26 +++++++++++++++---------- api/util/StackPlotReplacer.php | 14 +++++++++---- api/util/StackQuestionLoader.php | 14 +++++++++---- api/util/StackSeedHelper.php | 13 +++++++++---- 25 files changed, 228 insertions(+), 120 deletions(-) diff --git a/api/controller/DownloadController.php b/api/controller/DownloadController.php index 1b7adaf0039..6163817f68e 100644 --- a/api/controller/DownloadController.php +++ b/api/controller/DownloadController.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles file download from file download blocks. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles file download from file download blocks. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\controller; defined('MOODLE_INTERNAL') || die(); @@ -30,11 +33,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class DownloadController { - /** - * @throws \stack_exception - * @throws \Exception - */ + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/controller/GradingController.php b/api/controller/GradingController.php index ac92728e00a..c98868457e0 100644 --- a/api/controller/GradingController.php +++ b/api/controller/GradingController.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\controller; defined('MOODLE_INTERNAL') || die(); @@ -35,11 +38,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class GradingController { - /** - * @throws \stack_exception - * @throws \Exception - */ + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); @@ -154,6 +155,7 @@ public function __invoke(Request $request, Response $response, array $args): Res return $response->withHeader('Content-Type', 'application/json'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing private function standard_prt_feedback(\qtype_stack_question $question, \prt_evaluatable $result, $feedbackstyle) { $class = ''; if ($result->get_score() < 0.000001) { diff --git a/api/controller/RenderController.php b/api/controller/RenderController.php index a17bb9b7b93..f0fc8d3a16f 100644 --- a/api/controller/RenderController.php +++ b/api/controller/RenderController.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\controller; defined('MOODLE_INTERNAL') || die(); @@ -36,11 +39,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class RenderController { - /** - * @throws \stack_exception - * @throws \Exception - */ + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/controller/TestController.php b/api/controller/TestController.php index 1f60dada4d8..76fb68dfbfb 100644 --- a/api/controller/TestController.php +++ b/api/controller/TestController.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the running of question tests for a supplied question -// -// @copyright 2024 University of Edinburgh -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the running of question tests for a supplied question + * + * @package qtype_stack + * @copyright 2024 University of Edinburgh + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\controller; defined('MOODLE_INTERNAL') || die(); @@ -40,10 +43,7 @@ * leaving display for the front end. */ class TestController { - /** - * @throws \stack_exception - * @throws \Exception - */ + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/controller/ValidationController.php b/api/controller/ValidationController.php index 4eb1c732e22..f667c2b3503 100644 --- a/api/controller/ValidationController.php +++ b/api/controller/ValidationController.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\controller; defined('MOODLE_INTERNAL') || die(); @@ -33,11 +36,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class ValidationController { - /** - * @throws \stack_exception - * @throws \Exception - */ + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/dtos/StackGradingResponse.php b/api/dtos/StackGradingResponse.php index 42229f87105..78a9e257d22 100644 --- a/api/dtos/StackGradingResponse.php +++ b/api/dtos/StackGradingResponse.php @@ -14,15 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\dtos; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackGradingResponse { - /** @var boolean */ + /** @var bool */ public $isgradable; /** @var float */ public $score; @@ -34,9 +38,10 @@ class StackGradingResponse { public $specificfeedback; /** @var array */ public $prts; + // phpcs:ignore moodle.Commenting.VariableComment.Missing public $gradingassets; - /** @var string */ - public $responsesummary; + /** @var string */ + public $responsesummary; /** @var array */ public $iframes; diff --git a/api/dtos/StackRenderResponse.php b/api/dtos/StackRenderResponse.php index 26b18abd4ca..1c38203c9b9 100644 --- a/api/dtos/StackRenderResponse.php +++ b/api/dtos/StackRenderResponse.php @@ -14,14 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\dtos; defined('MOODLE_INTERNAL') || die(); +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackRenderResponse { /** @var string */ public $questionrender; @@ -29,6 +33,7 @@ class StackRenderResponse { public $questionsamplesolutiontext; /** @var StackRenderInput[] */ public $questioninputs; + // phpcs:ignore moodle.Commenting.VariableComment.Missing public $questionassets; /** @var int */ public $questionseed; @@ -38,9 +43,11 @@ class StackRenderResponse { public $iframes; } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackRenderInput { /** @var int */ public $validationtype; + // phpcs:ignore moodle.Commenting.VariableComment.Missing public $samplesolution; /** @var string */ public $samplesolutionrender; diff --git a/api/dtos/StackTestResponse.php b/api/dtos/StackTestResponse.php index e5e86f82b3d..87008dfbe6a 100644 --- a/api/dtos/StackTestResponse.php +++ b/api/dtos/StackTestResponse.php @@ -17,12 +17,14 @@ /** * Response to a question test request * + * @package qtype_stack * @copyright 2024 Uuniversity of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ namespace api\dtos; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackTestResponse { /** @var string */ public $name = ''; diff --git a/api/dtos/StackValidationResponse.php b/api/dtos/StackValidationResponse.php index 2644d11966d..00213f285ab 100644 --- a/api/dtos/StackValidationResponse.php +++ b/api/dtos/StackValidationResponse.php @@ -14,13 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\dtos; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackValidationResponse { /** @var string */ public $validation; diff --git a/api/emulation/Constants.php b/api/emulation/Constants.php index 73606b5b3e3..ad7b9087031 100644 --- a/api/emulation/Constants.php +++ b/api/emulation/Constants.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ // Copied from moodle source code. diff --git a/api/emulation/HtmlWriter.php b/api/emulation/HtmlWriter.php index f03aa3728f3..14959123abc 100644 --- a/api/emulation/HtmlWriter.php +++ b/api/emulation/HtmlWriter.php @@ -20,7 +20,7 @@ * @copyright 2009 Tim Hunt, 2010 Petr Skoda * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 2.0 - * @package core + * @package qtype_stack * @category output */ class html_writer { @@ -127,8 +127,6 @@ public static function attributes(array $attributes = null) { /** * Generates random html element id. * - * @staticvar int $counter - * @staticvar type $uniq * @param string $base A string fragment that will be included in the random ID. * @return string A unique ID */ diff --git a/api/emulation/Localization.php b/api/emulation/Localization.php index 19eabc98663..22746a771f8 100644 --- a/api/emulation/Localization.php +++ b/api/emulation/Localization.php @@ -14,20 +14,25 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../lang/multilang.php'); +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function current_language() { $supportedlanguages = ['en', 'de']; return locale_lookup($supportedlanguages, $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en', true, 'en'); } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function get_string($identifier, $component, $a = null) { $userlanguage = current_language(); @@ -76,8 +81,11 @@ function get_string($identifier, $component, $a = null) { // Used for multilanguage questions, retrusn dependencies between languages. // We currently support only english and german, therefore this is not that relevant for us. +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function get_string_manager() { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing return new class { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function get_language_dependencies($lang) { return []; } diff --git a/api/emulation/MoodleEmulation.php b/api/emulation/MoodleEmulation.php index ae8cbf908de..aecfa4e9b41 100644 --- a/api/emulation/MoodleEmulation.php +++ b/api/emulation/MoodleEmulation.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * This File defines various classes and functions present in moodle, @@ -32,23 +35,30 @@ // Required to pass Moodle code check. require_login(); +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class moodle_exception extends Exception { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __construct($a1, $a2, $a3, $error) { parent::__construct($error); } } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class question_graded_automatically_with_countback { + // phpcs:ignore moodle.Commenting.VariableComment.Missing public $defaultmark = 1; } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing interface question_automatically_gradable_with_multiple_parts { } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function clean_param($in, $param) { return $in; } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function get_config($component, $parameter = null) { global $CFG; if ($parameter === null) { @@ -81,16 +91,21 @@ function s($var) { return preg_replace('/&#(\d+|x[0-9a-f]+);/i', '&#$1;', htmlspecialchars($var, ENT_QUOTES, 'UTF-8')); } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function format_text($text) { return $text; } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function require_login() { return; } +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing function get_file_storage() { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing $storage = new class { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function get_area_files($x, $y, $z, $a) { return []; } diff --git a/api/emulation/Renderer.php b/api/emulation/Renderer.php index 03e2d47c7c8..e49c89ced28 100644 --- a/api/emulation/Renderer.php +++ b/api/emulation/Renderer.php @@ -14,12 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class qtype_stack_renderer { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function fact_sheet($name, $fact) { $name = html_writer::tag('h5', $name); return html_writer::tag('div', $name.$fact, ['class' => 'factsheet']); diff --git a/api/emulation/libdir/questionlib.php b/api/emulation/libdir/questionlib.php index c8f06a13d6a..00078ef36d1 100644 --- a/api/emulation/libdir/questionlib.php +++ b/api/emulation/libdir/questionlib.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class question_display_options { } diff --git a/api/emulation/libdir/weblib.php b/api/emulation/libdir/weblib.php index ac051159c8d..47189df23ba 100644 --- a/api/emulation/libdir/weblib.php +++ b/api/emulation/libdir/weblib.php @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ diff --git a/api/public/bulktest.php b/api/public/bulktest.php index a50e7f4b48b..29e7ffaf8cc 100644 --- a/api/public/bulktest.php +++ b/api/public/bulktest.php @@ -14,14 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 University of Edinburgh -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * API bulk test page. + * + * @package qtype_stack + * @copyright 2023 University of Edinburgh + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + require_once('../config.php'); require_once(__DIR__ . '../../emulation/MoodleEmulation.php'); // Required to pass Moodle code check. Uses emulation stub. require_login(); +// @codingStandardsIgnoreStart ?> diff --git a/api/public/cors.php b/api/public/cors.php index 47a991cac2f..1ac55c72cd8 100644 --- a/api/public/cors.php +++ b/api/public/cors.php @@ -14,6 +14,15 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * This is a dirty hack trying to remove the need to configure webservers + * to set the correct CORS headers for the few scripts in this directory that need them. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + // This is a dirty hack trying to remove the need to configure webservers // to set the correct CORS headers for the few scripts in this directory that need them. diff --git a/api/public/index.php b/api/public/index.php index 2ba9a78eebe..2247b11b013 100644 --- a/api/public/index.php +++ b/api/public/index.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once('../config.php'); require_once(__DIR__ . '../../emulation/MoodleEmulation.php'); diff --git a/api/public/stack.php b/api/public/stack.php index 8a6f09887af..dace34681f4 100644 --- a/api/public/stack.php +++ b/api/public/stack.php @@ -14,15 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 University of Edinburgh -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 University of Edinburgh + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + require_once('../config.php'); require_once(__DIR__ . '../../emulation/MoodleEmulation.php'); require_once(__DIR__ . '/../../stack/questionlibrary.class.php'); // Required to pass Moodle code check. Uses emulation stub. require_login(); +// @codingStandardsIgnoreStart ?> diff --git a/api/util/ErrorRenderer.php b/api/util/ErrorRenderer.php index 89bf90362e1..ff3f55c0bcc 100644 --- a/api/util/ErrorRenderer.php +++ b/api/util/ErrorRenderer.php @@ -14,16 +14,21 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\util; use Slim\Interfaces\ErrorRendererInterface; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class ErrorRenderer implements ErrorRendererInterface { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public function __invoke(\Throwable $exception, bool $displayerrordetails): string { $message = $exception instanceof \stack_exception ? $exception->getMessage() : "An Error occured while processing the question"; diff --git a/api/util/StackIframeHolder.php b/api/util/StackIframeHolder.php index d755782cd7e..fdfbec2f498 100644 --- a/api/util/StackIframeHolder.php +++ b/api/util/StackIframeHolder.php @@ -14,22 +14,28 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// Class to hold an array of iframes created during an API call -// -// Iframes are defined by an array of arguments suitable for -// sending to stackjsvle.js->create_iframe(). -// -// Honestly this is acting like a global variable. It minimises changes to -// to the iframe block to accomodate the API. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Class to hold an array of iframes created during an API call + * + * Iframes are defined by an array of arguments suitable for + * sending to stackjsvle.js->create_iframe(). + * + * Honestly this is acting like a global variable. It minimises changes to + * to the iframe block to accomodate the API. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\util; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackIframeHolder { + // phpcs:ignore moodle.Commenting.VariableComment.Missing public static $iframes = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public static function add_iframe($args) { for ($i = 0; $i < 5; $i++) { $args[$i] = json_decode($args[$i]); diff --git a/api/util/StackPlotReplacer.php b/api/util/StackPlotReplacer.php index f3e15e0d598..5757a6b9acb 100644 --- a/api/util/StackPlotReplacer.php +++ b/api/util/StackPlotReplacer.php @@ -14,14 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\util; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackPlotReplacer { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public static function replace_plots(&$plots, &$text, $nameprefix, $storeprefix) { $i = 0; @@ -39,6 +44,7 @@ function ($matches) use (&$i, $nameprefix, &$plots) { }, $text); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public static function persist_plugin_files(\qtype_stack_question $question, $storeprefix) { global $CFG; foreach ($question->pluginfiles as $name => $content) { diff --git a/api/util/StackQuestionLoader.php b/api/util/StackQuestionLoader.php index ac3c0565fed..89adafd6998 100644 --- a/api/util/StackQuestionLoader.php +++ b/api/util/StackQuestionLoader.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\util; use SimpleXMLElement; @@ -31,6 +34,7 @@ * Converts question xml into usable format */ class StackQuestionLoader { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public static function loadxml($xml, $includetests=false) { // TO-DO: Consider defaults. try { @@ -296,6 +300,7 @@ public static function loadxml($xml, $includetests=false) { return ['question' => $question, 'testcases' => $testcases]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing private static function handlefiles(\SimpleXMLElement $files) { $data = []; @@ -306,6 +311,7 @@ private static function handlefiles(\SimpleXMLElement $files) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing private static function parseboolean(\SimpleXMLElement $element) { $v = (string) $element; if ($v === "0") { diff --git a/api/util/StackSeedHelper.php b/api/util/StackSeedHelper.php index fdd558adac6..402ba72fa4b 100644 --- a/api/util/StackSeedHelper.php +++ b/api/util/StackSeedHelper.php @@ -14,14 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace api\util; +// phpcs:ignore moodle.Commenting.MissingDocblock.Missing class StackSeedHelper { + // phpcs:ignore moodle.Commenting.MissingDocblock.Missing public static function initialize_seed($question, $seed) { if ($question->has_random_variants()) { // We require the xml to include deployed variants. From c244fb58be01aef773384e525435c253400f69ce Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Wed, 2 Oct 2024 13:00:07 +0100 Subject: [PATCH 02/23] api-code-tidy - Target ignore commands better --- api/controller/DownloadController.php | 4 ++-- api/controller/GradingController.php | 6 +++--- api/controller/RenderController.php | 4 ++-- api/controller/TestController.php | 2 +- api/controller/ValidationController.php | 4 ++-- api/dtos/StackGradingResponse.php | 2 +- api/dtos/StackRenderResponse.php | 4 ++-- api/dtos/StackTestResponse.php | 2 +- api/dtos/StackValidationResponse.php | 2 +- api/emulation/Localization.php | 10 +++++----- api/emulation/MoodleEmulation.php | 22 +++++++++++----------- api/emulation/Renderer.php | 4 ++-- api/util/ErrorRenderer.php | 4 ++-- api/util/StackIframeHolder.php | 4 ++-- api/util/StackPlotReplacer.php | 6 +++--- api/util/StackQuestionLoader.php | 6 +++--- api/util/StackSeedHelper.php | 4 ++-- 17 files changed, 45 insertions(+), 45 deletions(-) diff --git a/api/controller/DownloadController.php b/api/controller/DownloadController.php index 6163817f68e..e9589be04b9 100644 --- a/api/controller/DownloadController.php +++ b/api/controller/DownloadController.php @@ -33,9 +33,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class DownloadController { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/controller/GradingController.php b/api/controller/GradingController.php index c98868457e0..e1df1a0a6b5 100644 --- a/api/controller/GradingController.php +++ b/api/controller/GradingController.php @@ -38,9 +38,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class GradingController { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); @@ -155,7 +155,7 @@ public function __invoke(Request $request, Response $response, array $args): Res return $response->withHeader('Content-Type', 'application/json'); } - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function private function standard_prt_feedback(\qtype_stack_question $question, \prt_evaluatable $result, $feedbackstyle) { $class = ''; if ($result->get_score() < 0.000001) { diff --git a/api/controller/RenderController.php b/api/controller/RenderController.php index f0fc8d3a16f..bdd90a75b8f 100644 --- a/api/controller/RenderController.php +++ b/api/controller/RenderController.php @@ -39,9 +39,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class RenderController { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/controller/TestController.php b/api/controller/TestController.php index 76fb68dfbfb..3e41afef605 100644 --- a/api/controller/TestController.php +++ b/api/controller/TestController.php @@ -43,7 +43,7 @@ * leaving display for the front end. */ class TestController { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/controller/ValidationController.php b/api/controller/ValidationController.php index f667c2b3503..150a8f99098 100644 --- a/api/controller/ValidationController.php +++ b/api/controller/ValidationController.php @@ -36,9 +36,9 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class ValidationController { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __invoke(Request $request, Response $response, array $args): Response { // TO-DO: Validate. $data = $request->getParsedBody(); diff --git a/api/dtos/StackGradingResponse.php b/api/dtos/StackGradingResponse.php index 78a9e257d22..a4cc37e6e8e 100644 --- a/api/dtos/StackGradingResponse.php +++ b/api/dtos/StackGradingResponse.php @@ -24,7 +24,7 @@ namespace api\dtos; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackGradingResponse { /** @var bool */ public $isgradable; diff --git a/api/dtos/StackRenderResponse.php b/api/dtos/StackRenderResponse.php index 1c38203c9b9..c2258798c61 100644 --- a/api/dtos/StackRenderResponse.php +++ b/api/dtos/StackRenderResponse.php @@ -25,7 +25,7 @@ namespace api\dtos; defined('MOODLE_INTERNAL') || die(); -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackRenderResponse { /** @var string */ public $questionrender; @@ -43,7 +43,7 @@ class StackRenderResponse { public $iframes; } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackRenderInput { /** @var int */ public $validationtype; diff --git a/api/dtos/StackTestResponse.php b/api/dtos/StackTestResponse.php index 87008dfbe6a..6873a3fb28d 100644 --- a/api/dtos/StackTestResponse.php +++ b/api/dtos/StackTestResponse.php @@ -24,7 +24,7 @@ namespace api\dtos; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackTestResponse { /** @var string */ public $name = ''; diff --git a/api/dtos/StackValidationResponse.php b/api/dtos/StackValidationResponse.php index 00213f285ab..4dad10a3013 100644 --- a/api/dtos/StackValidationResponse.php +++ b/api/dtos/StackValidationResponse.php @@ -24,7 +24,7 @@ namespace api\dtos; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackValidationResponse { /** @var string */ public $validation; diff --git a/api/emulation/Localization.php b/api/emulation/Localization.php index 22746a771f8..1634c7f16d6 100644 --- a/api/emulation/Localization.php +++ b/api/emulation/Localization.php @@ -25,14 +25,14 @@ defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../lang/multilang.php'); -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function current_language() { $supportedlanguages = ['en', 'de']; return locale_lookup($supportedlanguages, $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en', true, 'en'); } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function get_string($identifier, $component, $a = null) { $userlanguage = current_language(); @@ -81,11 +81,11 @@ function get_string($identifier, $component, $a = null) { // Used for multilanguage questions, retrusn dependencies between languages. // We currently support only english and german, therefore this is not that relevant for us. -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function get_string_manager() { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Class return new class { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_language_dependencies($lang) { return []; } diff --git a/api/emulation/MoodleEmulation.php b/api/emulation/MoodleEmulation.php index aecfa4e9b41..bc20bca5cd2 100644 --- a/api/emulation/MoodleEmulation.php +++ b/api/emulation/MoodleEmulation.php @@ -35,30 +35,30 @@ // Required to pass Moodle code check. require_login(); -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class moodle_exception extends Exception { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($a1, $a2, $a3, $error) { parent::__construct($error); } } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class question_graded_automatically_with_countback { // phpcs:ignore moodle.Commenting.VariableComment.Missing public $defaultmark = 1; } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Interface interface question_automatically_gradable_with_multiple_parts { } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function clean_param($in, $param) { return $in; } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function get_config($component, $parameter = null) { global $CFG; if ($parameter === null) { @@ -91,21 +91,21 @@ function s($var) { return preg_replace('/&#(\d+|x[0-9a-f]+);/i', '&#$1;', htmlspecialchars($var, ENT_QUOTES, 'UTF-8')); } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function format_text($text) { return $text; } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function require_login() { return; } -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Function function get_file_storage() { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Class $storage = new class { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_area_files($x, $y, $z, $a) { return []; } diff --git a/api/emulation/Renderer.php b/api/emulation/Renderer.php index e49c89ced28..8c92886ba2c 100644 --- a/api/emulation/Renderer.php +++ b/api/emulation/Renderer.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class qtype_stack_renderer { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function fact_sheet($name, $fact) { $name = html_writer::tag('h5', $name); return html_writer::tag('div', $name.$fact, ['class' => 'factsheet']); diff --git a/api/util/ErrorRenderer.php b/api/util/ErrorRenderer.php index ff3f55c0bcc..ec1637184ae 100644 --- a/api/util/ErrorRenderer.php +++ b/api/util/ErrorRenderer.php @@ -26,9 +26,9 @@ use Slim\Interfaces\ErrorRendererInterface; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class ErrorRenderer implements ErrorRendererInterface { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __invoke(\Throwable $exception, bool $displayerrordetails): string { $message = $exception instanceof \stack_exception ? $exception->getMessage() : "An Error occured while processing the question"; diff --git a/api/util/StackIframeHolder.php b/api/util/StackIframeHolder.php index fdfbec2f498..7ebc05ce18a 100644 --- a/api/util/StackIframeHolder.php +++ b/api/util/StackIframeHolder.php @@ -30,12 +30,12 @@ namespace api\util; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackIframeHolder { // phpcs:ignore moodle.Commenting.VariableComment.Missing public static $iframes = []; - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public static function add_iframe($args) { for ($i = 0; $i < 5; $i++) { $args[$i] = json_decode($args[$i]); diff --git a/api/util/StackPlotReplacer.php b/api/util/StackPlotReplacer.php index 5757a6b9acb..089b0849284 100644 --- a/api/util/StackPlotReplacer.php +++ b/api/util/StackPlotReplacer.php @@ -24,9 +24,9 @@ namespace api\util; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackPlotReplacer { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public static function replace_plots(&$plots, &$text, $nameprefix, $storeprefix) { $i = 0; @@ -44,7 +44,7 @@ function ($matches) use (&$i, $nameprefix, &$plots) { }, $text); } - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public static function persist_plugin_files(\qtype_stack_question $question, $storeprefix) { global $CFG; foreach ($question->pluginfiles as $name => $content) { diff --git a/api/util/StackQuestionLoader.php b/api/util/StackQuestionLoader.php index 89adafd6998..c0c1ce83048 100644 --- a/api/util/StackQuestionLoader.php +++ b/api/util/StackQuestionLoader.php @@ -34,7 +34,7 @@ * Converts question xml into usable format */ class StackQuestionLoader { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public static function loadxml($xml, $includetests=false) { // TO-DO: Consider defaults. try { @@ -300,7 +300,7 @@ public static function loadxml($xml, $includetests=false) { return ['question' => $question, 'testcases' => $testcases]; } - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function private static function handlefiles(\SimpleXMLElement $files) { $data = []; @@ -311,7 +311,7 @@ private static function handlefiles(\SimpleXMLElement $files) { return $data; } - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function private static function parseboolean(\SimpleXMLElement $element) { $v = (string) $element; if ($v === "0") { diff --git a/api/util/StackSeedHelper.php b/api/util/StackSeedHelper.php index 402ba72fa4b..34dbc149c22 100644 --- a/api/util/StackSeedHelper.php +++ b/api/util/StackSeedHelper.php @@ -24,9 +24,9 @@ namespace api\util; -// phpcs:ignore moodle.Commenting.MissingDocblock.Missing +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class StackSeedHelper { - // phpcs:ignore moodle.Commenting.MissingDocblock.Missing + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public static function initialize_seed($question, $seed) { if ($question->has_random_variants()) { // We require the xml to include deployed variants. From 25430247fec1f639960153eb3fa7b661ac6dd6c0 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Thu, 12 Dec 2024 13:22:16 +0000 Subject: [PATCH 03/23] code-tidy - add package --- adminui/answertests.php | 1 + adminui/cascacheview.php | 1 + adminui/caschat.php | 1 + adminui/compiledquestion.php | 1 + adminui/dependencies.php | 1 + adminui/equivdemo.php | 1 + adminui/healthcheck.php | 1 + adminui/replacedollars.php | 1 + adminui/replacedollarsindex.php | 1 + adminui/studentinputs.php | 1 + adminui/subscripts.php | 1 + adminui/todo.php | 1 + api/emulation/HtmlWriter.php | 48 +++++++++---------- .../backup_qtype_stack_plugin.class.php | 1 + .../restore_qtype_stack_plugin.class.php | 1 + classes/privacy/provider.php | 1 + corsscripts/stackgeogebra.js | 1 + corsscripts/stacksortable.js | 1 + edit_stack_form.php | 1 + exportone.php | 1 + plot.php | 1 + question.php | 1 + questiontestdelete.php | 1 + questiontestedit.php | 1 + questiontestform.php | 2 + questiontestreport.php | 1 + questiontestrun.php | 1 + questiontype.php | 1 + renderer.php | 1 + settingslib.php | 2 + stack/answertest/anstest.class.php | 1 + stack/answertest/at_general_cas.class.php | 1 + .../at_general_cas_preprepare.class.php | 1 + stack/bulktester.class.php | 1 + stack/cas/caserror.class.php | 1 + stack/cas/castext2/blocks/geogebra.block.php | 1 + stack/cas/connector.class.php | 1 + stack/cas/connector.dbcache.class.php | 1 + stack/cas/connector.healthcheck.class.php | 1 + stack/cas/connector.interface.php | 1 + stack/cas/connector.linux.class.php | 1 + stack/cas/connector.server.class.php | 1 + stack/cas/connector.server_proxy.class.php | 1 + stack/cas/connector.windows.class.php | 1 + stack/cas/connectorhelper.class.php | 1 + stack/cas/keyval.class.php | 1 + stack/graphlayout/graph.php | 1 + stack/graphlayout/graphclump.php | 1 + stack/graphlayout/graphnode.php | 1 + stack/graphlayout/prtnode.php | 1 + stack/graphlayout/svgrenderer.php | 1 + stack/graphlayout/textrenderer.php | 1 + stack/input/algebraic/algebraic.class.php | 1 + stack/input/boolean/boolean.class.php | 1 + stack/input/dropdown/dropdown.class.php | 1 + stack/input/equiv/equiv.class.php | 1 + stack/input/inputbase.class.php | 1 + stack/input/inputstate.class.php | 1 + stack/input/matrix/matrix.class.php | 1 + stack/input/numerical/numerical.class.php | 1 + stack/input/singlechar/singlechar.class.php | 1 + stack/input/string/string.class.php | 1 + stack/input/textarea/textarea.class.php | 1 + stack/input/units/units.class.php | 1 + stack/input/varmatrix/varmatrix.class.php | 1 + stack/mathsoutput/fact_sheets.class.php | 1 + stack/mathsoutput/mathsoutput.class.php | 1 + stack/mathsoutput/mathsoutputapi.class.php | 1 + stack/mathsoutput/mathsoutputbase.class.php | 1 + .../mathsoutputfilterbase.class.php | 1 + .../mathsoutput/mathsoutputmathjax.class.php | 1 + stack/mathsoutput/mathsoutputmaths.class.php | 1 + .../mathsoutput/mathsoutputoumaths.class.php | 1 + stack/mathsoutput/mathsoutputtex.class.php | 1 + stack/options.class.php | 1 + stack/potentialresponsetreestate.class.php | 1 + stack/questionreport.class.php | 1 + stack/utils.class.php | 5 ++ tests/editform_test.php | 1 + tests/fixtures/answertestfixtures.class.php | 1 + tests/fixtures/apifixtures.class.php | 1 + tests/fixtures/ast_filter_test_base.php | 1 + tests/fixtures/equivfixtures.class.php | 1 + tests/fixtures/inputfixtures.class.php | 1 + .../fixtures/maximacorrectiveparser.class.php | 1 + tests/fixtures/numbersfixtures.class.php | 1 + tests/fixtures/subscriptsfixtures.class.php | 1 + tests/fixtures/test_base.php | 2 + tests/fixtures/test_maxima_configuration.php | 1 + tests/input_equiv_test.php | 1 + tests/input_numerical_test.php | 1 + tests/input_textarea_test.php | 1 + tests/restore_logic_test.php | 2 + tests/vle_specific_test.php | 1 + textdownload.php | 1 + tidyquestion.php | 1 + tidyquestionform.php | 2 + 97 files changed, 129 insertions(+), 24 deletions(-) diff --git a/adminui/answertests.php b/adminui/answertests.php index d1e0544957d..b1782365eff 100644 --- a/adminui/answertests.php +++ b/adminui/answertests.php @@ -21,6 +21,7 @@ * correctly, and second it serves to document the expected behaviour of answer * tests, which is useful for learning how they work. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/cascacheview.php b/adminui/cascacheview.php index 4fc5433869e..7d51028fc17 100644 --- a/adminui/cascacheview.php +++ b/adminui/cascacheview.php @@ -18,6 +18,7 @@ * This script lets the user see the latest commands stored to CAS * cache as pretty printted presentations. This exists for debugging. * + * @package qtype_stack * @copyright 2019 Aalto University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/caschat.php b/adminui/caschat.php index 5f4408ca38e..cf2d573c300 100644 --- a/adminui/caschat.php +++ b/adminui/caschat.php @@ -19,6 +19,7 @@ * This can be useful for learning about the CAS syntax, and also for testing * that maxima is working correctly. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/compiledquestion.php b/adminui/compiledquestion.php index 573ea00b85f..e61ae38cef4 100644 --- a/adminui/compiledquestion.php +++ b/adminui/compiledquestion.php @@ -20,6 +20,7 @@ * * This is for developers. * + * @package qtype_stack * @copyright 2022 Aalto University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/dependencies.php b/adminui/dependencies.php index c87f65fc578..9b43afb1ff9 100644 --- a/adminui/dependencies.php +++ b/adminui/dependencies.php @@ -22,6 +22,7 @@ * the whole logic in a fast way. Thus this does not work for questions * that have not been compiled. * + * @package qtype_stack * @copyright 2022 Aalto University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/equivdemo.php b/adminui/equivdemo.php index 283962804d5..c48e61c1aad 100644 --- a/adminui/equivdemo.php +++ b/adminui/equivdemo.php @@ -15,6 +15,7 @@ // along with Stack. If not, see . /** + * @package qtype_stack * @copyright 2016 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/healthcheck.php b/adminui/healthcheck.php index e0a5b591084..a899c151f70 100644 --- a/adminui/healthcheck.php +++ b/adminui/healthcheck.php @@ -19,6 +19,7 @@ * all the parts are working properly, including the conection to the CAS, * graph plotting, and equation rendering. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/replacedollars.php b/adminui/replacedollars.php index 9ea4383c842..3b32eb867fa 100644 --- a/adminui/replacedollars.php +++ b/adminui/replacedollars.php @@ -22,6 +22,7 @@ * from this script can overload your web browser. In that case, there * is an un-documented feature. Add preview=0 at the end of the URL. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/replacedollarsindex.php b/adminui/replacedollarsindex.php index abf927dfdd2..31136d47d16 100644 --- a/adminui/replacedollarsindex.php +++ b/adminui/replacedollarsindex.php @@ -17,6 +17,7 @@ /** * This script lets the user create or edit question tests for a question. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/studentinputs.php b/adminui/studentinputs.php index 774c1e0fb80..68e9e9ca4bd 100644 --- a/adminui/studentinputs.php +++ b/adminui/studentinputs.php @@ -17,6 +17,7 @@ /** * This script runs attempts to "validate" a list of potential answer strings from students and verifies the results. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/subscripts.php b/adminui/subscripts.php index ed2e8978afa..c5eef6303f2 100644 --- a/adminui/subscripts.php +++ b/adminui/subscripts.php @@ -21,6 +21,7 @@ * correctly, and second it serves to document the expected behaviour of answer * tests, which is useful for learning how they work. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/adminui/todo.php b/adminui/todo.php index ffba52bc980..ba1218de855 100644 --- a/adminui/todo.php +++ b/adminui/todo.php @@ -18,6 +18,7 @@ * This page lets the user find all questions in a course in which they are a techer * which have a [[todo]] block. The questions are sorted by any tags they might have. * + * @package qtype_stack * @copyright 2024 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/api/emulation/HtmlWriter.php b/api/emulation/HtmlWriter.php index 14959123abc..04fe1743055 100644 --- a/api/emulation/HtmlWriter.php +++ b/api/emulation/HtmlWriter.php @@ -30,10 +30,10 @@ class html_writer { * * @param string $tagname The name of tag ('a', 'img', 'span' etc.) * @param string $contents What goes between the opening and closing tags - * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) + * @param array|null $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) * @return string HTML fragment */ - public static function tag($tagname, $contents, array $attributes = null) { + public static function tag($tagname, $contents, ?array $attributes = null) { return self::start_tag($tagname, $attributes) . $contents . self::end_tag($tagname); } @@ -41,10 +41,10 @@ public static function tag($tagname, $contents, array $attributes = null) { * Outputs an opening tag with attributes * * @param string $tagname The name of tag ('a', 'img', 'span' etc.) - * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) + * @param array|null $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) * @return string HTML fragment */ - public static function start_tag($tagname, array $attributes = null) { + public static function start_tag($tagname, ?array $attributes = null) { return '<' . $tagname . self::attributes($attributes) . '>'; } @@ -62,10 +62,10 @@ public static function end_tag($tagname) { * Outputs an empty tag with attributes * * @param string $tagname The name of tag ('input', 'img', 'br' etc.) - * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) + * @param array|null $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) * @return string HTML fragment */ - public static function empty_tag($tagname, array $attributes = null) { + public static function empty_tag($tagname, ?array $attributes = null) { return '<' . $tagname . self::attributes($attributes) . ' />'; } @@ -74,10 +74,10 @@ public static function empty_tag($tagname, array $attributes = null) { * * @param string $tagname The name of tag ('a', 'img', 'span' etc.) * @param string $contents What goes between the opening and closing tags - * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) + * @param array|null $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) * @return string HTML fragment */ - public static function nonempty_tag($tagname, $contents, array $attributes = null) { + public static function nonempty_tag($tagname, $contents, ?array $attributes = null) { if ($contents === '' || is_null($contents)) { return ''; } @@ -110,11 +110,11 @@ public static function attribute($name, $value) { /** * Outputs a list of HTML attributes and values * - * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) + * @param array|null $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.) * The values will be escaped with {@link s()} * @return string HTML fragment */ - public static function attributes(array $attributes = null) { + public static function attributes(?array $attributes = null) { $attributes = (array)$attributes; $output = ''; foreach ($attributes as $name => $value) { @@ -148,10 +148,10 @@ public static function random_id($base = 'random') { * * @param string|moodle_url $url The URL * @param string $text The text - * @param array $attributes HTML attributes + * @param array|null $attributes HTML attributes * @return string HTML fragment */ - public static function link($url, $text, array $attributes = null) { + public static function link($url, $text, ?array $attributes = null) { $attributes = (array)$attributes; $attributes['href'] = $url; @@ -165,10 +165,10 @@ public static function link($url, $text, array $attributes = null) { * @param string $value The value of the checkbox * @param bool $checked Whether the checkbox is checked * @param string $label The label for the checkbox - * @param array $attributes Any attributes to apply to the checkbox + * @param array|null $attributes Any attributes to apply to the checkbox * @return string html fragment */ - public static function checkbox($name, $value, $checked = true, $label = '', array $attributes = null) { + public static function checkbox($name, $value, $checked = true, $label = '', ?array $attributes = null) { $attributes = (array)$attributes; $output = ''; @@ -196,10 +196,10 @@ public static function checkbox($name, $value, $checked = true, $label = '', arr * * @param string $name name of select element * @param bool $selected - * @param array $attributes - html select element attributes + * @param array|null $attributes - html select element attributes * @return string HTML fragment */ - public static function select_yes_no($name, $selected = true, array $attributes = null) { + public static function select_yes_no($name, $selected = true, ?array $attributes = null) { $options = ['1' => get_string('yes'), '0' => get_string('no')]; return self::select($options, $name, $selected, null, $attributes); @@ -216,11 +216,11 @@ public static function select_yes_no($name, $selected = true, array $attributes * @param string $name name of select element * @param string|array $selected value or array of values depending on multiple attribute * @param array|bool $nothing add nothing selected option, or false of not added - * @param array $attributes html select element attributes + * @param array|null $attributes html select element attributes * @return string HTML fragment */ public static function select( - array $options, $name, $selected = '', $nothing = ['' => 'choosedots'], array $attributes = null) { + array $options, $name, $selected = '', $nothing = ['' => 'choosedots'], ?array $attributes = null) { $attributes = (array)$attributes; if (is_array($nothing)) { foreach ($nothing as $k => $v) { @@ -329,10 +329,10 @@ private static function select_optgroup($groupname, $options, array $selected) { * @param string $name fieldname * @param int $currenttime A default timestamp in GMT * @param int $step minute spacing - * @param array $attributes - html select element attributes + * @param array|null $attributes - html select element attributes * @return HTML fragment */ - public static function select_time($type, $name, $currenttime = 0, $step = 5, array $attributes = null) { + public static function select_time($type, $name, $currenttime = 0, $step = 5, ?array $attributes = null) { if (!$currenttime) { $currenttime = time(); } @@ -394,11 +394,11 @@ public static function select_time($type, $name, $currenttime = 0, $step = 5, ar * Note: 'list' is a reserved keyword ;-) * * @param array $items - * @param array $attributes + * @param array|null $attributes * @param string $tag ul or ol * @return string */ - public static function alist(array $items, array $attributes = null, $tag = 'ul') { + public static function alist(array $items, ?array $attributes = null, $tag = 'ul') { $output = ''; foreach ($items as $item) { @@ -414,10 +414,10 @@ public static function alist(array $items, array $attributes = null, $tag = 'ul' * Returns hidden input fields created from url parameters. * * @param moodle_url $url - * @param array $exclude list of excluded parameters + * @param array|null $exclude list of excluded parameters * @return string HTML fragment */ - public static function input_hidden_params(moodle_url $url, array $exclude = null) { + public static function input_hidden_params(moodle_url $url, ?array $exclude = null) { $exclude = (array) $exclude; $params = $url->params(); foreach ($exclude as $key) { diff --git a/backup/moodle2/backup_qtype_stack_plugin.class.php b/backup/moodle2/backup_qtype_stack_plugin.class.php index 383c8ed159a..6126ce722d9 100644 --- a/backup/moodle2/backup_qtype_stack_plugin.class.php +++ b/backup/moodle2/backup_qtype_stack_plugin.class.php @@ -24,6 +24,7 @@ /** * Provides the information to backup STACK questions * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/backup/moodle2/restore_qtype_stack_plugin.class.php b/backup/moodle2/restore_qtype_stack_plugin.class.php index feb086823f4..6480186783d 100644 --- a/backup/moodle2/restore_qtype_stack_plugin.class.php +++ b/backup/moodle2/restore_qtype_stack_plugin.class.php @@ -31,6 +31,7 @@ /** * Provides the information to restore STACK questions * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index a21c9d57671..607527361fe 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -27,6 +27,7 @@ /** * Privacy Subsystem for qtype_stack implementing null_provider. * + * @package qtype_stack * @copyright 2018 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/corsscripts/stackgeogebra.js b/corsscripts/stackgeogebra.js index 1516f32c7f0..eff07efa4fc 100644 --- a/corsscripts/stackgeogebra.js +++ b/corsscripts/stackgeogebra.js @@ -7,6 +7,7 @@ * nor the project's national funding agency DAAD are responsible for the content or liable for * any losses or damage resulting of the use of these resources. * + * @package qtype_stack * @copyright 2022 University of Edinburgh * @author Tim Lutz * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/corsscripts/stacksortable.js b/corsscripts/stacksortable.js index 5a674038c96..75ee115aff9 100644 --- a/corsscripts/stacksortable.js +++ b/corsscripts/stacksortable.js @@ -1,6 +1,7 @@ /** * This is a library for SortableJS functionality used to generate STACK Parsons blocks. * + * @package qtype_stack * @copyright 2023 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/edit_stack_form.php b/edit_stack_form.php index ebd6303ee15..d7163fd8981 100644 --- a/edit_stack_form.php +++ b/edit_stack_form.php @@ -34,6 +34,7 @@ /** * Stack question editing form definition. * + * @package qtype_stack * @copyright 2012 The Open University. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/exportone.php b/exportone.php index 7664bbba5f4..d825c684c10 100644 --- a/exportone.php +++ b/exportone.php @@ -22,6 +22,7 @@ * use question/exportone.php, or question/bank/exporttoxml/exportone.php, * as it later became, instead. * + * @package qtype_stack * @copyright 2015 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/plot.php b/plot.php index bb06ac512c8..8c8fad6e247 100644 --- a/plot.php +++ b/plot.php @@ -17,6 +17,7 @@ /** * This script serves plot files that have been saved in the moodledata folder. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/question.php b/question.php index 7afa4cda5ee..ecfff26882b 100644 --- a/question.php +++ b/question.php @@ -44,6 +44,7 @@ /** * Represents a Stack question. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontestdelete.php b/questiontestdelete.php index 52007fb4ea7..289e64eee7b 100644 --- a/questiontestdelete.php +++ b/questiontestdelete.php @@ -17,6 +17,7 @@ /** * This script lets the user delete a question test for a question, after confirmation. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontestedit.php b/questiontestedit.php index dde9768e9ab..edf33855567 100644 --- a/questiontestedit.php +++ b/questiontestedit.php @@ -17,6 +17,7 @@ /** * This script lets the user create or edit question tests for a question. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontestform.php b/questiontestform.php index cd9867d4654..2e751a8f999 100644 --- a/questiontestform.php +++ b/questiontestform.php @@ -17,6 +17,7 @@ /** * This file defines the editing form for editing question tests. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +31,7 @@ /** * The editing form for editing STACK question tests. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontestreport.php b/questiontestreport.php index 01ed4694368..a239a1183d7 100644 --- a/questiontestreport.php +++ b/questiontestreport.php @@ -21,6 +21,7 @@ * re-generate reports. The script is designed to let a question author improve feedback * and assessment by looking at what students type, easily and without going through a quiz report. * + * @package qtype_stack * @copyright 2020 the University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontestrun.php b/questiontestrun.php index 678213ff3b3..3d1ffed772e 100644 --- a/questiontestrun.php +++ b/questiontestrun.php @@ -27,6 +27,7 @@ * The script takes one parameter id which is a questionid as a parameter. * In can optionally also take a random seed. * + * @package qtype_stack * @copyright 2012 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontype.php b/questiontype.php index c309f9a00f6..500337ebff6 100644 --- a/questiontype.php +++ b/questiontype.php @@ -43,6 +43,7 @@ /** * Stack question type class. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/renderer.php b/renderer.php index e83806e6cfd..ab1d6b9dc62 100644 --- a/renderer.php +++ b/renderer.php @@ -29,6 +29,7 @@ /** * Generates the output for Stack questions. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/settingslib.php b/settingslib.php index 343e3bd8e6e..81dbd0575bf 100644 --- a/settingslib.php +++ b/settingslib.php @@ -30,6 +30,7 @@ * * Just so we can lazy-load the choices. * + * @package qtype_stack * @copyright 2011 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -70,6 +71,7 @@ public function load_choices() { * * So we can lazy-load the choices. * + * @package qtype_stack * @copyright 2013 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/answertest/anstest.class.php b/stack/answertest/anstest.class.php index c594d61883d..644152e50d5 100644 --- a/stack/answertest/anstest.class.php +++ b/stack/answertest/anstest.class.php @@ -17,6 +17,7 @@ /** * Answer test base class. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/answertest/at_general_cas.class.php b/stack/answertest/at_general_cas.class.php index 0b056c1f0e5..80f6d424683 100644 --- a/stack/answertest/at_general_cas.class.php +++ b/stack/answertest/at_general_cas.class.php @@ -22,6 +22,7 @@ /** * General answer test which connects to the CAS - prevents duplicate code. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/answertest/at_general_cas_preprepare.class.php b/stack/answertest/at_general_cas_preprepare.class.php index ccd695e11e0..7f6b4e8f6f5 100644 --- a/stack/answertest/at_general_cas_preprepare.class.php +++ b/stack/answertest/at_general_cas_preprepare.class.php @@ -22,6 +22,7 @@ /** * General answer test which connects to the CAS - prevents duplicate code. * + * @package qtype_stack * @copyright 2020 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/bulktester.class.php b/stack/bulktester.class.php index b2ae17182b3..ee51612ac42 100644 --- a/stack/bulktester.class.php +++ b/stack/bulktester.class.php @@ -19,6 +19,7 @@ /** * Class for running the question tests in bulk. * + * @package qtype_stack * @copyright 2015 The Open University. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ diff --git a/stack/cas/caserror.class.php b/stack/cas/caserror.class.php index a04834f3eda..8fa6a6f4352 100644 --- a/stack/cas/caserror.class.php +++ b/stack/cas/caserror.class.php @@ -24,6 +24,7 @@ * * This class also defines the syntax for those context/location paths. * + * @package qtype_stack * @copyright 2022 Aalto University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/castext2/blocks/geogebra.block.php b/stack/cas/castext2/blocks/geogebra.block.php index 0398be79bae..66857eb0c4b 100644 --- a/stack/cas/castext2/blocks/geogebra.block.php +++ b/stack/cas/castext2/blocks/geogebra.block.php @@ -25,6 +25,7 @@ * are responsible for the content or liable for any losses or damage resulting * of the use of these resources. * + * @package qtype_stack * @copyright 2022-2023 University of Edinburgh * @author Tim Lutz * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/stack/cas/connector.class.php b/stack/cas/connector.class.php index 0ddc28450f9..3f4d82d43ab 100644 --- a/stack/cas/connector.class.php +++ b/stack/cas/connector.class.php @@ -22,6 +22,7 @@ /** * The base class for connections to Maxima. * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/connector.dbcache.class.php b/stack/cas/connector.dbcache.class.php index cf44b33f186..9971409092c 100644 --- a/stack/cas/connector.dbcache.class.php +++ b/stack/cas/connector.dbcache.class.php @@ -17,6 +17,7 @@ /** * Class which undertakes process control to connect to Maxima. * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/connector.healthcheck.class.php b/stack/cas/connector.healthcheck.class.php index 8137956682c..a4e36d2348b 100644 --- a/stack/cas/connector.healthcheck.class.php +++ b/stack/cas/connector.healthcheck.class.php @@ -28,6 +28,7 @@ /** * This class supports the healthcheck functions.. * + * @package qtype_stack * @copyright 2023 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/connector.interface.php b/stack/cas/connector.interface.php index 671fb5f9ff3..2819630f64e 100644 --- a/stack/cas/connector.interface.php +++ b/stack/cas/connector.interface.php @@ -17,6 +17,7 @@ /** * Defines the stack_cas_connection interface. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/connector.linux.class.php b/stack/cas/connector.linux.class.php index 45cb6f6c47e..06689585fa4 100644 --- a/stack/cas/connector.linux.class.php +++ b/stack/cas/connector.linux.class.php @@ -17,6 +17,7 @@ /** * Connection to Maxima for linux-like systems. * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/connector.server.class.php b/stack/cas/connector.server.class.php index c5f5178e67d..ebf210f4721 100644 --- a/stack/cas/connector.server.class.php +++ b/stack/cas/connector.server.class.php @@ -19,6 +19,7 @@ * This version handles transfer of the plots generated on possibly remote servlet. * For details of this see https://github.com/maths/stack_util_maximapool/ * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @copyright 2012 Aalto University - Matti Harjula * @copyright 2014 Loughborough University diff --git a/stack/cas/connector.server_proxy.class.php b/stack/cas/connector.server_proxy.class.php index ef94a31aaa6..ad44dcc0c76 100644 --- a/stack/cas/connector.server_proxy.class.php +++ b/stack/cas/connector.server_proxy.class.php @@ -19,6 +19,7 @@ * This version handles transfer of the plots generated on possibly remote servlet. * For details of this see https://github.com/maths/stack_util_maximapool/ * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @copyright 2012 Aalto University - Matti Harjula * @copyright 2014 Loughborough University diff --git a/stack/cas/connector.windows.class.php b/stack/cas/connector.windows.class.php index a9a3efe717b..70c2a228301 100644 --- a/stack/cas/connector.windows.class.php +++ b/stack/cas/connector.windows.class.php @@ -17,6 +17,7 @@ /** * Connection to Maxima for Windows systems. * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/connectorhelper.class.php b/stack/cas/connectorhelper.class.php index 57d2030eaa3..be7bc5d70ca 100644 --- a/stack/cas/connectorhelper.class.php +++ b/stack/cas/connectorhelper.class.php @@ -25,6 +25,7 @@ /** * The base class for connections to Maxima. * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/cas/keyval.class.php b/stack/cas/keyval.class.php index 3233f5ef6df..6b78301901d 100644 --- a/stack/cas/keyval.class.php +++ b/stack/cas/keyval.class.php @@ -25,6 +25,7 @@ /** * Class to parse user-entered data into CAS sessions. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/graphlayout/graph.php b/stack/graphlayout/graph.php index 10959c9a545..fe6e3a32678 100644 --- a/stack/graphlayout/graph.php +++ b/stack/graphlayout/graph.php @@ -33,6 +33,7 @@ /** * Abstract representation of a graph (e.g. a PRT). * + * @package qtype_stack * @copyright 2013 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/graphlayout/graphclump.php b/stack/graphlayout/graphclump.php index 65286f1880f..80680e03f06 100644 --- a/stack/graphlayout/graphclump.php +++ b/stack/graphlayout/graphclump.php @@ -26,6 +26,7 @@ * Used by {@link stack_abstract_graph} during the layout algorithm. * This represents a group of nodes that have been laid out relative to each other. * + * @package qtype_stack * @copyright 2013 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/graphlayout/graphnode.php b/stack/graphlayout/graphnode.php index 64f7e970761..174a529350a 100644 --- a/stack/graphlayout/graphnode.php +++ b/stack/graphlayout/graphnode.php @@ -25,6 +25,7 @@ /** * Represents a node in a {@link stack_abstract_graph}. * + * @package qtype_stack * @copyright 2013 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/graphlayout/prtnode.php b/stack/graphlayout/prtnode.php index 5f1cd9261f7..4792b000137 100644 --- a/stack/graphlayout/prtnode.php +++ b/stack/graphlayout/prtnode.php @@ -29,6 +29,7 @@ /** * Represents a node in a STACK PRT extending {@link stack_abstract_graph}. * + * @package qtype_stack * @copyright 2023 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/graphlayout/svgrenderer.php b/stack/graphlayout/svgrenderer.php index 49426285532..a137593fcf3 100644 --- a/stack/graphlayout/svgrenderer.php +++ b/stack/graphlayout/svgrenderer.php @@ -25,6 +25,7 @@ /** * Displays a {@link stack_abstract_graph} as SVG. * + * @package qtype_stack * @copyright 2013 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/graphlayout/textrenderer.php b/stack/graphlayout/textrenderer.php index fcdfcebdac8..f503410811c 100644 --- a/stack/graphlayout/textrenderer.php +++ b/stack/graphlayout/textrenderer.php @@ -25,6 +25,7 @@ /** * Displays a {@link stack_abstract_graph} as text. * + * @package qtype_stack * @copyright 2023 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/algebraic/algebraic.class.php b/stack/input/algebraic/algebraic.class.php index 8fe5994fd53..af8dd099300 100644 --- a/stack/input/algebraic/algebraic.class.php +++ b/stack/input/algebraic/algebraic.class.php @@ -17,6 +17,7 @@ /** * A basic text-field input. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/boolean/boolean.class.php b/stack/input/boolean/boolean.class.php index 42d844994dc..a8db68603e3 100644 --- a/stack/input/boolean/boolean.class.php +++ b/stack/input/boolean/boolean.class.php @@ -17,6 +17,7 @@ /** * Input for entering true/false using a select dropdown. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/dropdown/dropdown.class.php b/stack/input/dropdown/dropdown.class.php index 6c33c26ce39..f41fe69ff6f 100644 --- a/stack/input/dropdown/dropdown.class.php +++ b/stack/input/dropdown/dropdown.class.php @@ -22,6 +22,7 @@ * Input that is a dropdown list/multiple choice that the teacher * has specified. * + * @package qtype_stack * @copyright 2015 University of Edinburgh * @author Chris Sangwin * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/stack/input/equiv/equiv.class.php b/stack/input/equiv/equiv.class.php index 50f17938c68..ae9cbc6ba41 100644 --- a/stack/input/equiv/equiv.class.php +++ b/stack/input/equiv/equiv.class.php @@ -22,6 +22,7 @@ * This is an input that allows reasoning by equivalence. * Each line input becomes one element of a list. * + * @package qtype_stack * @copyright 2015 Loughborough University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/inputbase.class.php b/stack/input/inputbase.class.php index a2124ad734c..71e7c6cb3e7 100644 --- a/stack/input/inputbase.class.php +++ b/stack/input/inputbase.class.php @@ -27,6 +27,7 @@ * Inputs are the controls that the teacher can put into the question * text to receive the student's response. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/inputstate.class.php b/stack/input/inputstate.class.php index 4f288848a8d..4e232f83f22 100644 --- a/stack/input/inputstate.class.php +++ b/stack/input/inputstate.class.php @@ -28,6 +28,7 @@ * @property-read string $contentsdisplayed how Stack interpreted the current contents of the input. * @property-read string $errors any validation errors. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/matrix/matrix.class.php b/stack/input/matrix/matrix.class.php index 384a2b02b26..a0522dc44ec 100644 --- a/stack/input/matrix/matrix.class.php +++ b/stack/input/matrix/matrix.class.php @@ -17,6 +17,7 @@ /** * A basic text-field input. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/numerical/numerical.class.php b/stack/input/numerical/numerical.class.php index 521b81891be..d52d42f0cc7 100644 --- a/stack/input/numerical/numerical.class.php +++ b/stack/input/numerical/numerical.class.php @@ -17,6 +17,7 @@ /** * A basic text-field input. * + * @package qtype_stack * @copyright 2017 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/singlechar/singlechar.class.php b/stack/input/singlechar/singlechar.class.php index 6651d0a315f..65f5eb32b28 100644 --- a/stack/input/singlechar/singlechar.class.php +++ b/stack/input/singlechar/singlechar.class.php @@ -17,6 +17,7 @@ /** * Input that accepts a single character. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/string/string.class.php b/stack/input/string/string.class.php index 8851d130cbd..a91379fee27 100644 --- a/stack/input/string/string.class.php +++ b/stack/input/string/string.class.php @@ -22,6 +22,7 @@ * A basic text-field input which is always interpreted as a Maxima string. * This has been requested to support the input of things like multi-base numbers. * + * @package qtype_stack * @copyright 2018 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/textarea/textarea.class.php b/stack/input/textarea/textarea.class.php index 6a4fb576151..3936e4eee27 100644 --- a/stack/input/textarea/textarea.class.php +++ b/stack/input/textarea/textarea.class.php @@ -23,6 +23,7 @@ * * The value is stored as a string maxima list. For example [1,hello,x + y]. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/units/units.class.php b/stack/input/units/units.class.php index 70551aac449..646065b00bd 100644 --- a/stack/input/units/units.class.php +++ b/stack/input/units/units.class.php @@ -17,6 +17,7 @@ /** * An input to support scientific units. Heavily based on algebraic. * + * @package qtype_stack * @copyright 2015 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/input/varmatrix/varmatrix.class.php b/stack/input/varmatrix/varmatrix.class.php index c8d1a2a04f4..e24995e5252 100644 --- a/stack/input/varmatrix/varmatrix.class.php +++ b/stack/input/varmatrix/varmatrix.class.php @@ -18,6 +18,7 @@ * An input which provides a matrix input of variable size. * Lots in common with the textarea class. * + * @package qtype_stack * @copyright 2019 Ruhr University Bochum * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/fact_sheets.class.php b/stack/mathsoutput/fact_sheets.class.php index ff2db9cce58..37382f15c8d 100644 --- a/stack/mathsoutput/fact_sheets.class.php +++ b/stack/mathsoutput/fact_sheets.class.php @@ -17,6 +17,7 @@ /** * The fact sheets class for STACK. * + * @package qtype_stack * @copyright 2014 Loughborough University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutput.class.php b/stack/mathsoutput/mathsoutput.class.php index b9a70c50e34..b29796a8438 100644 --- a/stack/mathsoutput/mathsoutput.class.php +++ b/stack/mathsoutput/mathsoutput.class.php @@ -23,6 +23,7 @@ /** * Public API to the maths rendering system. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputapi.class.php b/stack/mathsoutput/mathsoutputapi.class.php index 965c1a16df5..de533ea07ca 100644 --- a/stack/mathsoutput/mathsoutputapi.class.php +++ b/stack/mathsoutput/mathsoutputapi.class.php @@ -21,6 +21,7 @@ /** * STACK maths output methods for using MathJax with the minimal API. * + * @package qtype_stack * @copyright 2017 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputbase.class.php b/stack/mathsoutput/mathsoutputbase.class.php index 5ecd5ab717c..005587bdbe5 100644 --- a/stack/mathsoutput/mathsoutputbase.class.php +++ b/stack/mathsoutput/mathsoutputbase.class.php @@ -21,6 +21,7 @@ /** * The base class for STACK maths output methods. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputfilterbase.class.php b/stack/mathsoutput/mathsoutputfilterbase.class.php index 2411e4477f9..260c424f64e 100644 --- a/stack/mathsoutput/mathsoutputfilterbase.class.php +++ b/stack/mathsoutput/mathsoutputfilterbase.class.php @@ -19,6 +19,7 @@ /** * Base class for STACK maths output methods that use a Moodle text filter to do the work. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputmathjax.class.php b/stack/mathsoutput/mathsoutputmathjax.class.php index e840fe8f643..95f23791d53 100644 --- a/stack/mathsoutput/mathsoutputmathjax.class.php +++ b/stack/mathsoutput/mathsoutputmathjax.class.php @@ -22,6 +22,7 @@ /** * STACK maths output methods for using MathJax. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputmaths.class.php b/stack/mathsoutput/mathsoutputmaths.class.php index 4b567454299..29304fa8514 100644 --- a/stack/mathsoutput/mathsoutputmaths.class.php +++ b/stack/mathsoutput/mathsoutputmaths.class.php @@ -24,6 +24,7 @@ /** * STACK maths output methods for using The OU's maths filter. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputoumaths.class.php b/stack/mathsoutput/mathsoutputoumaths.class.php index f8a73562714..3e17bc0c0ce 100644 --- a/stack/mathsoutput/mathsoutputoumaths.class.php +++ b/stack/mathsoutput/mathsoutputoumaths.class.php @@ -24,6 +24,7 @@ /** * STACK maths output methods for using The OU's maths filter. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/mathsoutput/mathsoutputtex.class.php b/stack/mathsoutput/mathsoutputtex.class.php index f1a3a97c683..601cfa302fe 100644 --- a/stack/mathsoutput/mathsoutputtex.class.php +++ b/stack/mathsoutput/mathsoutputtex.class.php @@ -22,6 +22,7 @@ /** * STACK maths output methods for using Moodle's TeX filter. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/options.class.php b/stack/options.class.php index 4c2de8faa4e..5e3b7cba72e 100644 --- a/stack/options.class.php +++ b/stack/options.class.php @@ -18,6 +18,7 @@ * Options enable a context to be set for each question, and information * made generally available to other classes. * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/potentialresponsetreestate.class.php b/stack/potentialresponsetreestate.class.php index 54a40e46442..5c819e14fe7 100644 --- a/stack/potentialresponsetreestate.class.php +++ b/stack/potentialresponsetreestate.class.php @@ -19,6 +19,7 @@ /** * This class represents the current state of a potential response tree. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/stack/questionreport.class.php b/stack/questionreport.class.php index f762fbf8fdc..64dcfcef961 100644 --- a/stack/questionreport.class.php +++ b/stack/questionreport.class.php @@ -17,6 +17,7 @@ /** * Loads and manipulates data for display on the response analysis page. * + * @package qtype_stack * @copyright 2024 University of Edinburgh. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ diff --git a/stack/utils.class.php b/stack/utils.class.php index 906293b0e46..f7e9dd78f21 100644 --- a/stack/utils.class.php +++ b/stack/utils.class.php @@ -19,6 +19,7 @@ /** * Various utility classes for Stack. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -26,6 +27,7 @@ /** * Interface for a class that stores debug information (or not). * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -48,6 +50,7 @@ public function log($heading = '', $message = ''); /** * Interface for a class that stores debug information (or not). * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -81,6 +84,7 @@ public function log($heading = '', $message = '') { /** * A null stack_debug_log. Does not acutally log anything. Used when debugging is off. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -107,6 +111,7 @@ public function log($heading = '', $message = '') { /** * Utility methods for processing strings. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/editform_test.php b/tests/editform_test.php index 32743faf489..961d52a9228 100644 --- a/tests/editform_test.php +++ b/tests/editform_test.php @@ -64,6 +64,7 @@ public function __construct($questiontext, $specificfeedback) { /** * Unit tests for Stack question editing form. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @group qtype_stack diff --git a/tests/fixtures/answertestfixtures.class.php b/tests/fixtures/answertestfixtures.class.php index fb08687dfcb..0c1cd9af574 100644 --- a/tests/fixtures/answertestfixtures.class.php +++ b/tests/fixtures/answertestfixtures.class.php @@ -21,6 +21,7 @@ * correctly, and second it serves to document the expected behaviour of answer * tests, which is useful for learning how they work. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/apifixtures.class.php b/tests/fixtures/apifixtures.class.php index 3dffd7eae80..044d3242c15 100644 --- a/tests/fixtures/apifixtures.class.php +++ b/tests/fixtures/apifixtures.class.php @@ -17,6 +17,7 @@ /** * + * @package qtype_stack * @copyright 2024 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/ast_filter_test_base.php b/tests/fixtures/ast_filter_test_base.php index f820ffeba9c..df2cf39bdc1 100644 --- a/tests/fixtures/ast_filter_test_base.php +++ b/tests/fixtures/ast_filter_test_base.php @@ -30,6 +30,7 @@ * see what happened when they were created and that things still work * the same. * + * @package qtype_stack * @copyright 2019 Aalto University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/equivfixtures.class.php b/tests/fixtures/equivfixtures.class.php index b28379843d7..b04038f9d4b 100644 --- a/tests/fixtures/equivfixtures.class.php +++ b/tests/fixtures/equivfixtures.class.php @@ -15,6 +15,7 @@ // along with Stack. If not, see . /** + * @package qtype_stack * @copyright 2017 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/inputfixtures.class.php b/tests/fixtures/inputfixtures.class.php index 0bec4949dc6..3965c5cbd11 100644 --- a/tests/fixtures/inputfixtures.class.php +++ b/tests/fixtures/inputfixtures.class.php @@ -19,6 +19,7 @@ * * This helps us verify how STACK "validates" strings supplied by the student. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/maximacorrectiveparser.class.php b/tests/fixtures/maximacorrectiveparser.class.php index 9ae9fec1f27..37ad77e2cf6 100644 --- a/tests/fixtures/maximacorrectiveparser.class.php +++ b/tests/fixtures/maximacorrectiveparser.class.php @@ -21,6 +21,7 @@ * correctly, and second it serves to document the expected behaviour of answer * tests, which is useful for learning how they work. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/numbersfixtures.class.php b/tests/fixtures/numbersfixtures.class.php index 635930bc4fc..513fd8f8166 100644 --- a/tests/fixtures/numbersfixtures.class.php +++ b/tests/fixtures/numbersfixtures.class.php @@ -18,6 +18,7 @@ * This script provides test cases for the numerical rounding tests. * * + * @package qtype_stack * @copyright 2016 University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/subscriptsfixtures.class.php b/tests/fixtures/subscriptsfixtures.class.php index 656c68fa67b..04c8865005c 100644 --- a/tests/fixtures/subscriptsfixtures.class.php +++ b/tests/fixtures/subscriptsfixtures.class.php @@ -17,6 +17,7 @@ /** * This script checks display of subscript elements. * + * @package qtype_stack * @copyright 2012 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/test_base.php b/tests/fixtures/test_base.php index 4ab3f6fd15f..ae498383052 100644 --- a/tests/fixtures/test_base.php +++ b/tests/fixtures/test_base.php @@ -26,6 +26,7 @@ * needs to call maxima will work (providing you have set up the neccessary * defines in phpunit.xml. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -239,6 +240,7 @@ public static function assertDoesNotMatchRegularExpression(string $pattern, stri * * Sets up the Maxima connection, and provides some additional asserts. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/fixtures/test_maxima_configuration.php b/tests/fixtures/test_maxima_configuration.php index 0284a59ef86..1c1beead8d6 100644 --- a/tests/fixtures/test_maxima_configuration.php +++ b/tests/fixtures/test_maxima_configuration.php @@ -29,6 +29,7 @@ /** * Helper class for setting up the STACK configuration for automated tests. * + * @package qtype_stack * @copyright 2014 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/input_equiv_test.php b/tests/input_equiv_test.php index 09707ca8d9e..b0e761553be 100644 --- a/tests/input_equiv_test.php +++ b/tests/input_equiv_test.php @@ -31,6 +31,7 @@ /** * Unit tests for stack_equiv_input. * + * @package qtype_stack * @copyright 2015 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @group qtype_stack diff --git a/tests/input_numerical_test.php b/tests/input_numerical_test.php index 2833ff0c05f..f40829a0ee0 100644 --- a/tests/input_numerical_test.php +++ b/tests/input_numerical_test.php @@ -32,6 +32,7 @@ require_once(__DIR__ . '/../stack/input/factory.class.php'); /** + * @package qtype_stack * @copyright 2018 The University of Edinburgh. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ diff --git a/tests/input_textarea_test.php b/tests/input_textarea_test.php index 162b056d745..e42d4de5ad3 100644 --- a/tests/input_textarea_test.php +++ b/tests/input_textarea_test.php @@ -256,6 +256,7 @@ public function test_validate_student_response_same_type_true_valid_3() { /** * Test helper class that exploses some protected methods. * + * @package qtype_stack * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/restore_logic_test.php b/tests/restore_logic_test.php index 3420a213170..00a72eddd78 100644 --- a/tests/restore_logic_test.php +++ b/tests/restore_logic_test.php @@ -25,6 +25,7 @@ /** * Unit tests for the restore logic. * + * @package qtype_stack * @copyright 2017 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -72,6 +73,7 @@ public function after_execute_question() { /** * + * @package qtype_stack * @copyright 2012 The University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @group qtype_stack diff --git a/tests/vle_specific_test.php b/tests/vle_specific_test.php index 2314b945387..21a81666ebc 100644 --- a/tests/vle_specific_test.php +++ b/tests/vle_specific_test.php @@ -26,6 +26,7 @@ /** * Test Moodle VLE specific functions. * + * @package qtype_stack * @copyright 2023 The University of Edinburgh. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ diff --git a/textdownload.php b/textdownload.php index bc4d0262b96..3199dd4d9d0 100644 --- a/textdownload.php +++ b/textdownload.php @@ -18,6 +18,7 @@ * This script serves text files generated on demand by rendering CASText * of a given question with a given seed. For generated data transfer needs. * + * @package qtype_stack * @copyright 2021 Aalto University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tidyquestion.php b/tidyquestion.php index c2b7ba60985..f824ad32f74 100644 --- a/tidyquestion.php +++ b/tidyquestion.php @@ -18,6 +18,7 @@ * This script lets rename parts of the question, which is not possible using * the standard editing form. * + * @package qtype_stack * @copyright 2013 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tidyquestionform.php b/tidyquestionform.php index ba9e920e253..772cb289ccb 100644 --- a/tidyquestionform.php +++ b/tidyquestionform.php @@ -17,6 +17,7 @@ /** * This file defines the editing form used by the tidy question script. * + * @package qtype_stack * @copyright 2013 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -31,6 +32,7 @@ /** * The editing form used by the tidy question script. * + * @package qtype_stack * @copyright 2013 the Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ From 76a6603ce61353cb49691944d2a18a4bd917c5bb Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Thu, 12 Dec 2024 13:38:02 +0000 Subject: [PATCH 04/23] code-tidy - Change comments to docblocks --- api/config_sample.txt | 7 +++++-- cli/ast_filter_tester.php | 15 +++++++++------ cli/ast_test_generator.php | 19 +++++++++++-------- cli/castextcompiler.php | 11 +++++++---- cli/maximaidentifierupdater.php | 13 ++++++++----- cli/maximalibcheck.php | 11 +++++++---- cli/maximasecuritymapupdater.php | 11 +++++++---- cli/unicode_data_process.php | 17 ++++++++++------- deploy.php | 11 +++++++---- stack/answertest/controller.class.php | 11 +++++++---- stack/cas/ast.container.class.php | 11 +++++++---- stack/cas/ast.container.conditional.class.php | 11 +++++++---- stack/cas/ast.container.silent.class.php | 11 +++++++---- stack/cas/cassecurity.class.php | 11 +++++++---- stack/cas/cassession2.class.php | 17 ++++++++++------- stack/cas/casstring.units.class.php | 11 +++++++---- stack/cas/secure_loader.class.php | 15 +++++++++------ stack/input/checkbox/checkbox.class.php | 13 ++++++++----- stack/input/factory.class.php | 13 ++++++++----- stack/input/radio/radio.class.php | 13 ++++++++----- stack/maximaparser/corrective_parser.php | 19 +++++++++++-------- stack/questiontest.php | 11 +++++++---- stack/questiontestresult.php | 11 +++++++---- tests/answertest_general_cas_test.php | 11 +++++++---- tests/answertest_general_fixtures_test.php | 13 ++++++++----- tests/api_controller_test.php | 11 +++++++---- tests/api_stackquestionloader_test.php | 11 +++++++---- tests/api_tests_stateful_test.php | 13 ++++++++----- tests/ast_container_test.php | 11 +++++++---- tests/docslib_test.php | 11 +++++++---- tests/editform_test.php | 11 +++++++---- tests/graphlayout_test.php | 11 +++++++---- tests/helper.php | 12 +++++++----- tests/input_algebraic_test.php | 11 +++++++---- tests/input_boolean_rendering_test.php | 11 +++++++---- tests/input_boolean_validation_test.php | 11 +++++++---- tests/input_checkbox_test.php | 11 +++++++---- tests/input_dropdown_exception_test.php | 11 +++++++---- tests/input_dropdown_test.php | 11 +++++++---- tests/input_matrix_test.php | 11 +++++++---- tests/input_notes_test.php | 11 +++++++---- tests/input_parsons_test.php | 11 +++++++---- tests/input_radio_test.php | 11 +++++++---- tests/input_singlechar_test.php | 11 +++++++---- tests/input_singlechar_validation_test.php | 11 +++++++---- tests/input_string_test.php | 11 +++++++---- tests/input_textarea_test.php | 11 +++++++---- tests/input_units_test.php | 11 +++++++---- tests/input_varmatrix_test.php | 11 +++++++---- tests/inputstate_test.php | 11 +++++++---- tests/mathsoutput_test.php | 13 ++++++++----- tests/mathsoutputmathjax_test.php | 11 +++++++---- tests/mathsoutputmaths_test.php | 11 +++++++---- tests/mathsoutputtex_test.php | 11 +++++++---- tests/maxima_corrective_parser_test.php | 11 +++++++---- tests/multilang_test.php | 11 +++++++---- tests/prt_test.php | 11 +++++++---- tests/qtype_stack_test_base_test.php | 11 +++++++---- tests/question_test.php | 11 +++++++---- tests/questiontype_test.php | 13 ++++++++----- tests/responseanalysis_test.php | 11 +++++++---- tests/stack_options_test.php | 11 +++++++---- tests/stack_utils_test.php | 11 +++++++---- tests/studentinput_test.php | 13 ++++++++----- tests/subscript_test.php | 13 ++++++++----- tests/walkthrough_adaptive_test.php | 11 +++++++---- tests/walkthrough_deferred_cbm_test.php | 17 ++++++++++------- tests/walkthrough_deferred_feedback_test.php | 17 ++++++++++------- tests/walkthrough_immediate_feedback_test.php | 17 ++++++++++------- tests/walkthrough_interactive_test.php | 11 +++++++---- tests/walkthrough_survey_test.php | 15 +++++++++------ 71 files changed, 534 insertions(+), 322 deletions(-) diff --git a/api/config_sample.txt b/api/config_sample.txt index 35ffcc9732d..f0f246c8b23 100644 --- a/api/config_sample.txt +++ b/api/config_sample.txt @@ -14,8 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// @copyright 2023 RWTH Aachen -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * @package qtype_stack + * @copyright 2023 RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * Simulating Moodle global configuration variables. diff --git a/cli/ast_filter_tester.php b/cli/ast_filter_tester.php index 69eb9425eaf..fccb397d395 100644 --- a/cli/ast_filter_tester.php +++ b/cli/ast_filter_tester.php @@ -16,12 +16,15 @@ define('CLI_SCRIPT', true); -// This script is for executing sensible combinations of all known -// AST filters on a given input. It aims to identify filters that -// affect the given input. -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script is for executing sensible combinations of all known + * AST filters on a given input. It aims to identify filters that + * affect the given input. + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); diff --git a/cli/ast_test_generator.php b/cli/ast_test_generator.php index 4a9ef4ca884..7482c1ccf6e 100644 --- a/cli/ast_test_generator.php +++ b/cli/ast_test_generator.php @@ -16,14 +16,17 @@ define('CLI_SCRIPT', true); -// This script generates unit-tests for AST-filters using a common -// list of example inputs. The generated tests exist only to document -// and freeze the behaviour of the filters. When running this -// script it overwrites the existing tests so do check if you agree -// with the diffs. -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script generates unit-tests for AST-filters using a common + * list of example inputs. The generated tests exist only to document + * and freeze the behaviour of the filters. When running this + * script it overwrites the existing tests so do check if you agree + * with the diffs. + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); diff --git a/cli/castextcompiler.php b/cli/castextcompiler.php index e6d52109aa3..5c4332bca50 100644 --- a/cli/castextcompiler.php +++ b/cli/castextcompiler.php @@ -16,10 +16,13 @@ define('CLI_SCRIPT', true); -// This script is for testing compilation of CASText2 -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script is for testing compilation of CASText2 + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); diff --git a/cli/maximaidentifierupdater.php b/cli/maximaidentifierupdater.php index d9f0f8a82a0..dae1c1f138d 100644 --- a/cli/maximaidentifierupdater.php +++ b/cli/maximaidentifierupdater.php @@ -18,11 +18,14 @@ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); -// This script updates stack/cas/base-identifier-map.json -// Used for keepping track of new options and functions in new Maxima versions, -// and as a base for creating security lists. -// @copyright 2018 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script updates stack/cas/base-identifier-map.json + * Used for keepping track of new options and functions in new Maxima versions, + * and as a base for creating security lists. + * @package qtype_stack + * @copyright 2018 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ list($options, $unrecognized) = cli_get_params(['help' => false, 'version' => '5.42.0', 'data' => '-'], ['h' => 'help']); if ($unrecognized) { diff --git a/cli/maximalibcheck.php b/cli/maximalibcheck.php index 11abc8616a1..06c11247f06 100644 --- a/cli/maximalibcheck.php +++ b/cli/maximalibcheck.php @@ -16,10 +16,13 @@ define('CLI_SCRIPT', true); -// This script parses STACKs Maxima libraries and tries to find variables that leak. -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script parses STACKs Maxima libraries and tries to find variables that leak. + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); diff --git a/cli/maximasecuritymapupdater.php b/cli/maximasecuritymapupdater.php index b5b5ae7ec12..61ce3c2fe3d 100644 --- a/cli/maximasecuritymapupdater.php +++ b/cli/maximasecuritymapupdater.php @@ -18,10 +18,13 @@ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); -// This script updates stack/cas/security-map.json to include new identifiers -// present in stack/cas/base-identifier-map.json. -// @copyright 2018 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script updates stack/cas/security-map.json to include new identifiers + * present in stack/cas/base-identifier-map.json. + * @package qtype_stack + * @copyright 2018 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ list($options, $unrecognized) = cli_get_params(['help' => false], ['h' => 'help']); diff --git a/cli/unicode_data_process.php b/cli/unicode_data_process.php index 0cee4dd741b..3c3c043c6ca 100644 --- a/cli/unicode_data_process.php +++ b/cli/unicode_data_process.php @@ -16,13 +16,16 @@ define('CLI_SCRIPT', true); -// This script fetches Unicode mappings from: -// https://github.com/numbas/unicode-math-normalization -// -// And preprocesses them for use in STACK logic. -// -// @copyright 2023 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script fetches Unicode mappings from: + * https://github.com/numbas/unicode-math-normalization + * + * And preprocesses them for use in STACK logic. + * + * @package qtype_stack + * @copyright 2023 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/clilib.php'); diff --git a/deploy.php b/deploy.php index 4849a9757be..37e54214696 100644 --- a/deploy.php +++ b/deploy.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . -// This script handles the various deploy/undeploy actions from questiontestrun.php. -// -// @copyright 2012 the Open University -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * This script handles the various deploy/undeploy actions from questiontestrun.php. + * + * @package qtype_stack + * @copyright 2012 the Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ define('NO_OUTPUT_BUFFERING', true); diff --git a/stack/answertest/controller.class.php b/stack/answertest/controller.class.php index 0be6d44c2fb..3d7ea46b69e 100644 --- a/stack/answertest/controller.class.php +++ b/stack/answertest/controller.class.php @@ -17,10 +17,13 @@ defined('MOODLE_INTERNAL') || die(); -// Answer test controller class. -// -// @copyright 2012 University of Birmingham -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Answer test controller class. + * + * @package qtype_stack + * @copyright 2012 University of Birmingham + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/anstest.class.php'); require_once(__DIR__ . '/at_general_cas.class.php'); diff --git a/stack/cas/ast.container.class.php b/stack/cas/ast.container.class.php index 781721f586b..6a58d72a099 100644 --- a/stack/cas/ast.container.class.php +++ b/stack/cas/ast.container.class.php @@ -16,10 +16,13 @@ defined('MOODLE_INTERNAL')|| die(); -// Ast container and related functions, which replace "cas strings". -// -// @copyright 2019 University of Aalto. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Ast container and related functions, which replace "cas strings". + * + * @package qtype_stack + * @copyright 2019 University of Aalto. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/parsingrules/parsingrule.factory.php'); require_once(__DIR__ . '/cassecurity.class.php'); diff --git a/stack/cas/ast.container.conditional.class.php b/stack/cas/ast.container.conditional.class.php index 446d251facf..f5c18c3a789 100644 --- a/stack/cas/ast.container.conditional.class.php +++ b/stack/cas/ast.container.conditional.class.php @@ -16,10 +16,13 @@ defined('MOODLE_INTERNAL')|| die(); -// Ast container and related functions, which replace "cas strings". -// -// @copyright 2019 University of Aalto. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Ast container and related functions, which replace "cas strings". + * + * @package qtype_stack + * @copyright 2019 University of Aalto. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/parsingrules/parsingrule.factory.php'); require_once(__DIR__ . '/cassecurity.class.php'); diff --git a/stack/cas/ast.container.silent.class.php b/stack/cas/ast.container.silent.class.php index a8079569d4b..45daa7c7fd7 100644 --- a/stack/cas/ast.container.silent.class.php +++ b/stack/cas/ast.container.silent.class.php @@ -16,10 +16,13 @@ defined('MOODLE_INTERNAL')|| die(); -// Ast container and related functions, which replace "cas strings". -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Ast container and related functions, which replace "cas strings". + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/parsingrules/parsingrule.factory.php'); diff --git a/stack/cas/cassecurity.class.php b/stack/cas/cassecurity.class.php index ece45b76d51..e4d4a42dcfa 100644 --- a/stack/cas/cassecurity.class.php +++ b/stack/cas/cassecurity.class.php @@ -18,10 +18,13 @@ require_once(__DIR__ . '/casstring.units.class.php'); -// CAS identifier related security data-lookups. -// -// @copyright 2018 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * CAS identifier related security data-lookups. + * + * @package qtype_stack + * @copyright 2018 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class stack_cas_security { // This holds a copy of the security-map.json so that it does not need to // be loaded too many times. diff --git a/stack/cas/cassession2.class.php b/stack/cas/cassession2.class.php index 5805b89684e..a351dd0a287 100644 --- a/stack/cas/cassession2.class.php +++ b/stack/cas/cassession2.class.php @@ -16,13 +16,16 @@ defined('MOODLE_INTERNAL') || die(); -// Note that is a complete rewrite of cassession, in this we generate -// no "caching" in the form of keyval representations as we do not -// necessarily return enough information from the CAS to do that, for -// that matter neither did the old one... -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Note that is a complete rewrite of cassession, in this we generate + * no "caching" in the form of keyval representations as we do not + * necessarily return enough information from the CAS to do that, for + * that matter neither did the old one... + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/connectorhelper.class.php'); require_once(__DIR__ . '/../options.class.php'); diff --git a/stack/cas/casstring.units.class.php b/stack/cas/casstring.units.class.php index 620a6cf16ce..a4172fc2dcb 100644 --- a/stack/cas/casstring.units.class.php +++ b/stack/cas/casstring.units.class.php @@ -16,10 +16,13 @@ defined('MOODLE_INTERNAL') || die(); -// Functions related to dealing with scientific units in STACK. -// -// @copyright 2015 University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Functions related to dealing with scientific units in STACK. + * + * @package qtype_stack + * @copyright 2015 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/../../locallib.php'); require_once(__DIR__ . '/../utils.class.php'); diff --git a/stack/cas/secure_loader.class.php b/stack/cas/secure_loader.class.php index 4e2c4274b09..d218b2e480f 100644 --- a/stack/cas/secure_loader.class.php +++ b/stack/cas/secure_loader.class.php @@ -16,12 +16,15 @@ defined('MOODLE_INTERNAL')|| die(); -// Way to load in whatever CAS code one wants without having to deal -// with validation, intended to be used with caching of large logic blocks -// like PRTs as pre validated strings. -// -// @copyright 2019 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Way to load in whatever CAS code one wants without having to deal + * with validation, intended to be used with caching of large logic blocks + * like PRTs as pre validated strings. + * + * @package qtype_stack + * @copyright 2019 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/evaluatable_object.interfaces.php'); diff --git a/stack/input/checkbox/checkbox.class.php b/stack/input/checkbox/checkbox.class.php index c38000cec85..27f4b336fc1 100644 --- a/stack/input/checkbox/checkbox.class.php +++ b/stack/input/checkbox/checkbox.class.php @@ -16,11 +16,14 @@ defined('MOODLE_INTERNAL') || die(); -// Input that is a checkbox/multiple choice. -// -// @copyright 2015 University of Edinburgh. -// @author Chris Sangwin. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Input that is a checkbox/multiple choice. + * + * @package qtype_stack + * @copyright 2015 University of Edinburgh. + * @author Chris Sangwin. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/../dropdown/dropdown.class.php'); diff --git a/stack/input/factory.class.php b/stack/input/factory.class.php index ce6bd534e66..b76aa7b400a 100644 --- a/stack/input/factory.class.php +++ b/stack/input/factory.class.php @@ -19,11 +19,14 @@ require_once(__DIR__ . '/../options.class.php'); require_once(__DIR__ . '/inputbase.class.php'); -// Input factory. Provides a convenient way to create an input of any type, -// and to get metadata about the input types. -// -// @copyright 2012 University of Birmingham. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Input factory. Provides a convenient way to create an input of any type, + * and to get metadata about the input types. + * + * @package qtype_stack + * @copyright 2012 University of Birmingham. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class stack_input_factory { /** diff --git a/stack/input/radio/radio.class.php b/stack/input/radio/radio.class.php index 942cdd83df7..215464fb6cb 100644 --- a/stack/input/radio/radio.class.php +++ b/stack/input/radio/radio.class.php @@ -16,11 +16,14 @@ defined('MOODLE_INTERNAL') || die(); -// Input that is a radio/multiple choice. -// -// @copyright 2015 University of Edinburgh. -// @author Chris Sangwin. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Input that is a radio/multiple choice. + * + * @package qtype_stack + * @copyright 2015 University of Edinburgh. + * @author Chris Sangwin. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/../dropdown/dropdown.class.php'); class stack_radio_input extends stack_dropdown_input { diff --git a/stack/maximaparser/corrective_parser.php b/stack/maximaparser/corrective_parser.php index 8865e46d484..754847106aa 100644 --- a/stack/maximaparser/corrective_parser.php +++ b/stack/maximaparser/corrective_parser.php @@ -23,14 +23,17 @@ require_once(__DIR__ . '/MP_classes.php'); -// A Maxima parser wrapper that tries to insert missing stars to statements -// to make them parseable. -// -// Once we have an ast we filter further to handle extended syntax and more -// complex star insertion. -// -// @copyright 2019 Aalto University -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * A Maxima parser wrapper that tries to insert missing stars to statements + * to make them parseable. + * + * Once we have an ast we filter further to handle extended syntax and more + * complex star insertion. + * + * @package qtype_stack + * @copyright 2019 Aalto University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class maxima_corrective_parser { // Returns an AST if possible. diff --git a/stack/questiontest.php b/stack/questiontest.php index fef1b7b1e45..adcac576589 100644 --- a/stack/questiontest.php +++ b/stack/questiontest.php @@ -16,10 +16,13 @@ defined('MOODLE_INTERNAL') || die(); -// Holds the data defining one question test. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Holds the data defining one question test. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/questiontestresult.php'); diff --git a/stack/questiontestresult.php b/stack/questiontestresult.php index 02acd891b5d..124c30f5b08 100644 --- a/stack/questiontestresult.php +++ b/stack/questiontestresult.php @@ -16,10 +16,13 @@ defined('MOODLE_INTERNAL') || die(); -// Holds the results of one {@link stack_question_test). -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Holds the results of one {@link stack_question_test). + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once('utils.class.php'); diff --git a/tests/answertest_general_cas_test.php b/tests/answertest_general_cas_test.php index 4d57d569de8..0fcfd61f646 100644 --- a/tests/answertest_general_cas_test.php +++ b/tests/answertest_general_cas_test.php @@ -25,10 +25,13 @@ defined('MOODLE_INTERNAL') || die(); -// Unit tests for stack_answertest_general_cas. -// -// @copyright 2012 The University of Birmingham. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_answertest_general_cas. + * + * @package qtype_stack + * @copyright 2012 The University of Birmingham. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../locallib.php'); diff --git a/tests/answertest_general_fixtures_test.php b/tests/answertest_general_fixtures_test.php index 8f59e788cb8..7d06053df9e 100644 --- a/tests/answertest_general_fixtures_test.php +++ b/tests/answertest_general_fixtures_test.php @@ -21,11 +21,14 @@ defined('MOODLE_INTERNAL') || die(); -// Add in all the tests from answertestsfixtures.class into the unit testing framework. -// These are exposed to users as documentation and google-ci should also run all the tests. -// -// @copyright 2016 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Add in all the tests from answertestsfixtures.class into the unit testing framework. + * These are exposed to users as documentation and google-ci should also run all the tests. + * + * @package qtype_stack + * @copyright 2016 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/../locallib.php'); require_once(__DIR__ . '/../stack/answertest/controller.class.php'); diff --git a/tests/api_controller_test.php b/tests/api_controller_test.php index dec29b47f5f..7d70d62c421 100644 --- a/tests/api_controller_test.php +++ b/tests/api_controller_test.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -// Unit tests for the Stack question type API. -// -// @copyright 2023 University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type API. + * + * @package qtype_stack + * @copyright 2023 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace qtype_stack; diff --git a/tests/api_stackquestionloader_test.php b/tests/api_stackquestionloader_test.php index 586291bbdea..1598e3f2e19 100644 --- a/tests/api_stackquestionloader_test.php +++ b/tests/api_stackquestionloader_test.php @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -// Unit tests for the Stack question type API. -// -// @copyright 2023 University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type API. + * + * @package qtype_stack + * @copyright 2023 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ namespace qtype_stack; diff --git a/tests/api_tests_stateful_test.php b/tests/api_tests_stateful_test.php index 324daa861d1..fbb5eba12df 100644 --- a/tests/api_tests_stateful_test.php +++ b/tests/api_tests_stateful_test.php @@ -18,11 +18,14 @@ defined('MOODLE_INTERNAL') || die(); -// Unit tests to check that the requirements of a related software -// are still present, and that the interface does not change unexpectedly. -// -// @copyright 2020 Aalto University -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests to check that the requirements of a related software + * are still present, and that the interface does not change unexpectedly. + * + * @package qtype_stack + * @copyright 2020 Aalto University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ // These are all the imports Stateful does, one test is to check that these exist. // Even the test_base is one of them. diff --git a/tests/ast_container_test.php b/tests/ast_container_test.php index 4982a094135..3cda5e0ab01 100644 --- a/tests/ast_container_test.php +++ b/tests/ast_container_test.php @@ -23,10 +23,13 @@ defined('MOODLE_INTERNAL') || die(); -// Unit tests for various AST container features. -// -// @copyright 2019 Aalto University -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for various AST container features. + * + * @package qtype_stack + * @copyright 2019 Aalto University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/fixtures/numbersfixtures.class.php'); require_once(__DIR__ . '/../stack/cas/ast.container.class.php'); diff --git a/tests/docslib_test.php b/tests/docslib_test.php index 907d0731008..65b4fb8dcad 100644 --- a/tests/docslib_test.php +++ b/tests/docslib_test.php @@ -20,10 +20,13 @@ defined('MOODLE_INTERNAL') || die(); -// Unit tests for the documentation library functions. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the documentation library functions. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/../doc/docslib.php'); require_once(__DIR__ . '/fixtures/test_base.php'); diff --git a/tests/editform_test.php b/tests/editform_test.php index 961d52a9228..83645c4005f 100644 --- a/tests/editform_test.php +++ b/tests/editform_test.php @@ -22,10 +22,13 @@ require_once($CFG->dirroot . '/question/engine/tests/helpers.php'); require_once(__DIR__ . '/../edit_stack_form.php'); -// Subclass of qtype_stack_edit_form_testable that is easier to use in unit tests. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Subclass of qtype_stack_edit_form_testable that is easier to use in unit tests. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/graphlayout_test.php b/tests/graphlayout_test.php index fb3706777f8..58480c0eaf9 100644 --- a/tests/graphlayout_test.php +++ b/tests/graphlayout_test.php @@ -23,10 +23,13 @@ require_once(__DIR__ . '/../stack/graphlayout/graph.php'); -// Unit tests for stack_abstract_graph and friends. -// -// @copyright 2013 The Open Unviersity. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_abstract_graph and friends. + * + * @package qtype_stack + * @copyright 2013 The Open Unviersity. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/helper.php b/tests/helper.php index bd035177b8e..30532620a7c 100644 --- a/tests/helper.php +++ b/tests/helper.php @@ -18,11 +18,13 @@ require_once(__DIR__ . '../../stack/potentialresponsetreestate.class.php'); -// Test helper code for the Stack question type. -// -// @package qtype_stack. -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Test helper code for the Stack question type. + * + * @package qtype_stack. + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_algebraic_test.php b/tests/input_algebraic_test.php index 500d78503b0..4c5ad016c3d 100644 --- a/tests/input_algebraic_test.php +++ b/tests/input_algebraic_test.php @@ -31,10 +31,13 @@ require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_algebra_input. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_algebra_input. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_boolean_rendering_test.php b/tests/input_boolean_rendering_test.php index c99d9e78df2..40c19af803d 100644 --- a/tests/input_boolean_rendering_test.php +++ b/tests/input_boolean_rendering_test.php @@ -29,10 +29,13 @@ require_once(__DIR__ . '/../stack/input/boolean/boolean.class.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for stack_boolean_input_test. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_boolean_input_test. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_boolean_validation_test.php b/tests/input_boolean_validation_test.php index 043180a2651..e75a3105888 100644 --- a/tests/input_boolean_validation_test.php +++ b/tests/input_boolean_validation_test.php @@ -29,10 +29,13 @@ require_once(__DIR__ . '/../stack/input/boolean/boolean.class.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for stack_boolean_input_test. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_boolean_input_test. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_checkbox_test.php b/tests/input_checkbox_test.php index 00f857a3784..595819d6965 100644 --- a/tests/input_checkbox_test.php +++ b/tests/input_checkbox_test.php @@ -30,10 +30,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_checkbox_input. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_checkbox_input. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_dropdown_exception_test.php b/tests/input_dropdown_exception_test.php index dc3c3c33dda..c13fa718584 100644 --- a/tests/input_dropdown_exception_test.php +++ b/tests/input_dropdown_exception_test.php @@ -29,10 +29,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_dropdown_input. -// -// @copyright 2015 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_dropdown_input. + * + * @package qtype_stack + * @copyright 2015 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_dropdown_test.php b/tests/input_dropdown_test.php index 835cebeb622..2023891feb8 100644 --- a/tests/input_dropdown_test.php +++ b/tests/input_dropdown_test.php @@ -30,10 +30,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_dropdown_input. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_dropdown_input. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_matrix_test.php b/tests/input_matrix_test.php index 06d80de48c3..5572b8cadbb 100644 --- a/tests/input_matrix_test.php +++ b/tests/input_matrix_test.php @@ -29,10 +29,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for the stack_matrix_input class. -// -// @copyright 2012 The University of Birmingham. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the stack_matrix_input class. + * + * @package qtype_stack + * @copyright 2012 The University of Birmingham. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_notes_test.php b/tests/input_notes_test.php index a462f19133c..0769c416d2f 100644 --- a/tests/input_notes_test.php +++ b/tests/input_notes_test.php @@ -29,10 +29,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for the stack_notes_input class. -// -// @copyright 2017 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the stack_notes_input class. + * + * @package qtype_stack + * @copyright 2017 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_parsons_test.php b/tests/input_parsons_test.php index 34b96e25537..8de5906a00d 100644 --- a/tests/input_parsons_test.php +++ b/tests/input_parsons_test.php @@ -32,10 +32,13 @@ require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_parsons_input. -// -// @copyright 2024 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_parsons_input. + * + * @package qtype_stack + * @copyright 2024 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_radio_test.php b/tests/input_radio_test.php index c6c78f7804b..2c21cb43246 100644 --- a/tests/input_radio_test.php +++ b/tests/input_radio_test.php @@ -30,10 +30,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_radio_input. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_radio_input. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_singlechar_test.php b/tests/input_singlechar_test.php index 8dcd4f9d7bb..a61585cd363 100644 --- a/tests/input_singlechar_test.php +++ b/tests/input_singlechar_test.php @@ -32,10 +32,13 @@ require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_singlechar_input. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_singlechar_input. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_singlechar_validation_test.php b/tests/input_singlechar_validation_test.php index bc4496c232b..7e10d23e22a 100644 --- a/tests/input_singlechar_validation_test.php +++ b/tests/input_singlechar_validation_test.php @@ -28,10 +28,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_boolean_input_test. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_boolean_input_test. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_string_test.php b/tests/input_string_test.php index a69c06ea925..62654269c92 100644 --- a/tests/input_string_test.php +++ b/tests/input_string_test.php @@ -32,10 +32,13 @@ require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_algebra_input. -// -// @copyright 2018 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_algebra_input. + * + * @package qtype_stack + * @copyright 2018 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_textarea_test.php b/tests/input_textarea_test.php index e42d4de5ad3..d2a098b737d 100644 --- a/tests/input_textarea_test.php +++ b/tests/input_textarea_test.php @@ -32,10 +32,13 @@ require_once(__DIR__ . '/../stack/input/textarea/textarea.class.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for stack_textarea_input. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_textarea_input. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_units_test.php b/tests/input_units_test.php index ff018e72f5e..43cb29194ab 100644 --- a/tests/input_units_test.php +++ b/tests/input_units_test.php @@ -30,10 +30,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for stack_units_input. -// -// @copyright 2016 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_units_input. + * + * @package qtype_stack + * @copyright 2016 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/input_varmatrix_test.php b/tests/input_varmatrix_test.php index cff0441f974..c1ccf22b733 100644 --- a/tests/input_varmatrix_test.php +++ b/tests/input_varmatrix_test.php @@ -28,10 +28,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/input/factory.class.php'); -// Unit tests for the stack_matrix_input class. -// -// @copyright 2012 The University of Birmingham. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the stack_matrix_input class. + * + * @package qtype_stack + * @copyright 2012 The University of Birmingham. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/inputstate_test.php b/tests/inputstate_test.php index 5f6c3504970..48709b9938b 100644 --- a/tests/inputstate_test.php +++ b/tests/inputstate_test.php @@ -25,10 +25,13 @@ require_once(__DIR__ . '/../stack/input/inputbase.class.php'); -// Unit tests for stack_input_state. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_input_state. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/mathsoutput_test.php b/tests/mathsoutput_test.php index b582f77e6b2..afda0248ecf 100644 --- a/tests/mathsoutput_test.php +++ b/tests/mathsoutput_test.php @@ -24,11 +24,14 @@ require_once(__DIR__ . '/../stack/utils.class.php'); require_once(__DIR__ . '/../stack/mathsoutput/mathsoutput.class.php'); -// Unit tests for the OU maths filter output classes replace-dollars -// functionality. -// -// @copyright 2017 Aalto University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the OU maths filter output classes replace-dollars + * functionality. + * + * @package qtype_stack + * @copyright 2017 Aalto University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/mathsoutputmathjax_test.php b/tests/mathsoutputmathjax_test.php index e82cf4b1788..e118ea6c503 100644 --- a/tests/mathsoutputmathjax_test.php +++ b/tests/mathsoutputmathjax_test.php @@ -26,10 +26,13 @@ require_once(__DIR__ . '/../stack/mathsoutput/mathsoutput.class.php'); require_once(__DIR__ . '/../doc/docslib.php'); -// Unit tests for the MathJax maths output class. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the MathJax maths output class. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/mathsoutputmaths_test.php b/tests/mathsoutputmaths_test.php index b360c9efb43..968d2985974 100644 --- a/tests/mathsoutputmaths_test.php +++ b/tests/mathsoutputmaths_test.php @@ -27,10 +27,13 @@ require_once(__DIR__ . '/../stack/mathsoutput/mathsoutputmaths.class.php'); require_once(__DIR__ . '/../doc/docslib.php'); -// Unit tests for the OU maths filter output class. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the OU maths filter output class. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/mathsoutputtex_test.php b/tests/mathsoutputtex_test.php index 3d74df0de44..d197985f64f 100644 --- a/tests/mathsoutputtex_test.php +++ b/tests/mathsoutputtex_test.php @@ -26,10 +26,13 @@ require_once(__DIR__ . '/../stack/mathsoutput/mathsoutput.class.php'); require_once(__DIR__ . '/../doc/docslib.php'); -// Unit tests for the Moodle TeX filter maths output class. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Moodle TeX filter maths output class. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/maxima_corrective_parser_test.php b/tests/maxima_corrective_parser_test.php index 6d6d4de6496..2e244be3966 100644 --- a/tests/maxima_corrective_parser_test.php +++ b/tests/maxima_corrective_parser_test.php @@ -21,10 +21,13 @@ defined('MOODLE_INTERNAL') || die(); -// Unit tests for verious AST filters. -// -// @copyright 2019 Aalto University -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for verious AST filters. + * + * @package qtype_stack + * @copyright 2019 Aalto University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ require_once(__DIR__ . '/../stack/maximaparser/utils.php'); require_once(__DIR__ . '/../stack/maximaparser/corrective_parser.php'); diff --git a/tests/multilang_test.php b/tests/multilang_test.php index 3da43f32e8c..4d6a35532c0 100644 --- a/tests/multilang_test.php +++ b/tests/multilang_test.php @@ -24,10 +24,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../lang/multilang.php'); -// Unit tests for stack_multilang. -// -// @copyright 2018 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_multilang. + * + * @package qtype_stack + * @copyright 2018 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/prt_test.php b/tests/prt_test.php index 3ccade9fb4b..46c6a34306e 100644 --- a/tests/prt_test.php +++ b/tests/prt_test.php @@ -35,10 +35,13 @@ require_once(__DIR__ . '/../locallib.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for stack_potentialresponse_tree_lite, including the prt_evaluatable. -// -// @copyright 2022 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_potentialresponse_tree_lite, including the prt_evaluatable. + * + * @package qtype_stack + * @copyright 2022 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/qtype_stack_test_base_test.php b/tests/qtype_stack_test_base_test.php index 97ebe80d488..f6dc578c6b5 100644 --- a/tests/qtype_stack_test_base_test.php +++ b/tests/qtype_stack_test_base_test.php @@ -22,10 +22,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for test_base. -// -// @copyright 2016 The Open Unviersity. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for test_base. + * + * @package qtype_stack + * @copyright 2016 The Open Unviersity. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/question_test.php b/tests/question_test.php index 44e3f6ce7a6..dc18b4ddf66 100644 --- a/tests/question_test.php +++ b/tests/question_test.php @@ -30,10 +30,13 @@ global $CFG; require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for (some of) question/type/stack/questiontype.php. -// -// @copyright 2008 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for (some of) question/type/stack/questiontype.php. + * + * @package qtype_stack + * @copyright 2008 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/questiontype_test.php b/tests/questiontype_test.php index 84aeca35ada..90383a1cf5b 100644 --- a/tests/questiontype_test.php +++ b/tests/questiontype_test.php @@ -37,11 +37,14 @@ require_once($CFG->dirroot . '/question/engine/tests/helpers.php'); require_once(__DIR__ . '/../questiontype.php'); -// Unit tests for the STACK question type class. -// -// @package qtype_stack. -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the STACK question type class. + * + * @package qtype_stack + * @package qtype_stack. + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/responseanalysis_test.php b/tests/responseanalysis_test.php index ee942771396..6c87da9e429 100644 --- a/tests/responseanalysis_test.php +++ b/tests/responseanalysis_test.php @@ -38,10 +38,13 @@ ' odd: ' . RESPONSETS . '; even: ' . RESPONSETS . '; oddeven: ' . RESPONSETS . '; unique: ' . RESPONSETS); define ('MULTRESPONSE1TNNN', 'Seed: 123456789; ans1: 11 [score]; ans2: vv [valid]; ans3: ii [invalid]; ans4: zz;' . ' odd: ' . RESPONSETS . '; even: !; oddeven: !; unique: !'); -// Unit tests for the response analysis report. -// -// @copyright 2023 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the response analysis report. + * + * @package qtype_stack + * @copyright 2023 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/stack_options_test.php b/tests/stack_options_test.php index 6d5aa9361a0..c5a252919c9 100644 --- a/tests/stack_options_test.php +++ b/tests/stack_options_test.php @@ -26,10 +26,13 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/../stack/options.class.php'); -// Unit tests for stack_options. -// -// @copyright 2012 The University of Birmingham. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_options. + * + * @package qtype_stack + * @copyright 2012 The University of Birmingham. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/stack_utils_test.php b/tests/stack_utils_test.php index ccdae0bb1d0..163b345d1f9 100644 --- a/tests/stack_utils_test.php +++ b/tests/stack_utils_test.php @@ -27,10 +27,13 @@ require_once(__DIR__ . '/../stack/utils.class.php'); require_once(__DIR__ . '/../stack/cas/cassession2.class.php'); -// Unit tests for stack_utils. -// -// @copyright 2012 The Open Unviersity. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for stack_utils. + * + * @package qtype_stack + * @copyright 2012 The Open Unviersity. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/studentinput_test.php b/tests/studentinput_test.php index 4590e4328ef..f24e9e9dc7c 100644 --- a/tests/studentinput_test.php +++ b/tests/studentinput_test.php @@ -27,11 +27,14 @@ require_once(__DIR__ . '/fixtures/test_base.php'); require_once(__DIR__ . '/fixtures/inputfixtures.class.php'); -// Add in all the tests from studentinputs.php into the unit testing framework. -// These are exposed to users as documentation and google-ci should also run all the tests. -// -// @copyright 2016 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Add in all the tests from studentinputs.php into the unit testing framework. + * These are exposed to users as documentation and google-ci should also run all the tests. + * + * @package qtype_stack + * @copyright 2016 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/subscript_test.php b/tests/subscript_test.php index 7a0752c3823..b20af923d6a 100644 --- a/tests/subscript_test.php +++ b/tests/subscript_test.php @@ -36,11 +36,14 @@ require_once(__DIR__ . '/../stack/cas/secure_loader.class.php'); require_once(__DIR__ . '/../stack/cas/ast.container.class.php'); -// Add in all the tests from subscriptsfixtures.php into the unit testing framework. -// These are exposed to users as documentation and google-ci should also run all the tests. -// -// @copyright 2016 The University of Edinburgh. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Add in all the tests from subscriptsfixtures.php into the unit testing framework. + * These are exposed to users as documentation and google-ci should also run all the tests. + * + * @package qtype_stack + * @copyright 2016 The University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/walkthrough_adaptive_test.php b/tests/walkthrough_adaptive_test.php index 60540cc75ef..741c3a04348 100644 --- a/tests/walkthrough_adaptive_test.php +++ b/tests/walkthrough_adaptive_test.php @@ -35,10 +35,13 @@ require_once($CFG->libdir . '/questionlib.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for the Stack question type. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/walkthrough_deferred_cbm_test.php b/tests/walkthrough_deferred_cbm_test.php index 8b3febe4160..e5bbf19924a 100644 --- a/tests/walkthrough_deferred_cbm_test.php +++ b/tests/walkthrough_deferred_cbm_test.php @@ -31,13 +31,16 @@ require_once($CFG->libdir . '/questionlib.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for the Stack question type. -// -// Note that none of these tests include clicking the 'Check' button that dfexplicitvaldiation provies. -// That button is simply @author tjh238 way to trigger a save without navigating to a different page of the quiz. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type. + * + * Note that none of these tests include clicking the 'Check' button that dfexplicitvaldiation provies. + * That button is simply @author tjh238 way to trigger a save without navigating to a different page of the quiz. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/walkthrough_deferred_feedback_test.php b/tests/walkthrough_deferred_feedback_test.php index 99d7fcda5aa..f9f5400e493 100644 --- a/tests/walkthrough_deferred_feedback_test.php +++ b/tests/walkthrough_deferred_feedback_test.php @@ -33,13 +33,16 @@ require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for the Stack question type with deferred feedback behaviour. -// -// Note that none of these tests include clicking the 'Check' button that dfexplicitvaldiation provies. -// That button is simply @author tjh238 way to trigger a save without navigating to a different page of the quiz. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type with deferred feedback behaviour. + * + * Note that none of these tests include clicking the 'Check' button that dfexplicitvaldiation provies. + * That button is simply @author tjh238 way to trigger a save without navigating to a different page of the quiz. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/walkthrough_immediate_feedback_test.php b/tests/walkthrough_immediate_feedback_test.php index ec81a9683d0..2b627f8edc2 100644 --- a/tests/walkthrough_immediate_feedback_test.php +++ b/tests/walkthrough_immediate_feedback_test.php @@ -28,13 +28,16 @@ require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for the Stack question type with the immediate feedback behaviour. -// -// Note that none of these tests include clicking the 'Check' button that dfexplicitvaldiation provies. -// That button is simply @author tjh238 way to trigger a save without navigating to a different page of the quiz. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type with the immediate feedback behaviour. + * + * Note that none of these tests include clicking the 'Check' button that dfexplicitvaldiation provies. + * That button is simply @author tjh238 way to trigger a save without navigating to a different page of the quiz. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/walkthrough_interactive_test.php b/tests/walkthrough_interactive_test.php index 47298992797..d0c97f4b10f 100644 --- a/tests/walkthrough_interactive_test.php +++ b/tests/walkthrough_interactive_test.php @@ -28,10 +28,13 @@ require_once($CFG->libdir . '/questionlib.php'); require_once(__DIR__ . '/fixtures/test_base.php'); -// Unit tests for the Stack question type with the interactive behaviour. -// -// @copyright 2012 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Unit tests for the Stack question type with the interactive behaviour. + * + * @package qtype_stack + * @copyright 2012 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack diff --git a/tests/walkthrough_survey_test.php b/tests/walkthrough_survey_test.php index 6f93dbab084..0a8472e7bad 100644 --- a/tests/walkthrough_survey_test.php +++ b/tests/walkthrough_survey_test.php @@ -27,12 +27,15 @@ require_once(__DIR__ . '/fixtures/test_base.php'); -// Tests that walk STACK questions that are special cases. -// Specifically a question with neither inputs nor PRTs, -// and a question with inputs but no PRTs. -// -// @copyright 2013 The Open University. -// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +/** + * Tests that walk STACK questions that are special cases. + * Specifically a question with neither inputs nor PRTs, + * and a question with inputs but no PRTs. + * + * @package qtype_stack + * @copyright 2013 The Open University. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ /** * @group qtype_stack From 782ce5352c1b466234edaa7fb2b09cc33d6c9c43 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Thu, 12 Dec 2024 16:07:00 +0000 Subject: [PATCH 05/23] code-tidy - FUnction docblocks --- adminui/todo.php | 2 +- edit_stack_form.php | 5 + locallib.php | 1 + question.php | 25 ++++ questiontestform.php | 4 + questiontestrun.php | 1 + questiontype.php | 12 ++ renderer.php | 7 + stack/answertest/at_general_cas.class.php | 1 + stack/cas/ast.container.class.php | 15 ++ stack/cas/ast.container.conditional.class.php | 20 +++ stack/cas/ast.container.silent.class.php | 17 +++ stack/cas/caserror.class.php | 3 + stack/cas/cassecurity.class.php | 10 ++ stack/cas/cassession2.class.php | 12 +- stack/cas/castext2/block.interface.php | 1 + stack/cas/castext2/blocks/body.block.php | 4 + stack/cas/castext2/blocks/castext.block.php | 4 + stack/cas/castext2/blocks/comment.block.php | 3 + .../castext2/blocks/commonstring.block.php | 5 + stack/cas/castext2/blocks/cors.block.php | 4 + stack/cas/castext2/blocks/debug.block.php | 3 + stack/cas/castext2/blocks/define.block.php | 3 + .../cas/castext2/blocks/demarkdown.block.php | 4 + stack/cas/castext2/blocks/demoodle.block.php | 4 + stack/cas/castext2/blocks/escape.block.php | 5 + stack/cas/castext2/blocks/foreach.block.php | 3 + stack/cas/castext2/blocks/geogebra.block.php | 5 + stack/cas/castext2/blocks/hint.block.php | 4 + .../cas/castext2/blocks/htmlformat.block.php | 4 + stack/cas/castext2/blocks/if.block.php | 4 + stack/cas/castext2/blocks/iframe.block.php | 5 + stack/cas/castext2/blocks/include.block.php | 4 + .../castext2/blocks/ioblock.specialblock.php | 4 + .../cas/castext2/blocks/javascript.block.php | 5 + stack/cas/castext2/blocks/jsstring.block.php | 4 + stack/cas/castext2/blocks/jsxgraph.block.php | 5 + stack/cas/castext2/blocks/lang.block.php | 4 + stack/cas/castext2/blocks/latex.block.php | 2 + stack/cas/castext2/blocks/parsons.block.php | 5 + .../cas/castext2/blocks/pfs.specialblock.php | 5 + .../blocks/placeholder.specialblock.php | 4 + stack/cas/castext2/blocks/quid.block.php | 5 + stack/cas/castext2/blocks/raw.block.php | 4 + .../cas/castext2/blocks/raw.specialblock.php | 4 + stack/cas/castext2/blocks/reveal.block.php | 4 + .../cas/castext2/blocks/root.specialblock.php | 2 + stack/cas/castext2/blocks/script.block.php | 4 + .../cas/castext2/blocks/smlt.specialblock.php | 5 + .../blocks/stack_translate.specialblock.php | 2 + stack/cas/castext2/blocks/style.block.php | 4 + stack/cas/castext2/blocks/template.block.php | 4 + .../castext2/blocks/textdownload.block.php | 5 + stack/cas/castext2/blocks/todo.block.php | 4 + stack/cas/castext2/blocks/unknown.block.php | 3 + .../castext2/castext2_evaluatable.class.php | 8 ++ .../castext2_placeholder_holder.class.php | 1 + .../castext2_static_replacer.class.php | 3 + stack/cas/connector.class.php | 2 + stack/cas/connector.dbcache.class.php | 4 + stack/cas/connector.healthcheck.class.php | 1 + stack/cas/connector.linux.class.php | 2 + stack/cas/connector.server.class.php | 2 + stack/cas/connector.server_proxy.class.php | 2 + stack/cas/connector.windows.class.php | 2 + stack/cas/installhelper.class.php | 3 + stack/cas/keyval.class.php | 6 + ...fix_call_of_a_group_or_function.filter.php | 1 + .../parsingrules/003_no_dot_dot.filter.php | 1 + .../005_i_is_never_a_function.filter.php | 1 + .../022_trig_replace_synonyms.filter.php | 1 + .../parsingrules/025_no_trig_power.filter.php | 1 + .../parsingrules/030_no_trig_space.filter.php | 1 + .../031_no_trig_brackets.filter.php | 1 + .../033_no_extra_evaluation.filter.php | 1 + .../050_no_chained_inequalities.filter.php | 1 + ...90_special_forbidden_characters.filter.php | 1 + .../cas/parsingrules/101_no_floats.filter.php | 1 + stack/cas/parsingrules/120_no_arc.filter.php | 1 + .../150_replace_unicode_letters.filter.php | 1 + .../180_char_based_superscripts.filter.php | 1 + .../201_sig_figs_validation.filter.php | 2 + .../202_decimal_places_validation.filter.php | 2 + .../210_x_used_as_multiplication.filter.php | 1 + ...refix_from_common_function_name.filter.php | 1 + ...split_at_number_letter_boundary.filter.php | 1 + ...t_number_letter_number_boundary.filter.php | 1 + ...06_split_implied_variable_names.filter.php | 1 + .../410_single_char_vars.filter.php | 1 + .../420_consolidate_subscripts.filter.php | 1 + .../441_split_unknown_functions.filter.php | 1 + .../442_split_all_functions.filter.php | 1 + .../parsingrules/450_split_floats.filter.php | 1 + .../parsingrules/502_replace_pm.filter.php | 1 + .../504_insert_tuples_for_groups.php | 1 + .../541_no_unknown_functions.filter.php | 1 + .../542_no_functions_at_all.filter.php | 1 + stack/cas/parsingrules/601_castext.filter.php | 2 + .../602_castext_simplifier.filter.php | 1 + ...castext_static_string_extractor.filter.php | 2 + .../parsingrules/680_gcl_sconcat.filter.php | 1 + .../801_singleton_numeric.filter.php | 3 + .../802_singleton_units.filter.php | 2 + .../901_remove_comments.filter.php | 1 + .../910_inert_float_for_display.filter.php | 1 + .../990_no_fixing_spaces.filter.php | 2 + .../991_no_fixing_stars.filter.php | 2 + .../995_ev_modification.filter.php | 2 + .../996_call_modification.filter.php | 1 + .../997_string_security.filter.php | 1 + .../cas/parsingrules/998_security.filter.php | 2 + stack/cas/parsingrules/999_strict.filter.php | 2 + stack/cas/parsingrules/pipeline.class.php | 2 + stack/cas/secure_loader.class.php | 10 ++ stack/graphlayout/graph.php | 3 + stack/graphlayout/graphnode.php | 1 + stack/input/algebraic/algebraic.class.php | 3 + stack/input/boolean/boolean.class.php | 4 + stack/input/checkbox/checkbox.class.php | 4 + stack/input/dropdown/dropdown.class.php | 8 ++ stack/input/equiv/equiv.class.php | 7 + stack/input/geogebra/geogebra.class.php | 3 + stack/input/inputbase.class.php | 1 + stack/input/inputstate.class.php | 1 + stack/input/matrix/matrix.class.php | 7 + stack/input/notes/notes.class.php | 7 + stack/input/numerical/numerical.class.php | 3 + stack/input/parsons/parsons.class.php | 1 + stack/input/radio/radio.class.php | 2 + stack/input/singlechar/singlechar.class.php | 4 + stack/input/string/string.class.php | 4 + stack/input/textarea/textarea.class.php | 6 + stack/input/units/units.class.php | 3 + stack/input/varmatrix/varmatrix.class.php | 8 ++ stack/mathsoutput/mathsoutputapi.class.php | 3 + .../mathsoutputfilterbase.class.php | 3 + .../mathsoutput/mathsoutputmathjax.class.php | 2 + stack/mathsoutput/mathsoutputmaths.class.php | 2 + .../mathsoutput/mathsoutputoumaths.class.php | 2 + stack/mathsoutput/mathsoutputtex.class.php | 2 + stack/maximaparser/MP_classes.php | 130 ++++++++++++++++++ stack/options.class.php | 5 + stack/potentialresponsetreestate.class.php | 2 + stack/prt.class.php | 3 + stack/prt.evaluatable.class.php | 20 +++ stack/questiontestresult.php | 2 + tests/editform_test.php | 1 + tests/fixtures/test_base.php | 17 +++ .../generator/behat_qtype_stack_generator.php | 1 + tests/input_boolean_rendering_test.php | 1 + tests/input_checkbox_test.php | 4 + tests/input_dropdown_exception_test.php | 2 + tests/input_dropdown_test.php | 3 + tests/input_radio_test.php | 3 + tidyquestionform.php | 1 + 155 files changed, 684 insertions(+), 2 deletions(-) diff --git a/adminui/todo.php b/adminui/todo.php index ba1218de855..20d0c1d28a2 100644 --- a/adminui/todo.php +++ b/adminui/todo.php @@ -82,7 +82,7 @@ $dashurl = html_writer::link(new moodle_url($questiontestsurl, ['questionid' => $qid]), $qname). ' ' . $OUTPUT->action_icon($preurl, new pix_icon('t/preview', get_string('preview'))); - // TODO: add in a direct edit URL. + // TO-DO: add in a direct edit URL. $qtodos[] = ['qid' => $qid, 'qname' => $qname, 'tags' => $tags, diff --git a/edit_stack_form.php b/edit_stack_form.php index d7163fd8981..7df97404de5 100644 --- a/edit_stack_form.php +++ b/edit_stack_form.php @@ -150,6 +150,7 @@ protected function get_current_specific_feedback() { return $this->specificfeedback; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function definition() { parent::definition(); $mform = $this->_form; @@ -167,6 +168,7 @@ protected function definition() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function definition_inner(/* MoodleQuickForm */ $mform) { global $OUTPUT; @@ -729,6 +731,7 @@ protected function definition_prt_node($prtname, $name, $nextnodechoices, $delet } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function data_preprocessing($question) { $question = parent::data_preprocessing($question); $question = $this->data_preprocessing_options($question); @@ -922,6 +925,7 @@ protected function prepare_text_field($field, $text, $format, $itemid, $filearea return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validation($fromform, $files) { $errors = parent::validation($fromform, $files); @@ -929,6 +933,7 @@ public function validation($fromform, $files) { return $qtype->validate_fromform($fromform, $errors); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function qtype() { return 'stack'; } diff --git a/locallib.php b/locallib.php index a39e74685c4..cd364b37924 100644 --- a/locallib.php +++ b/locallib.php @@ -246,6 +246,7 @@ function qtype_stack_setup_question_test_page($question) { */ class stack_outofcontext_process { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct() { } diff --git a/question.php b/question.php index ecfff26882b..63f498aaf96 100644 --- a/question.php +++ b/question.php @@ -291,6 +291,7 @@ protected function any_inputs_require_validation() { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function make_behaviour(question_attempt $qa, $preferredbehaviour) { if (empty($this->inputs)) { return question_engine::make_behaviour('informationitem', $qa, $preferredbehaviour); @@ -323,6 +324,7 @@ public function make_behaviour(question_attempt $qa, $preferredbehaviour) { return parent::make_behaviour($qa, $preferredbehaviour); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function start_attempt(question_attempt_step $step, $variant) { // @codingStandardsIgnoreStart // Work out the right seed to use. @@ -536,6 +538,7 @@ public function initialise_question_from_seed() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function apply_attempt_state(question_attempt_step $step) { $this->seed = (int) $step->get_qt_var('_seed'); $this->initialise_question_from_seed(); @@ -718,6 +721,7 @@ public function format_correct_response($qa) { return stack_ouput_castext($feedback); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_expected_data() { $expected = ['step_lang' => 'raw']; foreach ($this->inputs as $input) { @@ -726,6 +730,7 @@ public function get_expected_data() { return $expected; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_question_summary() { $processor = new castext2_qa_processor(new stack_outofcontext_process()); if ($this->questionnoteinstantiated !== null && @@ -735,6 +740,7 @@ public function get_question_summary() { return stack_string('questionnote_missing'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_question_todos() { $hastodos = false; $tags = []; @@ -755,6 +761,7 @@ public function get_question_todos() { return [$hastodos, $tags]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function summarise_response(array $response) { // Provide seed information on student's version via the normal moodle quiz report. $bits = ['Seed: ' . $this->seed]; @@ -799,6 +806,7 @@ public function summarise_response_data(array $response) { return $bits; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_correct_response() { $teacheranswer = []; if ($this->runtimeerrors || $this->get_cached('units') === null) { @@ -826,6 +834,7 @@ public function get_correct_response_testcase() { return $teacheranswer; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_same_response(array $prevresponse, array $newresponse) { foreach ($this->get_expected_data() as $name => $notused) { if (!question_utils::arrays_same_at_key_missing_is_blank( @@ -836,6 +845,7 @@ public function is_same_response(array $prevresponse, array $newresponse) { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_same_response_for_part($index, array $prevresponse, array $newresponse) { $previnput = $this->get_prt_input($index, $prevresponse, true); $newinput = $this->get_prt_input($index, $newresponse, true); @@ -897,6 +907,7 @@ public function is_any_input_blank(array $response) { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_any_part_invalid(array $response) { // Invalid if any input is invalid, ... foreach ($this->inputs as $name => $input) { @@ -916,6 +927,7 @@ public function is_any_part_invalid(array $response) { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_complete_response(array $response) { // If all PRTs are gradable, then the question is complete. Optional inputs may be blank. @@ -938,6 +950,7 @@ public function is_complete_response(array $response) { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_gradable_response(array $response) { // Manually graded answers are always gradable. if (!empty($this->inputs)) { @@ -969,6 +982,7 @@ public function is_gradable_response(array $response) { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_validation_error(array $response) { if ($this->is_any_part_invalid($response)) { // There will already be a more specific validation error displayed. @@ -982,6 +996,7 @@ public function get_validation_error(array $response) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function grade_response(array $response) { $fraction = 0; @@ -1002,6 +1017,7 @@ public function grade_response(array $response) { return [$fraction, question_state::graded_state_for_fraction($fraction)]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function is_same_prt_input($index, $prtinput1, $prtinput2) { foreach ($this->get_cached('required')[$this->prts[$index]->get_name()] as $name => $ignore) { if (!question_utils::arrays_same_at_key_missing_is_blank($prtinput1, $prtinput2, $name)) { @@ -1011,6 +1027,7 @@ protected function is_same_prt_input($index, $prtinput1, $prtinput2) { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_parts_and_weights() { $weights = []; foreach ($this->prts as $index => $prt) { @@ -1021,6 +1038,7 @@ public function get_parts_and_weights() { return $weights; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function grade_parts_that_can_be_graded(array $response, array $lastgradedresponses, $finalsubmit) { $partresults = []; @@ -1061,6 +1079,7 @@ public function grade_parts_that_can_be_graded(array $response, array $lastgrade return $partresults; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compute_final_grade($responses, $totaltries) { // This method is used by the interactive behaviour to compute the final // grade after all the tries are done. @@ -1365,6 +1384,7 @@ public static function random_variants_check($text) { || preg_match('~\bstack_seed~', $text); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_num_variants() { if (!$this->has_random_variants()) { // This question does not use randomisation. Only declare one variant. @@ -1380,6 +1400,7 @@ public function get_num_variants() { return 1000000; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_variants_selection_seed() { if (!empty($this->variantsselectionseed)) { return $this->variantsselectionseed; @@ -1388,6 +1409,7 @@ public function get_variants_selection_seed() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) { if ($component == 'qtype_stack' && $filearea == 'specificfeedback') { // Specific feedback files only visibile when the feedback is. @@ -1411,10 +1433,12 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $ } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_context() { return context::instance_by_id($this->contextid); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function has_question_capability($type) { global $USER; $context = $this->get_context(); @@ -1484,6 +1508,7 @@ public function get_ta_render_for_input(string $vname): string { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function classify_response(array $response) { $classification = []; diff --git a/questiontestform.php b/questiontestform.php index 2e751a8f999..dcefb53f11f 100644 --- a/questiontestform.php +++ b/questiontestform.php @@ -83,6 +83,7 @@ protected function definition() { $this->add_action_buttons(true, $this->_customdata['submitlabel']); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function definition_after_data() { if ($this->_form->exportValue('complete')) { $this->complete_passing_testcase(); @@ -92,6 +93,7 @@ public function definition_after_data() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function complete_passing_testcase() { $mform = $this->_form; @@ -121,6 +123,7 @@ protected function complete_passing_testcase() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function complete_teacher_testcase() { $mform = $this->_form; @@ -133,6 +136,7 @@ protected function complete_teacher_testcase() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validation($data, $files) { $errors = parent::validation($data, $files); diff --git a/questiontestrun.php b/questiontestrun.php index 3d1ffed772e..d7dc2efec66 100644 --- a/questiontestrun.php +++ b/questiontestrun.php @@ -334,6 +334,7 @@ } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function function sort_by_note($a1, $b1) { $a = $a1['1']; $b = $b1['1']; diff --git a/questiontype.php b/questiontype.php index 500337ebff6..31482d651db 100644 --- a/questiontype.php +++ b/questiontype.php @@ -66,6 +66,7 @@ class qtype_stack extends question_type { */ protected $prtgraph = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function save_question($question, $fromform) { if (!empty($fromform->fixdollars)) { @@ -119,6 +120,7 @@ protected function fix_dollars_in_form_data($fromform) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function save_question_options($fromform) { global $DB; $context = $fromform->context; @@ -405,6 +407,7 @@ public function save_question_options($fromform) { 'questionid = :questionid AND prtname ' . $nametest, $params); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_question_options($question) { global $DB; @@ -439,6 +442,7 @@ public function get_question_options($question) { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function get_question_deployed_seeds($qid) { global $DB; @@ -449,6 +453,7 @@ protected function get_question_deployed_seeds($qid) { ORDER BY id', [$qid]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function initialise_question_instance(question_definition $question, $questiondata) { parent::initialise_question_instance($question, $questiondata); @@ -614,6 +619,7 @@ public function get_tidy_question_url($question) { return new moodle_url('/question/type/stack/tidyquestion.php', $linkparams); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_extra_question_bank_actions(stdClass $question): array { $actions = parent::get_extra_question_bank_actions($question); @@ -638,6 +644,7 @@ public function get_extra_question_bank_actions(stdClass $question): array { return $actions; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function delete_question($questionid, $contextid) { global $DB; $this->delete_question_tests($questionid); @@ -649,6 +656,7 @@ public function delete_question($questionid, $contextid) { parent::delete_question($questionid, $contextid); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function move_files($questionid, $oldcontextid, $newcontextid) { global $DB; $fs = get_file_storage(); @@ -678,6 +686,7 @@ public function move_files($questionid, $oldcontextid, $newcontextid) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function delete_files($questionid, $contextid) { global $DB; $fs = get_file_storage(); @@ -1164,6 +1173,7 @@ public function delete_question_test($questionid, $testcase) { $transaction->allow_commit(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_possible_responses($questiondata) { $parts = []; @@ -1210,6 +1220,7 @@ protected function export_xml_text(qformat_xml $format, $tag, $text, $textformat return $output; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function export_to_xml($questiondata, qformat_xml $format, $notused = null) { $contextid = $questiondata->contextid; @@ -1347,6 +1358,7 @@ public function export_to_xml($questiondata, qformat_xml $format, $notused = nul return $output; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function import_from_xml($xml, $fromform, qformat_xml $format, $notused = null) { if (!isset($xml['@']['type']) || $xml['@']['type'] != $this->name()) { return false; diff --git a/renderer.php b/renderer.php index ab1d6b9dc62..3ed3bdcdfe3 100644 --- a/renderer.php +++ b/renderer.php @@ -38,6 +38,7 @@ class qtype_stack_renderer extends qtype_renderer { // @codingStandardsIgnoreEnd + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function formulation_and_controls(question_attempt $qa, question_display_options $options) { /* Return type should be @var qtype_stack_question $question. */ $question = $qa->get_question(); @@ -198,6 +199,7 @@ protected function question_tests_link(qtype_stack_question $question, question_ return html_writer::tag('div', implode(' | ', $links), ['class' => 'questiontestslink']); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function feedback(question_attempt $qa, question_display_options $options) { $output = ''; if ($options->feedback) { @@ -215,6 +217,7 @@ public function feedback(question_attempt $qa, question_display_options $options return $output; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function stack_specific_feedback_errors_only(question_attempt $qa) { $question = $qa->get_question(); $response = $qa->get_last_qt_data(); @@ -505,6 +508,7 @@ protected function overall_standard_prt_feedback(question_attempt $qa, return $this->standard_prt_feedback($qa, $qa->get_question(), $result, 1); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function hint(question_attempt $qa, question_hint $hint) { if (empty($hint->hint)) { return ''; @@ -526,11 +530,13 @@ protected function hint(question_attempt $qa, question_hint $hint) { $question->format_hint($newhint, $qa), ['class' => 'hint']); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function correct_response(question_attempt $qa) { $question = $qa->get_question(); return '
'.$question->format_correct_response($qa); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function general_feedback(question_attempt $qa) { $question = $qa->get_question(); if (empty($question->generalfeedback)) { @@ -550,6 +556,7 @@ public function general_feedback(question_attempt $qa) { return $question->get_generalfeedback_castext()->apply_placeholder_holder($gf); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function question_description(question_attempt $qa) { $question = $qa->get_question(); if (empty($question->questiondescription)) { diff --git a/stack/answertest/at_general_cas.class.php b/stack/answertest/at_general_cas.class.php index 80f6d424683..5d2d97c9b76 100644 --- a/stack/answertest/at_general_cas.class.php +++ b/stack/answertest/at_general_cas.class.php @@ -243,6 +243,7 @@ private function unpack_result(MP_Node $result): array { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_debuginfo() { return $this->debuginfo; } diff --git a/stack/cas/ast.container.class.php b/stack/cas/ast.container.class.php index 6a58d72a099..2fb735f8f50 100644 --- a/stack/cas/ast.container.class.php +++ b/stack/cas/ast.container.class.php @@ -72,9 +72,11 @@ class stack_ast_container extends stack_ast_container_silent implements cas_late */ private $displayvalue; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function __construct() { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_errors($err) { if ('' !== trim($err)) { // Force validation first so that all the errors are in the same form. @@ -83,6 +85,7 @@ public function add_errors($err) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { // The common_ast_container provides means of dealing with validation context. if ($this->validationcontext === null) { @@ -131,10 +134,12 @@ public function get_evaluationform(): string { return $this->validationcontext['vname'] . ':' . $vcmd; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_evaluated_value(MP_Node $ast) { $this->evaluated = $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_display_value(string $displayvalue) { // Maxima displays floats as sting with these tags. // The last of the old mess left? @@ -144,18 +149,22 @@ public function set_cas_display_value(string $displayvalue) { $this->displayvalue = $displayvalue; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_latex_value(string $latex) { $this->latex = stack_maxima_latex_tidy($latex); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluated(): MP_Node { return $this->evaluated; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_latex(): string { return $this->latex; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_correctly_evaluated(): bool { /* * In cases where a statement occurs many times, only the last values will be stored. @@ -186,10 +195,12 @@ public function set_cas_validation_context($vname, $lowestterms, $tans, $validat ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_cas_validation_context() { return $this->validationcontext; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_value() { if (null === $this->evaluated) { throw new stack_exception('stack_ast_container: tried to get the value from of an unevaluated casstring.'); @@ -230,6 +241,7 @@ public function get_dispvalue() { return $computedinput; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_display() { if (!$this->is_correctly_evaluated()) { throw new stack_exception('stack_ast_container: ' . @@ -248,6 +260,7 @@ public function get_ast_test() { return $this->ast->toString(['flattree' => true]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_ast_clone() { if ($this->is_correctly_evaluated()) { $ast = clone $this->evaluated; @@ -279,10 +292,12 @@ public function get_commentles_primary_statement() { return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_answernote($val) { $this->answernotes[] = $val; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_answernote($raw = 'implode') { if (null === $this->valid) { $this->get_valid(); diff --git a/stack/cas/ast.container.conditional.class.php b/stack/cas/ast.container.conditional.class.php index f5c18c3a789..fdb8bf081e1 100644 --- a/stack/cas/ast.container.conditional.class.php +++ b/stack/cas/ast.container.conditional.class.php @@ -39,10 +39,12 @@ class stack_ast_container_conditional extends stack_ast_container { private $conditions; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_conditions(array $conditions) { $this->conditions = $conditions; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { $valid = parent::get_valid(); foreach ($this->conditions as $cond) { @@ -51,6 +53,7 @@ public function get_valid(): bool { return $valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { if ($this->conditions === null || count($this->conditions) === 0) { return parent::get_evaluationform(); @@ -88,14 +91,17 @@ class stack_ast_container_conditional_value extends stack_ast_container_silent i private $conditions; private $evaluated; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_evaluated_value(MP_Node $ast) { $this->evaluated = $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_conditions(array $conditions) { $this->conditions = $conditions; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { $valid = parent::get_valid(); foreach ($this->conditions as $cond) { @@ -104,6 +110,7 @@ public function get_valid(): bool { return $valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { if ($this->conditions === null || count($this->conditions) === 0) { return parent::get_evaluationform(); @@ -135,10 +142,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluated(): MP_Node { return $this->evaluated; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_value() { if (null === $this->evaluated) { throw new stack_exception('stack_ast_container: tried to get the value from of an unevaluated casstring.'); @@ -154,14 +163,17 @@ class stack_ast_container_conditional_latex_and_value extends stack_ast_containe private $evaluated; private $latex; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_evaluated_value(MP_Node $ast) { $this->evaluated = $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_conditions(array $conditions) { $this->conditions = $conditions; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { $valid = parent::get_valid(); foreach ($this->conditions as $cond) { @@ -170,6 +182,7 @@ public function get_valid(): bool { return $valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { if ($this->conditions === null || count($this->conditions) === 0) { return parent::get_evaluationform(); @@ -201,10 +214,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluated(): MP_Node { return $this->evaluated; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_value() { if (null === $this->evaluated) { throw new stack_exception('stack_ast_container: tried to get the value from of an unevaluated casstring.'); @@ -212,10 +227,12 @@ public function get_value() { return $this->ast_to_string($this->evaluated, ['checkinggroup' => true]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_latex_value(string $latex) { $this->latex = stack_maxima_latex_tidy($latex); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_display() { if (!$this->is_correctly_evaluated()) { throw new stack_exception('stack_ast_container: ' . @@ -230,10 +247,12 @@ class stack_ast_container_conditional_silent extends stack_ast_container_silent private $conditions; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_conditions(array $conditions) { $this->conditions = $conditions; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { $valid = parent::get_valid(); foreach ($this->conditions as $cond) { @@ -242,6 +261,7 @@ public function get_valid(): bool { return $valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { if ($this->conditions === null || count($this->conditions) === 0) { return parent::get_evaluationform(); diff --git a/stack/cas/ast.container.silent.class.php b/stack/cas/ast.container.silent.class.php index 45daa7c7fd7..f34f638ec24 100644 --- a/stack/cas/ast.container.silent.class.php +++ b/stack/cas/ast.container.silent.class.php @@ -264,9 +264,11 @@ public static function make_from_teacher_ast(MP_Statement $ast, string $context, return $astc; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function __construct() { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_keyless(bool $key=true) { $this->keyless = $key; } @@ -432,6 +434,7 @@ public function get_debug_print() { return $ast->debugPrint($ast->toString(['nosemicolon' => true])); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_status(array $errors, array $answernotes, array $feedback) { // Here we have a slightly difficult situation, as the new // session collects real errors through different means than @@ -476,26 +479,32 @@ public function set_cas_status(array $errors, array $answernotes, array $feedbac } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_evaluated(): bool { return $this->isevaluated; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_correctly_evaluated(): bool { return $this->isevaluated && $this->valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_securitymodel(): stack_cas_security { return $this->securitymodel; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_securitymodel(stack_cas_security $sec) { $this->securitymodel = $sec; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_source_context(): string { return $this->context; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_key(): string { if ($this->keyless === true) { return ''; @@ -550,6 +559,7 @@ public function get_errors($raw = 'implode') { return $errors; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_answernote($raw = 'implode') { if (null === $this->valid) { $this->get_valid(); @@ -560,6 +570,7 @@ public function get_answernote($raw = 'implode') { return $this->answernotes; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_variable_usage(array $updatearray = []): array { if (!array_key_exists('read', $updatearray)) { $updatearray['read'] = []; @@ -578,6 +589,7 @@ public function get_variable_usage(array $updatearray = []): array { return $updatearray; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_feedback($raw = 'implode') { if (null === $this->valid) { $this->get_valid(); @@ -673,6 +685,7 @@ public function is_int(bool $evaluated=false): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_float(bool $evaluated=false): bool { $root = $this->ast; if ($evaluated) { @@ -735,6 +748,7 @@ public function is_list(bool $evaluated=false): int { return -1; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_string(bool $evaluated=false): bool { $root = $this->ast; if ($evaluated) { @@ -763,6 +777,7 @@ public function is_string(bool $evaluated=false): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_set(bool $evaluated=false): bool { $root = $this->ast; if ($evaluated) { @@ -791,6 +806,7 @@ public function is_set(bool $evaluated=false): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_toplevel_property($prop): bool { $root = $this->ast; if ($root instanceof MP_Root) { @@ -825,6 +841,7 @@ public function is_toplevel_property($prop): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_matrix(bool $evaluated=false): bool { $root = $this->ast; if ($evaluated) { diff --git a/stack/cas/caserror.class.php b/stack/cas/caserror.class.php index 8fa6a6f4352..8f7e195c60f 100644 --- a/stack/cas/caserror.class.php +++ b/stack/cas/caserror.class.php @@ -40,6 +40,7 @@ class stack_cas_error { */ private $error; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct(string $error , string $context = '') { $this->error = $error; $this->context = $context; @@ -183,10 +184,12 @@ public function get_legacy_error(): string { return $this->error; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_context(): string { return $this->context; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_interpreted_context($question): array { // Maybe that should be cached, on the other hand errors are slow anyway. return self::interpret_context($this->context); diff --git a/stack/cas/cassecurity.class.php b/stack/cas/cassecurity.class.php index e4d4a42dcfa..44b3162aced 100644 --- a/stack/cas/cassecurity.class.php +++ b/stack/cas/cassecurity.class.php @@ -121,6 +121,7 @@ public static function get_feature(string $identifier, string $feature) { return null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($units = false, $allowedwords = '', $forbiddenwords = '', $forbiddenkeys = []) { if (self::$securitymap === null) { // Initialise the map. @@ -157,11 +158,13 @@ public function __construct($units = false, $allowedwords = '', $forbiddenwords } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_allowedwords(string $allowedwords) { $this->allowedwords = $allowedwords; $this->allowedwordsasmap = null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_allowedwords(string $allowedwords) { // We now add things like "dispdp" to existing allowedwords. if ($this->allowedwords === '') { @@ -172,20 +175,24 @@ public function add_allowedwords(string $allowedwords) { $this->allowedwordsasmap = null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_forbiddenwords(string $forbiddenwords) { $this->forbiddenwords = $forbiddenwords; $this->forbiddenwordsasmap = null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_context(array $context) { $this->context = $context; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_context(): array { return $this->context; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_forbiddenkeys(array $forbiddenkeys) { $this->forbiddenkeys = $forbiddenkeys; // Check that the keys if present are the correct way around. @@ -213,10 +220,12 @@ public function set_forbiddenkeys(array $forbiddenkeys) { $this->forbiddenkeys = $real; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_units(bool $units) { $this->units = $units; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_units(): bool { return $this->units; } @@ -438,6 +447,7 @@ public function is_allowed_as_operator(string $security, string $identifier): bo return $security === 't'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_allowed_word(string $identifier, string $type='variable'): bool { if ($this->allowedwordsasmap == null) { $this->allowedwordsasmap = self::list_to_map($this->allowedwords); diff --git a/stack/cas/cassession2.class.php b/stack/cas/cassession2.class.php index a351dd0a287..8b7b57ed217 100644 --- a/stack/cas/cassession2.class.php +++ b/stack/cas/cassession2.class.php @@ -73,6 +73,7 @@ class stack_cas_session2 { */ public $errclass = 'stack_cas_error'; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct(array $statements, $options = null, $seed = null) { $this->instantiated = false; @@ -103,10 +104,12 @@ public function __construct(array $statements, $options = null, $seed = null) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_session(): array { return $this->statements; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_contextvariables(): array { $ret = []; foreach ($this->statements as $statement) { @@ -118,10 +121,12 @@ public function get_contextvariables(): array { return $ret; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_options(): stack_options { return $this->options; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_statement(cas_evaluatable $statement, bool $append = true) { if ($append) { $this->statements[] = $statement; @@ -131,6 +136,7 @@ public function add_statement(cas_evaluatable $statement, bool $append = true) { $this->instantiated = false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_statements(array $statements, bool $append = true) { foreach ($statements as $statement) { if (!is_subclass_of($statement, 'cas_evaluatable')) { @@ -166,6 +172,7 @@ public function append_to_session(stack_cas_session2 $target) { $target->instantiated = false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_variable_usage(array $updatearray = []): array { foreach ($this->statements as $statement) { $updatearray = $statement->get_variable_usage($updatearray); @@ -173,10 +180,12 @@ public function get_variable_usage(array $updatearray = []): array { return $updatearray; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_instantiated(): bool { return $this->instantiated; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { $valid = true; foreach ($this->statements as $statement) { @@ -413,7 +422,7 @@ public function instantiate(): bool { $asts[$key] = $value; } } catch (Exception $e) { - // TODO: issue #1279 would change this exception to add in an error associated + // TO-DO: issue #1279 would change this exception to add in an error associated // with the values collected rather than a stack_exception. // We would then add something like this to allow the process to continue. // $asts[$key] = maxima_parser_utils::parse('null', 'Root', false); @@ -559,6 +568,7 @@ public function get_keyval_representation($evaluatedvalues = false): string { return trim($keyvals); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_debuginfo() { if (trim($this->timeoutdebug ?? '') !== '') { return $this->timeoutdebug; diff --git a/stack/cas/castext2/block.interface.php b/stack/cas/castext2/block.interface.php index bfc29a47a55..7a6124ad1f3 100644 --- a/stack/cas/castext2/block.interface.php +++ b/stack/cas/castext2/block.interface.php @@ -38,6 +38,7 @@ abstract class stack_cas_castext2_block { // Store any errors. public $err = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct( $params, $children = [], diff --git a/stack/cas/castext2/blocks/body.block.php b/stack/cas/castext2/blocks/body.block.php index 2f6a56ca484..9953c29f592 100644 --- a/stack/cas/castext2/blocks/body.block.php +++ b/stack/cas/castext2/blocks/body.block.php @@ -25,6 +25,7 @@ */ class stack_cas_castext2_body extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([ new MP_String('body'), @@ -47,16 +48,19 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // These are never flat. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { // No CAS arguments. return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { diff --git a/stack/cas/castext2/blocks/castext.block.php b/stack/cas/castext2/blocks/castext.block.php index 3798baf68dc..d8c5b4b6417 100644 --- a/stack/cas/castext2/blocks/castext.block.php +++ b/stack/cas/castext2/blocks/castext.block.php @@ -22,6 +22,7 @@ class stack_cas_castext2_castext extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // The purpose of this block is to inject a section of CASText // structure into another CASText structure so this does @@ -31,10 +32,12 @@ public function compile($format, $options): ?MP_Node { return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { $r = [ stack_ast_container_silent::make_from_teacher_source($this->params['evaluated'], @@ -43,6 +46,7 @@ public function validate_extract_attributes(): array { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options = []): bool { if (!array_key_exists('evaluated', $this->params)) { $errors[] = new $options['errclass']('The castext block must be empty and needs to have the "evaluated" ' . diff --git a/stack/cas/castext2/blocks/comment.block.php b/stack/cas/castext2/blocks/comment.block.php index cf5c6e48c45..1fc15ffbfb8 100644 --- a/stack/cas/castext2/blocks/comment.block.php +++ b/stack/cas/castext2/blocks/comment.block.php @@ -20,15 +20,18 @@ class stack_cas_castext2_comment extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Comments do not get anywhere ever. return null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/commonstring.block.php b/stack/cas/castext2/blocks/commonstring.block.php index d62a8454be7..fe732509408 100644 --- a/stack/cas/castext2/blocks/commonstring.block.php +++ b/stack/cas/castext2/blocks/commonstring.block.php @@ -40,6 +40,7 @@ */ class stack_cas_castext2_commonstring extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // The user should use this block's full name "commonstring" but // as this is a common block and chars take room we tend to use a shorter @@ -129,10 +130,12 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { $r = []; foreach ($this->params as $key => $value) { @@ -143,6 +146,7 @@ public function validate_extract_attributes(): array { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { if (count($params) === 2) { @@ -164,6 +168,7 @@ public function postprocess(array $params, castext2_processor $processor, } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('key', $this->params)) { $errors[] = new $options['errclass']('The commonstring block must always have a key for the string template.', diff --git a/stack/cas/castext2/blocks/cors.block.php b/stack/cas/castext2/blocks/cors.block.php index 9655878558f..b5e86b0cba3 100644 --- a/stack/cas/castext2/blocks/cors.block.php +++ b/stack/cas/castext2/blocks/cors.block.php @@ -26,19 +26,23 @@ */ class stack_cas_castext2_cors extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_String(stack_cors_link($this->params['src'])); return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate( &$errors = [], $options = [] diff --git a/stack/cas/castext2/blocks/debug.block.php b/stack/cas/castext2/blocks/debug.block.php index 331d105fe5d..b45d8a4a159 100644 --- a/stack/cas/castext2/blocks/debug.block.php +++ b/stack/cas/castext2/blocks/debug.block.php @@ -21,6 +21,7 @@ class stack_cas_castext2_debug extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // So we are to print out a table of bound variable values. $bounds = []; @@ -63,10 +64,12 @@ public function compile($format, $options): ?MP_Node { return castext2_parser_utils::compile($castext, $format, $options); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/define.block.php b/stack/cas/castext2/blocks/define.block.php index 58e4ae48834..0efe452f57f 100644 --- a/stack/cas/castext2/blocks/define.block.php +++ b/stack/cas/castext2/blocks/define.block.php @@ -21,6 +21,7 @@ class stack_cas_castext2_define extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $epos = $options['context'] . '/' . $this->position['start'] . '-' . $this->position['end']; $r = new MP_Group([]); @@ -48,10 +49,12 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { $r = []; foreach ($this->params as $param) { diff --git a/stack/cas/castext2/blocks/demarkdown.block.php b/stack/cas/castext2/blocks/demarkdown.block.php index 0d5a5e91e27..4b7c9a84475 100644 --- a/stack/cas/castext2/blocks/demarkdown.block.php +++ b/stack/cas/castext2/blocks/demarkdown.block.php @@ -27,6 +27,7 @@ */ class stack_cas_castext2_demarkdown extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Basically mark the contents for post-processing. $r = new MP_List([new MP_String('demarkdown')]); @@ -47,10 +48,12 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { // First collapse the content. @@ -90,6 +93,7 @@ public function postprocess(array $params, castext2_processor $processor, return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/demoodle.block.php b/stack/cas/castext2/blocks/demoodle.block.php index ddd8adf0d05..00eaf3210f9 100644 --- a/stack/cas/castext2/blocks/demoodle.block.php +++ b/stack/cas/castext2/blocks/demoodle.block.php @@ -28,6 +28,7 @@ */ class stack_cas_castext2_demoodle extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Basically mark the contents for post-processing. $r = new MP_List([new MP_String('demoodle')]); @@ -42,10 +43,12 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { // First collapse the content. @@ -79,6 +82,7 @@ public function postprocess(array $params, castext2_processor $processor, return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/escape.block.php b/stack/cas/castext2/blocks/escape.block.php index d89fda6f409..7949db73bfa 100644 --- a/stack/cas/castext2/blocks/escape.block.php +++ b/stack/cas/castext2/blocks/escape.block.php @@ -23,6 +23,7 @@ class stack_cas_castext2_escape extends stack_cas_castext2_block { public $content; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($params, $children=[], $mathmode=false) { parent::__construct($params, $children, $mathmode); if (count($children) > 0) { @@ -33,6 +34,7 @@ public function __construct($params, $children=[], $mathmode=false) { $this->children = []; // We want to modify the iteration here a bit. } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { if ($this->content === null && !array_key_exists('value', $this->params)) { return null; @@ -44,14 +46,17 @@ public function compile($format, $options): ?MP_Node { return new MP_String($this->content); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { // Due to escape block needing some backwards compatibility we still need to support // the old way of defining the value as an parameter but not both ways at the same time. diff --git a/stack/cas/castext2/blocks/foreach.block.php b/stack/cas/castext2/blocks/foreach.block.php index b7ff0b2e9fd..847a4874b64 100644 --- a/stack/cas/castext2/blocks/foreach.block.php +++ b/stack/cas/castext2/blocks/foreach.block.php @@ -21,6 +21,7 @@ class stack_cas_castext2_foreach extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $flat = $this->is_flat(); @@ -135,6 +136,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Now then the problem here is that the flatness depends on the flatness of // the blocks contents. If they all generate strings then we are flat but if not... @@ -147,6 +149,7 @@ public function is_flat(): bool { return $flat; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { $r = []; foreach ($this->params as $key => $value) { diff --git a/stack/cas/castext2/blocks/geogebra.block.php b/stack/cas/castext2/blocks/geogebra.block.php index 66857eb0c4b..e999c718a53 100644 --- a/stack/cas/castext2/blocks/geogebra.block.php +++ b/stack/cas/castext2/blocks/geogebra.block.php @@ -50,6 +50,7 @@ private function str_ends_with($word, $searchstring) { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // We are outputting as [[iframe]], so we will generate some parameters for it on the side. $r = new MP_List([new MP_String('iframe')]); @@ -453,15 +454,18 @@ public function compile($format, $options): ?MP_Node { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { return 'This is never happening! The logic goes to [[iframe]].'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { // Note that all the "set" variables are actually CAS variables. // So we should return the nosuffix versions here for checking. @@ -471,6 +475,7 @@ public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors = [], $options = []): bool { // Basically, check that the dimensions have units we know. // Also that the references make sense. diff --git a/stack/cas/castext2/blocks/hint.block.php b/stack/cas/castext2/blocks/hint.block.php index c847f83c648..76bdc977483 100644 --- a/stack/cas/castext2/blocks/hint.block.php +++ b/stack/cas/castext2/blocks/hint.block.php @@ -20,6 +20,7 @@ class stack_cas_castext2_hint extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $body = new MP_List([new MP_String('%root')]); @@ -39,10 +40,12 @@ public function compile($format, $options): ?MP_Node { return $body; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { $r = []; if (!isset($this->params['title'])) { @@ -52,6 +55,7 @@ public function validate_extract_attributes(): array { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('title', $this->params)) { $errors[] = new $options['errclass']('Hint block requires a title parameter.', $options['context'] . '/' . diff --git a/stack/cas/castext2/blocks/htmlformat.block.php b/stack/cas/castext2/blocks/htmlformat.block.php index 0b6763bf82e..a7609c6630b 100644 --- a/stack/cas/castext2/blocks/htmlformat.block.php +++ b/stack/cas/castext2/blocks/htmlformat.block.php @@ -27,6 +27,7 @@ */ class stack_cas_castext2_htmlformat extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Basically we change the value of $format for this subtree. // Note that the jsxgraph and geogebra block does this automatically. @@ -52,6 +53,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Now then the problem here is that the flatness depends on the flatness of // the blocks contents. If they all generate strings then we are flat but if not... @@ -64,6 +66,7 @@ public function is_flat(): bool { return $flat; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { $content = ''; @@ -79,6 +82,7 @@ public function postprocess(array $params, castext2_processor $processor, return $content; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/if.block.php b/stack/cas/castext2/blocks/if.block.php index dd15c839d72..0eb56a2379c 100644 --- a/stack/cas/castext2/blocks/if.block.php +++ b/stack/cas/castext2/blocks/if.block.php @@ -22,6 +22,7 @@ class stack_cas_castext2_if extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // If we are flat we just sconcat stuff to return but if not then we need to // generate the list version like the root-block. @@ -160,6 +161,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Now then the problem here is that the flatness depends on the flatness of // the blocks contents. If they all generate strings then we are flat but if not... @@ -172,6 +174,7 @@ public function is_flat(): bool { return $flat; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { $r = []; if (!isset($this->params['test'])) { @@ -190,6 +193,7 @@ public function validate_extract_attributes(): array { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('test', $this->params)) { $errors[] = new $options['errclass']('If block requires a test parameter.', $options['context'] . '/' . diff --git a/stack/cas/castext2/blocks/iframe.block.php b/stack/cas/castext2/blocks/iframe.block.php index d9b206f4555..f75067a4186 100644 --- a/stack/cas/castext2/blocks/iframe.block.php +++ b/stack/cas/castext2/blocks/iframe.block.php @@ -47,6 +47,7 @@ public static function register_counter(string $name): void { self::$counters[$name] = 1; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([ new MP_String('iframe'), @@ -71,16 +72,19 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // These are never flat. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { // No CAS arguments. return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { global $PAGE; @@ -213,6 +217,7 @@ public function postprocess(array $params, castext2_processor $processor, return $holder->add_to_map(html_writer::tag('div', '', $attributes)); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { // Basically, check that the dimensions have units we know. // Also that the references make sense. diff --git a/stack/cas/castext2/blocks/include.block.php b/stack/cas/castext2/blocks/include.block.php index 113c56a1e28..9f883993c0a 100644 --- a/stack/cas/castext2/blocks/include.block.php +++ b/stack/cas/castext2/blocks/include.block.php @@ -41,6 +41,7 @@ */ class stack_cas_castext2_include extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $src = stack_fetch_included_content($this->params['src']); if (isset($options['in include'])) { @@ -62,10 +63,12 @@ public function compile($format, $options): ?MP_Node { return castext2_parser_utils::compile($src, $format, $opt2); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { // This is tricky, we need to validate the attributes of the included content. // To do that we need to retrieve it and process it again, luckily this gets cached. @@ -77,6 +80,7 @@ public function validate_extract_attributes(): array { return castext2_parser_utils::get_casstrings($src); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('src', $this->params)) { $errors[] = new $options['errclass']('Include block requires a src parameter.', $options['context'] . '/' . diff --git a/stack/cas/castext2/blocks/ioblock.specialblock.php b/stack/cas/castext2/blocks/ioblock.specialblock.php index aa12503e6e3..f3034d4d9dd 100644 --- a/stack/cas/castext2/blocks/ioblock.specialblock.php +++ b/stack/cas/castext2/blocks/ioblock.specialblock.php @@ -23,12 +23,14 @@ class stack_cas_castext2_special_ioblock extends stack_cas_castext2_block { public $channel; public $variable; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($params, $children=[], $mathmode=false, $channel='', $variable='') { parent::__construct($params, $children, $mathmode); $this->channel = $channel; $this->variable = $variable; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // If used before input2 we do not need to maintain the parsed structure. // If we do not need the structure we can cut down on processign and compile @@ -39,10 +41,12 @@ public function compile($format, $options): ?MP_Node { return new MP_List([new MP_String('ioblock'), new MP_String($this->channel), new MP_String($this->variable)]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/javascript.block.php b/stack/cas/castext2/blocks/javascript.block.php index 62c16cc3bab..4664baef54a 100644 --- a/stack/cas/castext2/blocks/javascript.block.php +++ b/stack/cas/castext2/blocks/javascript.block.php @@ -39,6 +39,7 @@ */ class stack_cas_castext2_javascript extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([new MP_String('iframe')]); @@ -104,21 +105,25 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Even when the content were flat we need to evaluate this during postprocessing. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { return 'This is never happening! The logic goes to [[iframe]].'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate( &$errors = [], $options = [] diff --git a/stack/cas/castext2/blocks/jsstring.block.php b/stack/cas/castext2/blocks/jsstring.block.php index 49851a82bb6..924a083f6a9 100644 --- a/stack/cas/castext2/blocks/jsstring.block.php +++ b/stack/cas/castext2/blocks/jsstring.block.php @@ -24,6 +24,7 @@ */ class stack_cas_castext2_jsstring extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([new MP_String('jsstring')]); @@ -50,6 +51,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Now then the problem here is that the flatness depends on the flatness of // the blocks contents. If they all generate strings then we are flat but if not... @@ -62,6 +64,7 @@ public function is_flat(): bool { return $flat; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { // NOTE! We now have a problem with $holder the json_encode won't get applied to things @@ -79,6 +82,7 @@ public function postprocess(array $params, castext2_processor $processor, return json_encode($content); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/jsxgraph.block.php b/stack/cas/castext2/blocks/jsxgraph.block.php index d3130c0cbe0..8bda55badc4 100644 --- a/stack/cas/castext2/blocks/jsxgraph.block.php +++ b/stack/cas/castext2/blocks/jsxgraph.block.php @@ -52,6 +52,7 @@ class stack_cas_castext2_jsxgraph extends stack_cas_castext2_block { ], ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([new MP_String('iframe')]); @@ -198,20 +199,24 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Even when the content were flat we need to evaluate this during postprocessing. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { return 'This is never happening! The logic goes to [[iframe]].'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate( &$errors = [], $options = [] diff --git a/stack/cas/castext2/blocks/lang.block.php b/stack/cas/castext2/blocks/lang.block.php index daee35905b7..daa5cec53c2 100644 --- a/stack/cas/castext2/blocks/lang.block.php +++ b/stack/cas/castext2/blocks/lang.block.php @@ -26,6 +26,7 @@ */ class stack_cas_castext2_lang extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $checks = null; foreach (explode(',', $this->params['code']) as $code) { @@ -64,6 +65,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { $flat = true; @@ -74,10 +76,12 @@ public function is_flat(): bool { return $flat; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('code', $this->params)) { $errors[] = new $options['errclass']('The "lang"-block needs a code atribute with a singular code or a comma ' . diff --git a/stack/cas/castext2/blocks/latex.block.php b/stack/cas/castext2/blocks/latex.block.php index abf81b4c50a..429d2b6f4eb 100644 --- a/stack/cas/castext2/blocks/latex.block.php +++ b/stack/cas/castext2/blocks/latex.block.php @@ -21,6 +21,7 @@ class stack_cas_castext2_latex extends stack_cas_castext2_raw { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Convert possible simplification flags. $ev = stack_ast_container::make_from_teacher_source($this->content); @@ -95,6 +96,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } diff --git a/stack/cas/castext2/blocks/parsons.block.php b/stack/cas/castext2/blocks/parsons.block.php index 3eea6e3c7e8..63061cae1ee 100644 --- a/stack/cas/castext2/blocks/parsons.block.php +++ b/stack/cas/castext2/blocks/parsons.block.php @@ -38,6 +38,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block { ], ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([new MP_String('iframe')]); @@ -375,20 +376,24 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Even when the content were flat we need to evaluate this during postprocessing. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { return 'This is never happening! The logic goes to [[iframe]].'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate( &$errors = [], $options = [] diff --git a/stack/cas/castext2/blocks/pfs.specialblock.php b/stack/cas/castext2/blocks/pfs.specialblock.php index e073a3f638d..e9260c2d18b 100644 --- a/stack/cas/castext2/blocks/pfs.specialblock.php +++ b/stack/cas/castext2/blocks/pfs.specialblock.php @@ -32,6 +32,7 @@ class stack_cas_castext2_special_rewrite_pluginfile_urls extends stack_cas_caste public $itemid; public $component = 'qtype_stack'; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($params, $children=[], $mathmode=false, $value='') { parent::__construct($params, $children, $mathmode); if (count($params) == 0) { @@ -47,6 +48,7 @@ public function __construct($params, $children=[], $mathmode=false, $value='') { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Now we might actually do the rewrite before everything else but // for now we prefer to leave it as a latter step, just in case someone @@ -90,11 +92,13 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Not flat as this always requires rewriting. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { // First collapse the content. @@ -113,6 +117,7 @@ public function postprocess(array $params, castext2_processor $processor, return $content; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/placeholder.specialblock.php b/stack/cas/castext2/blocks/placeholder.specialblock.php index 835327d7e52..88fa100b76a 100644 --- a/stack/cas/castext2/blocks/placeholder.specialblock.php +++ b/stack/cas/castext2/blocks/placeholder.specialblock.php @@ -26,18 +26,22 @@ */ class stack_cas_castext2_special_placeholder extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { return new MP_String("THIS NEVER HAPPENS, IT IS NOT ALLOWED TO USE THIS BLOCK ON THE AUTHOR SIDE"); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { return $holder->add_to_map($params[1]); diff --git a/stack/cas/castext2/blocks/quid.block.php b/stack/cas/castext2/blocks/quid.block.php index f8dc32fdbd7..26de12078c3 100644 --- a/stack/cas/castext2/blocks/quid.block.php +++ b/stack/cas/castext2/blocks/quid.block.php @@ -27,14 +27,17 @@ class stack_cas_castext2_quid extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { return new MP_List([new MP_String('quid'), new MP_String($this->params['id'])]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { $id = $params[1]; @@ -45,10 +48,12 @@ public function postprocess(array $params, castext2_processor $processor, return $content; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('id', $this->params)) { $errors[] = new $options['errclass']('quid-blocks need an id-attribute with a value.', diff --git a/stack/cas/castext2/blocks/raw.block.php b/stack/cas/castext2/blocks/raw.block.php index d6a407e5d80..5f8c98685b1 100644 --- a/stack/cas/castext2/blocks/raw.block.php +++ b/stack/cas/castext2/blocks/raw.block.php @@ -24,12 +24,14 @@ class stack_cas_castext2_raw extends stack_cas_castext2_block { public $content; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($params, $children=[], $mathmode=false) { parent::__construct($params, $children, $mathmode); $this->content = $children[0]->content; // The child is a different type of RAW. $this->children = []; // We want to modify the iteration here a bit. } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Convert possible simplification flags. $ev = stack_ast_container::make_from_teacher_source($this->content); @@ -90,10 +92,12 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return [stack_ast_container::make_from_teacher_source($this->content, 'ct2:raw', new stack_cas_security())]; } diff --git a/stack/cas/castext2/blocks/raw.specialblock.php b/stack/cas/castext2/blocks/raw.specialblock.php index 93772d02e80..d77e888aa81 100644 --- a/stack/cas/castext2/blocks/raw.specialblock.php +++ b/stack/cas/castext2/blocks/raw.specialblock.php @@ -23,19 +23,23 @@ class stack_cas_castext2_special_raw extends stack_cas_castext2_block { public $content; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($params, $children=[], $mathmode=false, $value='') { parent::__construct($params, $children, $mathmode); $this->content = $value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { return new MP_String($this->content); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/reveal.block.php b/stack/cas/castext2/blocks/reveal.block.php index 8fd3d014585..d18b914ec2f 100644 --- a/stack/cas/castext2/blocks/reveal.block.php +++ b/stack/cas/castext2/blocks/reveal.block.php @@ -30,6 +30,7 @@ */ class stack_cas_castext2_reveal extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { static $count = 0; /* @@ -90,16 +91,19 @@ public function compile($format, $options): ?MP_Node { return $body; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Never flat, the [[iframe]] portion needs extra processing. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { return 'Post processing of reveal blocks never happens, this block is handled through [[iframe]].'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/root.specialblock.php b/stack/cas/castext2/blocks/root.specialblock.php index 08bc2a1f681..d8351f9edd3 100644 --- a/stack/cas/castext2/blocks/root.specialblock.php +++ b/stack/cas/castext2/blocks/root.specialblock.php @@ -113,6 +113,7 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // Now then the problem here is that the flatness depends on the flatness of // the blocks contents. If they all generate strings then we are flat but if not... @@ -154,6 +155,7 @@ public function postprocess(array $params, castext2_processor $processor, return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/script.block.php b/stack/cas/castext2/blocks/script.block.php index 72f360f60c2..8df3a7583f4 100644 --- a/stack/cas/castext2/blocks/script.block.php +++ b/stack/cas/castext2/blocks/script.block.php @@ -30,6 +30,7 @@ */ class stack_cas_castext2_script extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([ new MP_String('script'), @@ -53,16 +54,19 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // These are never flat. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { // No CAS arguments. return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { diff --git a/stack/cas/castext2/blocks/smlt.specialblock.php b/stack/cas/castext2/blocks/smlt.specialblock.php index 7f8b2e441d9..4b49c6dd20e 100644 --- a/stack/cas/castext2/blocks/smlt.specialblock.php +++ b/stack/cas/castext2/blocks/smlt.specialblock.php @@ -27,21 +27,25 @@ class stack_cas_castext2_special_stack_maxima_latex_tidy extends stack_cas_castext2_block { public $content; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($params, $children = [], $mathmode = false, $value = '') { parent::__construct($params, $children, $mathmode); $this->content = $value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Should not even happen. This is not a block that makes sense for // end users. return new MP_List([new MP_String('smlt'), new MP_String($this->content)]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { if (count($params) < 2) { @@ -71,6 +75,7 @@ public function postprocess(array $params, castext2_processor $processor, return stack_maxima_latex_tidy($t); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/stack_translate.specialblock.php b/stack/cas/castext2/blocks/stack_translate.specialblock.php index ad5cbc5eaf4..7ed2d916587 100644 --- a/stack/cas/castext2/blocks/stack_translate.specialblock.php +++ b/stack/cas/castext2/blocks/stack_translate.specialblock.php @@ -26,6 +26,7 @@ public function compile($format, $options): ?MP_Node { return new MP_String(''); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // While flat there always require post processing. return false; @@ -48,6 +49,7 @@ public function postprocess(array $params, castext2_processor $processor, return stack_maxima_translate($t); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/blocks/style.block.php b/stack/cas/castext2/blocks/style.block.php index 43362e770b4..1a600b407b2 100644 --- a/stack/cas/castext2/blocks/style.block.php +++ b/stack/cas/castext2/blocks/style.block.php @@ -29,6 +29,7 @@ */ class stack_cas_castext2_style extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $r = new MP_List([ new MP_String('style'), @@ -52,16 +53,19 @@ public function compile($format, $options): ?MP_Node { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { // These are never flat. return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { // No CAS arguments. return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { diff --git a/stack/cas/castext2/blocks/template.block.php b/stack/cas/castext2/blocks/template.block.php index 51b1a9d18df..5cd9ee76ab9 100644 --- a/stack/cas/castext2/blocks/template.block.php +++ b/stack/cas/castext2/blocks/template.block.php @@ -28,6 +28,7 @@ */ class stack_cas_castext2_template extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { if (count($this->children) === 0) { // If we are applying a template then we need to decide how we @@ -74,6 +75,7 @@ public function compile($format, $options): ?MP_Node { ]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { if (count($this->children) === 0 && !array_key_exists('mode', $this->params)) { // When declaring a template the result will always be an empty string. @@ -83,10 +85,12 @@ public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('name', $this->params)) { $errors[] = new $options['errclass']('The "template"-block needs a name.', diff --git a/stack/cas/castext2/blocks/textdownload.block.php b/stack/cas/castext2/blocks/textdownload.block.php index 846b57b43fb..5ee73dc8102 100644 --- a/stack/cas/castext2/blocks/textdownload.block.php +++ b/stack/cas/castext2/blocks/textdownload.block.php @@ -38,6 +38,7 @@ class stack_cas_castext2_textdownload extends stack_cas_castext2_block { public static $countfiles = 1; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { if (!isset($options['in main content']) || !$options['in main content']) { throw new stack_exception('CASText2 textdownload is currently only supported in question-text / scene-text.'); @@ -71,14 +72,17 @@ public function compile($format, $options): ?MP_Node { return $code; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function postprocess(array $params, castext2_processor $processor, castext2_placeholder_holder $holder): string { if (get_config('qtype_stack', 'stackapi')) { @@ -103,6 +107,7 @@ public function postprocess(array $params, castext2_processor $processor, } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate(&$errors=[], $options=[]): bool { if (!array_key_exists('name', $this->params)) { $errors[] = new $options['errclass']('The textdownload-block requires one to declare a name for the file.', diff --git a/stack/cas/castext2/blocks/todo.block.php b/stack/cas/castext2/blocks/todo.block.php index c3ae29c2276..b3b080e6932 100644 --- a/stack/cas/castext2/blocks/todo.block.php +++ b/stack/cas/castext2/blocks/todo.block.php @@ -21,20 +21,24 @@ class stack_cas_castext2_todo extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { $body = new MP_List([new MP_String('%root')]); $body->items[] = new MP_String(''); return $body; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function extract_todo(): array { $tags = []; if (!array_key_exists('tags', $this->params)) { diff --git a/stack/cas/castext2/blocks/unknown.block.php b/stack/cas/castext2/blocks/unknown.block.php index d5a1be94724..4c94aaf593e 100644 --- a/stack/cas/castext2/blocks/unknown.block.php +++ b/stack/cas/castext2/blocks/unknown.block.php @@ -28,15 +28,18 @@ */ class stack_cas_castext2_unknown extends stack_cas_castext2_block { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compile($format, $options): ?MP_Node { // Unknown blocks do not get anywhere ever. return null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_flat(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validate_extract_attributes(): array { return []; } diff --git a/stack/cas/castext2/castext2_evaluatable.class.php b/stack/cas/castext2/castext2_evaluatable.class.php index 14ebc52b03f..72a6a3c6685 100644 --- a/stack/cas/castext2/castext2_evaluatable.class.php +++ b/stack/cas/castext2/castext2_evaluatable.class.php @@ -216,6 +216,7 @@ public function get_valid($format=null, $options=null, $sec=null): bool { return $this->valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { if ($this->compiled === null) { if (!$this->get_valid()) { @@ -225,6 +226,7 @@ public function get_evaluationform(): string { return $this->compiled; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_status(array $errors, array $answernotes, array $feedback) { $this->errors = $errors; if (count($this->errors) > 0) { @@ -232,18 +234,22 @@ public function set_cas_status(array $errors, array $answernotes, array $feedbac } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_source_context(): string { return $this->context; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_key(): string { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_evaluated_value(string $stringval) { $this->value = $stringval; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function requires_evaluation(): bool { if ($this->valid === null) { // Compile if not compiled. @@ -263,6 +269,7 @@ public function requires_evaluation(): bool { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_rendered(castext2_processor $processor = null): string { if ($this->evaluated === null) { // Do the simpler parse of the value. The full MaximaParser @@ -304,6 +311,7 @@ public function get_rendered(castext2_processor $processor = null): string { return $this->evaluated; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_errors($implode = true) { if ($implode === 'objects') { return $this->errors; diff --git a/stack/cas/castext2/castext2_placeholder_holder.class.php b/stack/cas/castext2/castext2_placeholder_holder.class.php index 9a6389792a6..c4105de2303 100644 --- a/stack/cas/castext2/castext2_placeholder_holder.class.php +++ b/stack/cas/castext2/castext2_placeholder_holder.class.php @@ -33,6 +33,7 @@ class castext2_placeholder_holder { private $map; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct() { $this->map = []; } diff --git a/stack/cas/castext2/castext2_static_replacer.class.php b/stack/cas/castext2/castext2_static_replacer.class.php index c85b87db77a..480afbfa2da 100644 --- a/stack/cas/castext2/castext2_static_replacer.class.php +++ b/stack/cas/castext2/castext2_static_replacer.class.php @@ -30,6 +30,7 @@ class castext2_static_replacer { private $map; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct(array $map) { $this->map = $map; } @@ -39,6 +40,7 @@ public function get_map(): array { return $this->map; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($in) { // This might be called with a complete string. if (is_string($in)) { @@ -67,6 +69,7 @@ public function replace($in) { return $in; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function extract(string $in): string { // If the castext is already a static string don't do anything. if (mb_substr($in, 0, 1) === '"') { diff --git a/stack/cas/connector.class.php b/stack/cas/connector.class.php index 3f4d82d43ab..cc78d788c8e 100644 --- a/stack/cas/connector.class.php +++ b/stack/cas/connector.class.php @@ -85,6 +85,7 @@ public function compute($command) { return $unpackedresult; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function json_compute($command): array { $this->debug->log('Maxima command', $command); @@ -283,6 +284,7 @@ protected function unpack_raw_result($rawresult) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function unpack_helper($rawresultfragment) { // Take the raw string from the CAS, and unpack this into an array. $offset = 0; diff --git a/stack/cas/connector.dbcache.class.php b/stack/cas/connector.dbcache.class.php index 9971409092c..82214eeda29 100644 --- a/stack/cas/connector.dbcache.class.php +++ b/stack/cas/connector.dbcache.class.php @@ -42,6 +42,7 @@ public function __construct(stack_cas_connection $rawconnection, stack_debug_log $this->db = $db; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function compute($command) { $cached = $this->get_cached_result($command); if ($cached->result) { @@ -64,10 +65,12 @@ public function compute($command) { return $result; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_maxima_available() { return stack_string('healthunabletolistavail'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function json_compute($command): array { $cached = $this->get_cached_result($command); if ($cached->result) { @@ -92,6 +95,7 @@ public function json_compute($command): array { return $parsed; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_debuginfo() { return $this->debug->get_log(); } diff --git a/stack/cas/connector.healthcheck.class.php b/stack/cas/connector.healthcheck.class.php index a4e36d2348b..53612a25a98 100644 --- a/stack/cas/connector.healthcheck.class.php +++ b/stack/cas/connector.healthcheck.class.php @@ -45,6 +45,7 @@ class stack_cas_healthcheck { protected $tests = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($config) { global $CFG; $this->config = $config; diff --git a/stack/cas/connector.linux.class.php b/stack/cas/connector.linux.class.php index 06689585fa4..16008739235 100644 --- a/stack/cas/connector.linux.class.php +++ b/stack/cas/connector.linux.class.php @@ -23,6 +23,7 @@ */ class stack_cas_connection_linux extends stack_cas_connection_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function guess_maxima_command($path) { global $CFG; if (stack_connection_helper::get_platform() == 'linux-optimised') { @@ -49,6 +50,7 @@ protected function guess_maxima_command($path) { return $maximacommand; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function call_maxima($command) { // For unicode support, we need to add something like 'LANG' => 'en_GB.UTF-8' to the environment below. $env = ['PATH' => getenv('PATH')]; diff --git a/stack/cas/connector.server.class.php b/stack/cas/connector.server.class.php index ebf210f4721..5e10684139c 100644 --- a/stack/cas/connector.server.class.php +++ b/stack/cas/connector.server.class.php @@ -27,10 +27,12 @@ */ class stack_cas_connection_server extends stack_cas_connection_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function guess_maxima_command($path) { return 'http://localhost:8080/MaximaPool/MaximaPool'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function call_maxima($command) { global $CFG; $err = ''; diff --git a/stack/cas/connector.server_proxy.class.php b/stack/cas/connector.server_proxy.class.php index ad44dcc0c76..2f6a38c54c3 100644 --- a/stack/cas/connector.server_proxy.class.php +++ b/stack/cas/connector.server_proxy.class.php @@ -27,10 +27,12 @@ */ class stack_cas_connection_server_proxy extends stack_cas_connection_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function guess_maxima_command($path) { return 'http://localhost:8080/MaximaPool/MaximaPool'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function call_maxima($command) { global $CFG; $err = ''; diff --git a/stack/cas/connector.windows.class.php b/stack/cas/connector.windows.class.php index 70c2a228301..7a368af9932 100644 --- a/stack/cas/connector.windows.class.php +++ b/stack/cas/connector.windows.class.php @@ -23,6 +23,7 @@ */ class stack_cas_connection_windows extends stack_cas_connection_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function guess_maxima_command($path) { if ('default' == stack_connection_helper::get_maximaversion()) { throw new stack_exception("stack_cas_connection: maxima cannot be set to default on Windows platform. ". @@ -35,6 +36,7 @@ protected function guess_maxima_command($path) { return $cmd; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function call_maxima($command) { set_time_limit(0); // Note, some users may not want this! $ret = false; diff --git a/stack/cas/installhelper.class.php b/stack/cas/installhelper.class.php index eacacb83e4a..11e01d103d7 100644 --- a/stack/cas/installhelper.class.php +++ b/stack/cas/installhelper.class.php @@ -149,6 +149,7 @@ public function get_plotcommand_win() { throw new stack_exception('Could not locate GNUPlot.'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function maxima_win_location() { if ($this->settings->platform != 'win') { return ''; @@ -191,6 +192,7 @@ public function maxima_win_location() { implode(', ', $locations)); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function copy_maxima_bat() { global $CFG; @@ -212,6 +214,7 @@ public function copy_maxima_bat() { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_maximalocal_contents() { $contents = <<raw = $raw; $this->statements = []; @@ -214,6 +215,7 @@ public function get_valid($inputs = null) { return $this->valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_errors($casdebug = false, $raw = 'strings') { if (null === $this->valid) { $this->validate(null); @@ -242,6 +244,7 @@ public function get_errors($casdebug = false, $raw = 'strings') { return $errors; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function instantiate() { if (null === $this->valid) { $this->validate(null); @@ -254,6 +257,7 @@ public function instantiate() { return $cs->get_errors(true); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_session() { if (null === $this->valid) { $this->validate(null); @@ -261,10 +265,12 @@ public function get_session() { return new stack_cas_session2($this->statements, $this->options, $this->seed); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_raw() { return $this->raw; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_variable_usage(array $updatearray = []): array { if (!array_key_exists('read', $updatearray)) { $updatearray['read'] = []; diff --git a/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php b/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php index 4278abfd678..013e2cedfed 100644 --- a/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php +++ b/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_001_fix_call_of_a_group_or_function implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$valid, &$errors, &$answernotes) { diff --git a/stack/cas/parsingrules/003_no_dot_dot.filter.php b/stack/cas/parsingrules/003_no_dot_dot.filter.php index a3585781630..0ad6f3e3ae9 100644 --- a/stack/cas/parsingrules/003_no_dot_dot.filter.php +++ b/stack/cas/parsingrules/003_no_dot_dot.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_003_no_dot_dot implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$valid, &$errors, &$answernotes) { diff --git a/stack/cas/parsingrules/005_i_is_never_a_function.filter.php b/stack/cas/parsingrules/005_i_is_never_a_function.filter.php index 93bf16f54b8..e62e9bbc19c 100644 --- a/stack/cas/parsingrules/005_i_is_never_a_function.filter.php +++ b/stack/cas/parsingrules/005_i_is_never_a_function.filter.php @@ -22,6 +22,7 @@ */ class stack_ast_filter_005_i_is_never_a_function implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$valid, &$errors, &$answernotes) { diff --git a/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php b/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php index cdbd73010af..a412e214487 100644 --- a/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php +++ b/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php @@ -22,6 +22,7 @@ */ class stack_ast_filter_022_trig_replace_synonyms implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { // As these are invalid they do not exist in the security-map. diff --git a/stack/cas/parsingrules/025_no_trig_power.filter.php b/stack/cas/parsingrules/025_no_trig_power.filter.php index 3612e18b086..46bb86a206c 100644 --- a/stack/cas/parsingrules/025_no_trig_power.filter.php +++ b/stack/cas/parsingrules/025_no_trig_power.filter.php @@ -25,6 +25,7 @@ class stack_ast_filter_025_no_trig_power implements stack_cas_astfilter { public static $ssmap = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { if (self::$ssmap === null) { self::$ssmap = json_decode(file_get_contents(__DIR__ . '/../../maximaparser/unicode/superscript-stack.json'), true); diff --git a/stack/cas/parsingrules/030_no_trig_space.filter.php b/stack/cas/parsingrules/030_no_trig_space.filter.php index f4e9e432a7b..c33d2557f79 100644 --- a/stack/cas/parsingrules/030_no_trig_space.filter.php +++ b/stack/cas/parsingrules/030_no_trig_space.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_030_no_trig_space implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $selectednames = stack_cas_security::get_all_with_feature('trigfun'); diff --git a/stack/cas/parsingrules/031_no_trig_brackets.filter.php b/stack/cas/parsingrules/031_no_trig_brackets.filter.php index 8bdef690d7e..295b0a58969 100644 --- a/stack/cas/parsingrules/031_no_trig_brackets.filter.php +++ b/stack/cas/parsingrules/031_no_trig_brackets.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_031_no_trig_brackets implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $selectednames = stack_cas_security::get_all_with_feature('trigfun'); diff --git a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php index 6bbd683bf9a..a69044af934 100644 --- a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php +++ b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php @@ -22,6 +22,7 @@ */ class stack_ast_filter_033_no_extra_evaluation implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$errors, &$answernotes) { diff --git a/stack/cas/parsingrules/050_no_chained_inequalities.filter.php b/stack/cas/parsingrules/050_no_chained_inequalities.filter.php index be2b40d8449..d52d59c274f 100644 --- a/stack/cas/parsingrules/050_no_chained_inequalities.filter.php +++ b/stack/cas/parsingrules/050_no_chained_inequalities.filter.php @@ -22,6 +22,7 @@ */ class stack_ast_filter_050_no_chained_inequalities implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $ops = [ diff --git a/stack/cas/parsingrules/090_special_forbidden_characters.filter.php b/stack/cas/parsingrules/090_special_forbidden_characters.filter.php index b48e69210ee..6970889dd53 100644 --- a/stack/cas/parsingrules/090_special_forbidden_characters.filter.php +++ b/stack/cas/parsingrules/090_special_forbidden_characters.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_090_special_forbidden_characters implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $warned = []; diff --git a/stack/cas/parsingrules/101_no_floats.filter.php b/stack/cas/parsingrules/101_no_floats.filter.php index 44e3fc57390..12b05336498 100644 --- a/stack/cas/parsingrules/101_no_floats.filter.php +++ b/stack/cas/parsingrules/101_no_floats.filter.php @@ -37,6 +37,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '450_split_floats') { return true; diff --git a/stack/cas/parsingrules/120_no_arc.filter.php b/stack/cas/parsingrules/120_no_arc.filter.php index daec840ae6d..967e61a63b5 100644 --- a/stack/cas/parsingrules/120_no_arc.filter.php +++ b/stack/cas/parsingrules/120_no_arc.filter.php @@ -25,6 +25,7 @@ */ class stack_ast_filter_120_no_arc implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { // As these are invalid they do not exist in the security-map. diff --git a/stack/cas/parsingrules/150_replace_unicode_letters.filter.php b/stack/cas/parsingrules/150_replace_unicode_letters.filter.php index d1934aff789..a1b93c020e5 100644 --- a/stack/cas/parsingrules/150_replace_unicode_letters.filter.php +++ b/stack/cas/parsingrules/150_replace_unicode_letters.filter.php @@ -25,6 +25,7 @@ class stack_ast_filter_150_replace_unicode_letters implements stack_cas_astfilte public static $ssmap = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { if (self::$ssmap === null) { self::$ssmap = json_decode(file_get_contents(__DIR__ . '/../../maximaparser/unicode/letters-stack.json'), true); diff --git a/stack/cas/parsingrules/180_char_based_superscripts.filter.php b/stack/cas/parsingrules/180_char_based_superscripts.filter.php index d4c5fc0aa70..70518416419 100644 --- a/stack/cas/parsingrules/180_char_based_superscripts.filter.php +++ b/stack/cas/parsingrules/180_char_based_superscripts.filter.php @@ -27,6 +27,7 @@ class stack_ast_filter_180_char_based_superscripts implements stack_cas_astfilte public static $ssmap = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { if (self::$ssmap === null) { self::$ssmap = json_decode(file_get_contents(__DIR__ . '/../../maximaparser/unicode/superscript-stack.json'), true); diff --git a/stack/cas/parsingrules/201_sig_figs_validation.filter.php b/stack/cas/parsingrules/201_sig_figs_validation.filter.php index 694fb172eed..2a15fd1a50c 100644 --- a/stack/cas/parsingrules/201_sig_figs_validation.filter.php +++ b/stack/cas/parsingrules/201_sig_figs_validation.filter.php @@ -31,12 +31,14 @@ class stack_ast_filter_201_sig_figs_validation implements stack_cas_astfilter_pa private $max = 3; private $strict = false; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { $this->min = $parameters['min']; $this->max = $parameters['max']; $this->strict = $parameters['strict']; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $root = $ast; if ($root instanceof MP_Root) { diff --git a/stack/cas/parsingrules/202_decimal_places_validation.filter.php b/stack/cas/parsingrules/202_decimal_places_validation.filter.php index c243e6a0a8f..98a0b6d28a4 100644 --- a/stack/cas/parsingrules/202_decimal_places_validation.filter.php +++ b/stack/cas/parsingrules/202_decimal_places_validation.filter.php @@ -30,11 +30,13 @@ class stack_ast_filter_202_decimal_places_validation implements stack_cas_astfil private $min = 3; private $max = 3; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { $this->min = $parameters['min']; $this->max = $parameters['max']; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $root = $ast; if ($root instanceof MP_Root) { diff --git a/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php b/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php index 87bdda4deb7..535550007b1 100644 --- a/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php +++ b/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php @@ -26,6 +26,7 @@ */ class stack_ast_filter_210_x_used_as_multiplication implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$answernotes, &$errors) { diff --git a/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php b/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php index 5f2dea98985..7043bc131c4 100644 --- a/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php +++ b/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php @@ -29,6 +29,7 @@ */ class stack_ast_filter_402_split_prefix_from_common_function_name implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $known = stack_cas_security::get_protected_identifiers('function', $identifierrules->get_units()); diff --git a/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php b/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php index 3280f4b96fd..8a69514af19 100644 --- a/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php +++ b/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php @@ -26,6 +26,7 @@ */ class stack_ast_filter_403_split_at_number_letter_boundary implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$answernotes) { diff --git a/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php b/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php index a5992a1575d..5b9185c784a 100644 --- a/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php +++ b/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php @@ -28,6 +28,7 @@ */ class stack_ast_filter_404_split_at_number_letter_number_boundary implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$answernotes) { diff --git a/stack/cas/parsingrules/406_split_implied_variable_names.filter.php b/stack/cas/parsingrules/406_split_implied_variable_names.filter.php index 6bc939596c6..43ff7650e8f 100644 --- a/stack/cas/parsingrules/406_split_implied_variable_names.filter.php +++ b/stack/cas/parsingrules/406_split_implied_variable_names.filter.php @@ -29,6 +29,7 @@ */ class stack_ast_filter_406_split_implied_variable_names implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $usage = maxima_parser_utils::variable_usage_finder($ast); diff --git a/stack/cas/parsingrules/410_single_char_vars.filter.php b/stack/cas/parsingrules/410_single_char_vars.filter.php index 16fa53a426a..32186c82679 100644 --- a/stack/cas/parsingrules/410_single_char_vars.filter.php +++ b/stack/cas/parsingrules/410_single_char_vars.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_410_single_char_vars implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { // TO-DO: do we maybe want to use the allowed words here also? diff --git a/stack/cas/parsingrules/420_consolidate_subscripts.filter.php b/stack/cas/parsingrules/420_consolidate_subscripts.filter.php index 36301cbdf51..4262e16b023 100644 --- a/stack/cas/parsingrules/420_consolidate_subscripts.filter.php +++ b/stack/cas/parsingrules/420_consolidate_subscripts.filter.php @@ -26,6 +26,7 @@ */ class stack_ast_filter_420_consolidate_subscripts implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $protected = stack_cas_security::get_protected_identifiers('variable', $identifierrules->get_units()); diff --git a/stack/cas/parsingrules/441_split_unknown_functions.filter.php b/stack/cas/parsingrules/441_split_unknown_functions.filter.php index 5d6a5e935fc..08143f0972e 100644 --- a/stack/cas/parsingrules/441_split_unknown_functions.filter.php +++ b/stack/cas/parsingrules/441_split_unknown_functions.filter.php @@ -47,6 +47,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '542_no_functions_at_all' || $otherfiltername === '442_split_all_functions') { diff --git a/stack/cas/parsingrules/442_split_all_functions.filter.php b/stack/cas/parsingrules/442_split_all_functions.filter.php index 34299a44979..fe9cda44c59 100644 --- a/stack/cas/parsingrules/442_split_all_functions.filter.php +++ b/stack/cas/parsingrules/442_split_all_functions.filter.php @@ -42,6 +42,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '542_no_functions_at_all' || $otherfiltername === '541_no_unknown_functions' || diff --git a/stack/cas/parsingrules/450_split_floats.filter.php b/stack/cas/parsingrules/450_split_floats.filter.php index 1136aa73bb5..1e661036f2b 100644 --- a/stack/cas/parsingrules/450_split_floats.filter.php +++ b/stack/cas/parsingrules/450_split_floats.filter.php @@ -85,6 +85,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '101_no_floats') { return true; diff --git a/stack/cas/parsingrules/502_replace_pm.filter.php b/stack/cas/parsingrules/502_replace_pm.filter.php index 5d2e3292c04..eae940f1c88 100644 --- a/stack/cas/parsingrules/502_replace_pm.filter.php +++ b/stack/cas/parsingrules/502_replace_pm.filter.php @@ -22,6 +22,7 @@ */ class stack_ast_filter_502_replace_pm implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) { diff --git a/stack/cas/parsingrules/504_insert_tuples_for_groups.php b/stack/cas/parsingrules/504_insert_tuples_for_groups.php index 5e326c8f58f..d0bd8c8d8e5 100644 --- a/stack/cas/parsingrules/504_insert_tuples_for_groups.php +++ b/stack/cas/parsingrules/504_insert_tuples_for_groups.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_504_insert_tuples_for_groups implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $insettuples = function($node) use (&$answernotes, &$errors) { diff --git a/stack/cas/parsingrules/541_no_unknown_functions.filter.php b/stack/cas/parsingrules/541_no_unknown_functions.filter.php index 158c6e28e0d..2941eabf265 100644 --- a/stack/cas/parsingrules/541_no_unknown_functions.filter.php +++ b/stack/cas/parsingrules/541_no_unknown_functions.filter.php @@ -56,6 +56,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '442_split_all_functions' || $otherfiltername === '441_split_unknown_functions') { diff --git a/stack/cas/parsingrules/542_no_functions_at_all.filter.php b/stack/cas/parsingrules/542_no_functions_at_all.filter.php index 92f92720d06..320ebc3efad 100644 --- a/stack/cas/parsingrules/542_no_functions_at_all.filter.php +++ b/stack/cas/parsingrules/542_no_functions_at_all.filter.php @@ -52,6 +52,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '442_split_all_functions' || $otherfiltername === '441_split_unknown_functions') { diff --git a/stack/cas/parsingrules/601_castext.filter.php b/stack/cas/parsingrules/601_castext.filter.php index 9903bfe90c8..93f4a547f0d 100644 --- a/stack/cas/parsingrules/601_castext.filter.php +++ b/stack/cas/parsingrules/601_castext.filter.php @@ -28,6 +28,7 @@ class stack_ast_filter_601_castext implements stack_cas_astfilter_parametric { private $context = 'unknown'; private $errclass = 'stack_cas_error'; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { if (isset($parameters['context'])) { $this->context = $parameters['context']; @@ -37,6 +38,7 @@ public function set_filter_parameters(array $parameters) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $ctx = $this->context; $errclass = $this->errclass; diff --git a/stack/cas/parsingrules/602_castext_simplifier.filter.php b/stack/cas/parsingrules/602_castext_simplifier.filter.php index 47f865a89f4..5360e0fe0f9 100644 --- a/stack/cas/parsingrules/602_castext_simplifier.filter.php +++ b/stack/cas/parsingrules/602_castext_simplifier.filter.php @@ -38,6 +38,7 @@ private static function is_castext($node) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) use (&$answernotes, &$errors) { if (isset($node->position['castext']) && $node->position['castext']) { diff --git a/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php b/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php index be14c8bde41..ebfe58c92d6 100644 --- a/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php +++ b/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php @@ -26,10 +26,12 @@ class stack_ast_filter_610_castext_static_string_extractor implements stack_cas_ // A reference to the extractor. private $extractor = false; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { $this->extractor = isset($parameters['static string extractor']) ? $parameters['static string extractor'] : null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { // Simply nothing to do if we have nowhere to place those strings. diff --git a/stack/cas/parsingrules/680_gcl_sconcat.filter.php b/stack/cas/parsingrules/680_gcl_sconcat.filter.php index 11a5219334d..4e174c26d94 100644 --- a/stack/cas/parsingrules/680_gcl_sconcat.filter.php +++ b/stack/cas/parsingrules/680_gcl_sconcat.filter.php @@ -27,6 +27,7 @@ */ class stack_ast_filter_680_gcl_sconcat implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $simplode = function($node) use (&$answernotes, &$errors) { if ($node instanceof MP_Functioncall) { diff --git a/stack/cas/parsingrules/801_singleton_numeric.filter.php b/stack/cas/parsingrules/801_singleton_numeric.filter.php index 8fa4502e826..ff3a8f96280 100644 --- a/stack/cas/parsingrules/801_singleton_numeric.filter.php +++ b/stack/cas/parsingrules/801_singleton_numeric.filter.php @@ -43,6 +43,7 @@ class stack_ast_filter_801_singleton_numeric implements stack_cas_astfilter_para // Will not convert raw integers to floats. private $convert = 'none'; // Other options are 'to float', 'to power'. + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { $this->integer = $parameters['integer']; $this->float = $parameters['float']; @@ -50,6 +51,7 @@ public function set_filter_parameters(array $parameters) { $this->convert = $parameters['convert']; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { // First unpack the $ast. @@ -276,6 +278,7 @@ private function acceptable_forms(): string { return implode(', ', $r); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function float_to_power(MP_Float $float): MP_Node { $raw = strtolower($float->raw); $p = 0; diff --git a/stack/cas/parsingrules/802_singleton_units.filter.php b/stack/cas/parsingrules/802_singleton_units.filter.php index 27d0d113842..6b9b3d4b923 100644 --- a/stack/cas/parsingrules/802_singleton_units.filter.php +++ b/stack/cas/parsingrules/802_singleton_units.filter.php @@ -53,6 +53,7 @@ class stack_ast_filter_802_singleton_units implements stack_cas_astfilter_parame private $mandatoryunit = true; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { if (isset($parameters['allowvariables'])) { $this->allowvariables = $parameters['allowvariables']; @@ -68,6 +69,7 @@ public function set_filter_parameters(array $parameters) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $ops = []; diff --git a/stack/cas/parsingrules/901_remove_comments.filter.php b/stack/cas/parsingrules/901_remove_comments.filter.php index 4c82491446e..313a64584cc 100644 --- a/stack/cas/parsingrules/901_remove_comments.filter.php +++ b/stack/cas/parsingrules/901_remove_comments.filter.php @@ -22,6 +22,7 @@ */ class stack_ast_filter_901_remove_comments implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) { diff --git a/stack/cas/parsingrules/910_inert_float_for_display.filter.php b/stack/cas/parsingrules/910_inert_float_for_display.filter.php index b6413e654eb..89dd701644c 100644 --- a/stack/cas/parsingrules/910_inert_float_for_display.filter.php +++ b/stack/cas/parsingrules/910_inert_float_for_display.filter.php @@ -35,6 +35,7 @@ */ class stack_ast_filter_910_inert_float_for_display implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $floats = function($node) use (&$answernotes, &$errors) { if ($node instanceof MP_Float) { diff --git a/stack/cas/parsingrules/990_no_fixing_spaces.filter.php b/stack/cas/parsingrules/990_no_fixing_spaces.filter.php index 37b57ef8d22..20aaefda76d 100644 --- a/stack/cas/parsingrules/990_no_fixing_spaces.filter.php +++ b/stack/cas/parsingrules/990_no_fixing_spaces.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_990_no_fixing_spaces implements stack_cas_astfilter_exclusion { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $spaces = false; @@ -52,6 +53,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '999_strict') { return true; diff --git a/stack/cas/parsingrules/991_no_fixing_stars.filter.php b/stack/cas/parsingrules/991_no_fixing_stars.filter.php index 0399ed5e012..c821c50bfb0 100644 --- a/stack/cas/parsingrules/991_no_fixing_stars.filter.php +++ b/stack/cas/parsingrules/991_no_fixing_stars.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_991_no_fixing_stars implements stack_cas_astfilter_exclusion { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $stars = false; @@ -53,6 +54,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '999_strict') { return true; diff --git a/stack/cas/parsingrules/995_ev_modification.filter.php b/stack/cas/parsingrules/995_ev_modification.filter.php index 34f73cc4b51..b74fc52b717 100644 --- a/stack/cas/parsingrules/995_ev_modification.filter.php +++ b/stack/cas/parsingrules/995_ev_modification.filter.php @@ -28,10 +28,12 @@ class stack_ast_filter_995_ev_modification implements stack_cas_astfilter_parame // Whether to rewrite evaluation flags. Don't do for students. private $flags = false; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { $this->flags = isset($parameters['flags']) ? $parameters['flags'] : false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) { diff --git a/stack/cas/parsingrules/996_call_modification.filter.php b/stack/cas/parsingrules/996_call_modification.filter.php index 83c5d6fc3e8..e2413ad6b59 100644 --- a/stack/cas/parsingrules/996_call_modification.filter.php +++ b/stack/cas/parsingrules/996_call_modification.filter.php @@ -28,6 +28,7 @@ class stack_ast_filter_996_call_modification implements stack_cas_astfilter { // The name of the function that checks expressions. const EXPCHECK = '%_E'; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $mapfuns = stack_cas_security::get_all_with_feature('mapfunction'); diff --git a/stack/cas/parsingrules/997_string_security.filter.php b/stack/cas/parsingrules/997_string_security.filter.php index b1b93e7c653..c3032e40cea 100644 --- a/stack/cas/parsingrules/997_string_security.filter.php +++ b/stack/cas/parsingrules/997_string_security.filter.php @@ -27,6 +27,7 @@ */ class stack_ast_filter_997_string_security implements stack_cas_astfilter { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $process = function($node) { diff --git a/stack/cas/parsingrules/998_security.filter.php b/stack/cas/parsingrules/998_security.filter.php index c5cf34bd817..f1bf4f28b65 100644 --- a/stack/cas/parsingrules/998_security.filter.php +++ b/stack/cas/parsingrules/998_security.filter.php @@ -24,10 +24,12 @@ class stack_ast_filter_998_security implements stack_cas_astfilter_parametric { private $source = 's'; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_filter_parameters(array $parameters) { $this->source = isset($parameters['security']) ? $parameters['security'] : 's'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $valid = true; diff --git a/stack/cas/parsingrules/999_strict.filter.php b/stack/cas/parsingrules/999_strict.filter.php index 21d04e5caba..a7672f473c6 100644 --- a/stack/cas/parsingrules/999_strict.filter.php +++ b/stack/cas/parsingrules/999_strict.filter.php @@ -23,6 +23,7 @@ */ class stack_ast_filter_999_strict implements stack_cas_astfilter_exclusion { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $spaces = false; @@ -70,6 +71,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_ return $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function conflicts_with(string $otherfiltername): bool { if ($otherfiltername === '990_no_fixing_spaces' || $otherfiltername === '991_no_fixing_stars') { diff --git a/stack/cas/parsingrules/pipeline.class.php b/stack/cas/parsingrules/pipeline.class.php index 965233967af..bbee15c827e 100644 --- a/stack/cas/parsingrules/pipeline.class.php +++ b/stack/cas/parsingrules/pipeline.class.php @@ -25,10 +25,12 @@ class stack_ast_filter_pipeline implements stack_cas_astfilter { private $filters = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($filtersinorder) { $this->filters = $filtersinorder; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { $filtered = $ast; foreach ($this->filters as $filter) { diff --git a/stack/cas/secure_loader.class.php b/stack/cas/secure_loader.class.php index d218b2e480f..c9a356b4781 100644 --- a/stack/cas/secure_loader.class.php +++ b/stack/cas/secure_loader.class.php @@ -36,6 +36,7 @@ class stack_secure_loader implements cas_evaluatable { private $context; private $blockexternal; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct(string $securedcode, string $fromwhere = '', string $blockexternal = '') { if ($securedcode === null) { throw new stack_exception('secure_loader: the code must not be null.'); @@ -52,24 +53,29 @@ public function __construct(string $securedcode, string $fromwhere = '', string } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { // This code has been validated elsewhere. return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { return $this->code; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_status(array $errors, array $answernotes, array $feedback) { // Note that secure_loader content does not care about feedback or notes. $this->errors = $errors; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_source_context(): string { return $this->context; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_errors($raw = 'implode') { if ($raw === 'objects') { return $this->errors; @@ -85,10 +91,12 @@ public function get_errors($raw = 'implode') { return $errors; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_key(): string { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_blockexternal(): bool { return $this->blockexternal; } @@ -97,10 +105,12 @@ public function get_blockexternal(): bool { class stack_secure_loader_value extends stack_secure_loader implements cas_value_extractor { private $value; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_evaluated_value(MP_Node $ast) { $this->value = $ast; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_value() { return $this->value; } diff --git a/stack/graphlayout/graph.php b/stack/graphlayout/graph.php index fe6e3a32678..7e20470d585 100644 --- a/stack/graphlayout/graph.php +++ b/stack/graphlayout/graph.php @@ -102,6 +102,7 @@ public function add_prt_node($name, $description, $leftchild, $rightchild, $left $leftlabel, $rightlabel, $url); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_prt_text($name, $casstatement, $quiet, $truenote, $falsenote) { if ($this->nodes[$name] instanceof stack_prt_graph_node) { $this->nodes[$name]->add_prt_text($casstatement, $quiet, $truenote, $falsenote); @@ -110,6 +111,7 @@ public function add_prt_text($name, $casstatement, $quiet, $truenote, $falsenote } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remove_node($nametodelete) { foreach ($this->nodes as $name => $node) { if ($name == $nametodelete) { @@ -488,6 +490,7 @@ protected function suggested_names_worker(array $alreadynamed, } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __toString() { $string = ''; foreach ($this->nodesbydepth as $depth => $nodes) { diff --git a/stack/graphlayout/graphnode.php b/stack/graphlayout/graphnode.php index 174a529350a..14dba3b4890 100644 --- a/stack/graphlayout/graphnode.php +++ b/stack/graphlayout/graphnode.php @@ -86,6 +86,7 @@ public function __construct($name, $description, $left, $right, $leftlabel = '', $this->url = $url; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __toString() { return '[' . $this->name . ' (' . $this->x . ', ' . $this->depth . '): -> ' . $this->left . ', -> ' . $this->right . ']'; } diff --git a/stack/input/algebraic/algebraic.class.php b/stack/input/algebraic/algebraic.class.php index af8dd099300..363b84eb4b6 100644 --- a/stack/input/algebraic/algebraic.class.php +++ b/stack/input/algebraic/algebraic.class.php @@ -37,6 +37,7 @@ class stack_algebraic_input extends stack_input { 'monospace' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -92,6 +93,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::empty_tag('input', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -108,6 +110,7 @@ public function render_api_data($tavalue) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); diff --git a/stack/input/boolean/boolean.class.php b/stack/input/boolean/boolean.class.php index a8db68603e3..b20444b5bd2 100644 --- a/stack/input/boolean/boolean.class.php +++ b/stack/input/boolean/boolean.class.php @@ -34,6 +34,7 @@ public static function get_choices() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function extra_validation($contents) { $validation = $contents[0]; if ($validation === 'EMPTYANSWER') { @@ -45,6 +46,7 @@ protected function extra_validation($contents) { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { return $this->render_error($this->errors); @@ -67,6 +69,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue $value, '', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -80,6 +83,7 @@ public function render_api_data($tavalue) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name); $mform->setType($this->name, PARAM_RAW); diff --git a/stack/input/checkbox/checkbox.class.php b/stack/input/checkbox/checkbox.class.php index 27f4b336fc1..dea95e7e989 100644 --- a/stack/input/checkbox/checkbox.class.php +++ b/stack/input/checkbox/checkbox.class.php @@ -60,6 +60,7 @@ public function contents_to_maxima($contents) { return '['.implode(',', $vals).']'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { return $this->render_error($this->errors); @@ -106,6 +107,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return $result; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -163,6 +165,7 @@ public function maxima_to_response_array($in) { return $response; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function ajax_to_response_array($in) { if (((string) $in) === '') { return []; @@ -220,6 +223,7 @@ protected function is_blank_response($contents) { return $allblank; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution($tavalue) { $solution = []; foreach ($this->ddlvalues as $key => $value) { diff --git a/stack/input/dropdown/dropdown.class.php b/stack/input/dropdown/dropdown.class.php index f41fe69ff6f..a193be890d6 100644 --- a/stack/input/dropdown/dropdown.class.php +++ b/stack/input/dropdown/dropdown.class.php @@ -68,6 +68,7 @@ class stack_dropdown_input extends stack_input { */ protected $teacheranswerdisplay = ''; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function internal_construct() { $options = $this->get_parameter('options'); if ($options != null && trim($options) != '') { @@ -380,6 +381,7 @@ private function key_order($values) { return $values; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function extra_validation($contents) { if (!array_key_exists($contents[0], $this->get_choices())) { return stack_string('dropdowngotunrecognisedvalue'); @@ -387,6 +389,7 @@ protected function extra_validation($contents) { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function validate_contents($contents, $basesecurity, $localoptions) { $valid = true; $errors = $this->errors; @@ -442,6 +445,7 @@ protected function get_choices() { return $choices; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -480,6 +484,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return $result; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -508,6 +513,7 @@ public function get_expected_data() { return $expected; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name); $mform->setDefault($this->name, ''); @@ -647,6 +653,7 @@ protected function get_input_ddl_value($key) { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function get_input_ddl_key($value) { foreach ($this->ddlvalues as $key => $val) { if ($val['value'] == $value) { @@ -658,6 +665,7 @@ protected function get_input_ddl_key($value) { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution($tavalue) { $solution = ""; foreach ($this->ddlvalues as $key => $value) { diff --git a/stack/input/equiv/equiv.class.php b/stack/input/equiv/equiv.class.php index ae9cbc6ba41..411fc50e940 100644 --- a/stack/input/equiv/equiv.class.php +++ b/stack/input/equiv/equiv.class.php @@ -57,6 +57,7 @@ class stack_equiv_input extends stack_input { 'checkvars' => 0, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { // Note that at the moment, $this->boxHeight and $this->boxWidth are only // used as minimums. If the current input is bigger, the box is expanded. @@ -132,6 +133,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return $output; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -163,6 +165,7 @@ public function render_api_data($tavalue) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); @@ -195,6 +198,7 @@ protected function response_to_contents($response) { return $contents; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function caslines_to_answer($caslines, $secrules = false) { $vals = []; // We don't use full "inputform" here as we need to keep stacklet and stackeq as is. @@ -458,6 +462,7 @@ protected function additional_session_variables($caslines, $teacheranswer) { return ['calculus' => $ca, 'equivdisplay' => $an, 'equivfirstline' => $fl]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function get_validation_method() { return 'equiv'; } @@ -574,12 +579,14 @@ public function render_validation(stack_input_state $state, $fieldname, $lang) { return $feedback; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function ajax_to_response_array($in) { $in = explode('
', $in); $in = implode("\n", $in); return [$this->name => $in]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution($tavalue) { return ['' => $this->maxima_to_raw_input($tavalue)]; } diff --git a/stack/input/geogebra/geogebra.class.php b/stack/input/geogebra/geogebra.class.php index 73619d3ab06..21080ef81d0 100644 --- a/stack/input/geogebra/geogebra.class.php +++ b/stack/input/geogebra/geogebra.class.php @@ -34,6 +34,7 @@ class stack_geogebra_input extends stack_input { 'checkvars' => 0, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -86,11 +87,13 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::empty_tag('input', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { // Dummy function to allow code to run. GeoGebra not currently functional in API. throw new stack_exception("Usage of geogebra is currently not supported."); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); diff --git a/stack/input/inputbase.class.php b/stack/input/inputbase.class.php index 71e7c6cb3e7..3e8dc7ef2be 100644 --- a/stack/input/inputbase.class.php +++ b/stack/input/inputbase.class.php @@ -1384,6 +1384,7 @@ protected function validation_display($answer, $lvars, $caslines, $additionalvar return [$valid, $errors, $display]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function requires_validation() { return $this->get_parameter('mustVerify', true); } diff --git a/stack/input/inputstate.class.php b/stack/input/inputstate.class.php index 4e232f83f22..020f9fcb4e9 100644 --- a/stack/input/inputstate.class.php +++ b/stack/input/inputstate.class.php @@ -101,6 +101,7 @@ public function __construct($status, $contents, $contentsmodified, $contentsdisp $this->_simp = $simp; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __get($field) { switch ($field) { case 'status': diff --git a/stack/input/matrix/matrix.class.php b/stack/input/matrix/matrix.class.php index a0522dc44ec..bd72b760a36 100644 --- a/stack/input/matrix/matrix.class.php +++ b/stack/input/matrix/matrix.class.php @@ -36,6 +36,7 @@ class stack_matrix_input extends stack_input { 'feedback' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function adapt_to_model_answer($teacheranswer) { // Work out how big the matrix should be from the INSTANTIATED VALUE of the teacher's answer. @@ -54,6 +55,7 @@ public function adapt_to_model_answer($teacheranswer) { $this->width = $cs->get_list_element(1, true)->value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_expected_data() { $expected = []; @@ -135,6 +137,7 @@ public function response_to_contents($response) { return $matrix; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function contents_to_maxima($contents) { $matrix = []; foreach ($contents as $row) { @@ -250,6 +253,7 @@ protected function validate_contents($contents, $basesecurity, $localoptions) { return [$valid, $errors, $notes, $answer, $caslines, $inertform, $caslines]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -340,6 +344,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return $xhtml; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -402,6 +407,7 @@ public function maxima_to_response_array($in) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); @@ -443,6 +449,7 @@ public function internal_validate_parameter($parameter, $value) { return $valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_correct_response($value) { if (trim($value) == 'EMPTYANSWER' || $value === null) { diff --git a/stack/input/notes/notes.class.php b/stack/input/notes/notes.class.php index 63b39dc006b..33f4d0b7b51 100644 --- a/stack/input/notes/notes.class.php +++ b/stack/input/notes/notes.class.php @@ -33,6 +33,7 @@ class stack_notes_input extends stack_input { 'manualgraded' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { return $this->render_error($this->errors); @@ -72,6 +73,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue html_writer::tag('div', "", ['class' => 'clearfix']); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -105,6 +107,7 @@ protected function validate_contents($contents, $basesecurity, $localoptions) { return [$valid, $errors, $notes, $answer, $caslines, $answer, []]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); @@ -214,6 +217,7 @@ public function render_validation(stack_input_state $state, $fieldname, $lang) { return format_text(stack_maths::process_display_castext($render)); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function summarise_response($name, $state, $response) { // Output the value for reporting. $val = ''; @@ -223,14 +227,17 @@ public function summarise_response($name, $state, $response) { return $name . ': ' . $val . ' [' . $state->status . ']'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution($tavalue) { return new stdClass(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution_render($tadisplay) { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function ajax_to_response_array($in) { // ISS1317 EJMF - Notes are treated the same as textareas on the front end so // we need to add this to match the textarea input and avoid diff --git a/stack/input/numerical/numerical.class.php b/stack/input/numerical/numerical.class.php index d52d42f0cc7..b4b447fd49d 100644 --- a/stack/input/numerical/numerical.class.php +++ b/stack/input/numerical/numerical.class.php @@ -53,6 +53,7 @@ class stack_numerical_input extends stack_input { 'monospace' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -108,6 +109,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::empty_tag('input', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -124,6 +126,7 @@ public function render_api_data($tavalue) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); diff --git a/stack/input/parsons/parsons.class.php b/stack/input/parsons/parsons.class.php index dcfde5eb350..499a622c049 100644 --- a/stack/input/parsons/parsons.class.php +++ b/stack/input/parsons/parsons.class.php @@ -77,6 +77,7 @@ private static function answer_function_testcase($ta) { protected $protectfilters = ['909_parsons_decode_state_for_display', '910_inert_float_for_display', '912_inert_string_for_display', ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { // This is the same as `string` input render except we hide the input box. diff --git a/stack/input/radio/radio.class.php b/stack/input/radio/radio.class.php index 215464fb6cb..ccade811abf 100644 --- a/stack/input/radio/radio.class.php +++ b/stack/input/radio/radio.class.php @@ -35,6 +35,7 @@ class stack_radio_input extends stack_dropdown_input { */ protected $ddldisplay = 'LaTeX'; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { return $this->render_error($this->errors); @@ -88,6 +89,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return $result; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); diff --git a/stack/input/singlechar/singlechar.class.php b/stack/input/singlechar/singlechar.class.php index 65f5eb32b28..18de51c145a 100644 --- a/stack/input/singlechar/singlechar.class.php +++ b/stack/input/singlechar/singlechar.class.php @@ -31,6 +31,7 @@ class stack_singlechar_input extends stack_input { 'feedback' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -58,6 +59,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::empty_tag('input', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -70,6 +72,7 @@ public function render_api_data($tavalue) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function extra_validation($contents) { if (strlen($contents[0]) > 1) { return stack_string('singlechargotmorethanone'); @@ -77,6 +80,7 @@ protected function extra_validation($contents) { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name); $mform->setType($this->name, PARAM_RAW); diff --git a/stack/input/string/string.class.php b/stack/input/string/string.class.php index a91379fee27..f9855fc1931 100644 --- a/stack/input/string/string.class.php +++ b/stack/input/string/string.class.php @@ -39,6 +39,7 @@ class stack_string_input extends stack_algebraic_input { */ protected $maxinputlength = 262144; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -78,6 +79,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::empty_tag('input', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -181,6 +183,7 @@ public function contents_to_maxima($contents) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function ensure_string($ex) { $ex = trim($ex); if (substr($ex, 0, 1) !== '"') { @@ -189,6 +192,7 @@ public function ensure_string($ex) { return $ex; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution_render($tadisplay) { return stack_utils::maxima_string_strip_mbox($tadisplay); } diff --git a/stack/input/textarea/textarea.class.php b/stack/input/textarea/textarea.class.php index 3936e4eee27..134a608807e 100644 --- a/stack/input/textarea/textarea.class.php +++ b/stack/input/textarea/textarea.class.php @@ -37,6 +37,7 @@ class stack_textarea_input extends stack_input { 'consolidatesubscripts' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { // Note that at the moment, $this->boxHeight and $this->boxWidth are only // used as minimums. If the current input is bigger, the box is expanded. @@ -90,6 +91,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::tag('textarea', htmlspecialchars($current, ENT_COMPAT), $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -104,6 +106,7 @@ public function render_api_data($tavalue) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); @@ -136,6 +139,7 @@ protected function response_to_contents($response) { return $contents; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function caslines_to_answer($caslines, $secrules = false) { $vals = []; // We don't use full "inputform" here as we need to keep stacklet and stackeq as is. @@ -192,6 +196,7 @@ protected function maxima_to_raw_input($in) { return implode("\n", $values); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function ajax_to_response_array($in) { $in = explode('
', $in); $in = implode("\n", $in); @@ -337,6 +342,7 @@ public function get_teacher_answer_display($value, $display) { return stack_string('teacheranswershow', ['value' => $value, 'display' => $display]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution($tavalue) { $values = stack_utils::list_to_array($tavalue, false); foreach ($values as $key => $val) { diff --git a/stack/input/units/units.class.php b/stack/input/units/units.class.php index 646065b00bd..680a6a1ac8f 100644 --- a/stack/input/units/units.class.php +++ b/stack/input/units/units.class.php @@ -47,6 +47,7 @@ class stack_units_input extends stack_input { ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { if ($this->errors) { @@ -101,6 +102,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::empty_tag('input', $attributes); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -119,6 +121,7 @@ public function render_api_data($tavalue) { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); diff --git a/stack/input/varmatrix/varmatrix.class.php b/stack/input/varmatrix/varmatrix.class.php index e24995e5252..a563ffbb0e3 100644 --- a/stack/input/varmatrix/varmatrix.class.php +++ b/stack/input/varmatrix/varmatrix.class.php @@ -35,6 +35,7 @@ class stack_varmatrix_input extends stack_input { 'monospace' => false, ]; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function is_blank_response($contents) { if ($contents == ['EMPTYANSWER']) { return true; @@ -50,6 +51,7 @@ protected function is_blank_response($contents) { return $allblank; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { // Note that at the moment, $this->boxHeight and $this->boxWidth are only // used as minimums. If the current input is bigger, the box is expanded. @@ -137,6 +139,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue return html_writer::tag('div', $xhtml, ['class' => $matrixbrackets]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function render_api_data($tavalue) { if ($this->errors) { throw new stack_exception("Error rendering input: " . implode(',', $this->errors)); @@ -164,6 +167,7 @@ public function render_api_data($tavalue) { return $data; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function add_to_moodleform_testinput(MoodleQuickForm $mform) { $mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]); $mform->setDefault($this->name, $this->parameters['syntaxHint']); @@ -211,6 +215,7 @@ protected function response_to_contents($response) { return $contents; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function caslines_to_answer($caslines, $secrules = false) { $vals = []; foreach ($caslines as $line) { @@ -352,6 +357,7 @@ private function maxima_to_raw_input($in) { return $cs->ast_to_string(null, $tostringparams); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_correct_response($value) { if (trim($value) == 'EMPTYANSWER' || $value === null) { @@ -382,6 +388,7 @@ public function get_correct_response($value) { return $this->maxima_to_response_array($value); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function ajax_to_response_array($in) { $in = explode('
', $in); $in = implode("\n", $in); @@ -440,6 +447,7 @@ public function internal_validate_parameter($parameter, $value) { return $valid; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_api_solution($tavalue) { // We clear the name, and then restore its original value, // to not include the prefix in the api solution. diff --git a/stack/mathsoutput/mathsoutputapi.class.php b/stack/mathsoutput/mathsoutputapi.class.php index de533ea07ca..d25712eb7da 100644 --- a/stack/mathsoutput/mathsoutputapi.class.php +++ b/stack/mathsoutput/mathsoutputapi.class.php @@ -27,6 +27,7 @@ */ class stack_maths_output_api extends stack_maths_output_filter_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function initialise_delimiters() { $this->displaywrapstart = ''; $this->displaywrapend = ''; @@ -39,10 +40,12 @@ protected function make_filter() { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function process_lang_string($string) { return $string; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null) { if ($replacedollars) { $text = $this->replace_dollars($text); diff --git a/stack/mathsoutput/mathsoutputfilterbase.class.php b/stack/mathsoutput/mathsoutputfilterbase.class.php index 260c424f64e..ee68dd96aaa 100644 --- a/stack/mathsoutput/mathsoutputfilterbase.class.php +++ b/stack/mathsoutput/mathsoutputfilterbase.class.php @@ -39,6 +39,7 @@ public function __construct() { $this->initialise_delimiters(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function process_lang_string($string) { $string = $this->find_and_render_equations($string); $string = str_replace('!ploturl!', @@ -46,6 +47,7 @@ public function process_lang_string($string) { return $string; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function post_process_docs_page($html) { $html = parent::post_process_docs_page($html); $html = str_replace('\', '\\', $html); @@ -53,6 +55,7 @@ public function post_process_docs_page($html) { return $html; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null) { $text = parent::process_display_castext($text, $replacedollars, $renderer); $text = $this->find_equations_and_replace_delimiters($text); diff --git a/stack/mathsoutput/mathsoutputmathjax.class.php b/stack/mathsoutput/mathsoutputmathjax.class.php index 95f23791d53..9101a4b5074 100644 --- a/stack/mathsoutput/mathsoutputmathjax.class.php +++ b/stack/mathsoutput/mathsoutputmathjax.class.php @@ -28,6 +28,7 @@ */ class stack_maths_output_mathjax extends stack_maths_output_filter_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function initialise_delimiters() { $this->displaywrapstart = ''; $this->displaywrapend = ''; @@ -37,6 +38,7 @@ protected function initialise_delimiters() { $this->inlineend = '\)'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_filter() { global $CFG, $PAGE; if (class_exists('\filter_mathjaxloader\text_filter')) { diff --git a/stack/mathsoutput/mathsoutputmaths.class.php b/stack/mathsoutput/mathsoutputmaths.class.php index 29304fa8514..6e2fa1800e2 100644 --- a/stack/mathsoutput/mathsoutputmaths.class.php +++ b/stack/mathsoutput/mathsoutputmaths.class.php @@ -38,6 +38,7 @@ public static function filter_is_installed() { return file_exists($CFG->dirroot . '/filter/maths/filter.php'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function initialise_delimiters() { $this->displaystart = '<tex mode="display">'; $this->displayend = '</tex>'; @@ -45,6 +46,7 @@ protected function initialise_delimiters() { $this->inlineend = '</tex>'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_filter() { global $CFG; diff --git a/stack/mathsoutput/mathsoutputoumaths.class.php b/stack/mathsoutput/mathsoutputoumaths.class.php index 3e17bc0c0ce..2410ceb0122 100644 --- a/stack/mathsoutput/mathsoutputoumaths.class.php +++ b/stack/mathsoutput/mathsoutputoumaths.class.php @@ -38,6 +38,7 @@ public static function filter_is_installed() { return file_exists($CFG->dirroot . '/filter/oumaths/filter.php'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function initialise_delimiters() { $this->displaystart = '<tex mode="display">'; $this->displayend = '</tex>'; @@ -45,6 +46,7 @@ protected function initialise_delimiters() { $this->inlineend = '</tex>'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_filter() { global $CFG; diff --git a/stack/mathsoutput/mathsoutputtex.class.php b/stack/mathsoutput/mathsoutputtex.class.php index 601cfa302fe..82ce70a3a80 100644 --- a/stack/mathsoutput/mathsoutputtex.class.php +++ b/stack/mathsoutput/mathsoutputtex.class.php @@ -28,6 +28,7 @@ */ class stack_maths_output_tex extends stack_maths_output_filter_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function initialise_delimiters() { $this->displaystart = '\[\displaystyle '; $this->displayend = '\]'; @@ -35,6 +36,7 @@ protected function initialise_delimiters() { $this->inlineend = '\]'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_filter() { global $CFG; if (class_exists('\filter_tex\text_filter')) { diff --git a/stack/maximaparser/MP_classes.php b/stack/maximaparser/MP_classes.php index 27a88f125d1..45e60346914 100644 --- a/stack/maximaparser/MP_classes.php +++ b/stack/maximaparser/MP_classes.php @@ -56,19 +56,23 @@ class MP_Node { // Parsers that comments within the statements may place them here. public $comments = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct() { $this->parentnode = null; $this->position = []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return []; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function hasChildren() { return count($this->getChildren()) > 0; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { return '[NO TOSTRING FOR ' . get_class($this) . ']'; } @@ -102,6 +106,7 @@ public function callbackRecurse($function = null, $skipinvalid = false) { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function asAList() { // This one recursively goes through the whole tree and returns a list of // all the nodes found, it also populates the parent details as those might @@ -122,6 +127,7 @@ public function replace($node, $with) { // Noop for most. } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function debugPrint($originalcode) { $r = [$originalcode]; if (!is_array($this->position) || !isset($this->position['start']) || ! @@ -183,6 +189,7 @@ public function remap_position_data(int $offset=0) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_invalid(): bool { if (isset($this->position['invalid']) && $this->position['invalid'] === true) { return true; @@ -227,6 +234,7 @@ public function get_operand_on_right() { } */ + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_operand_on_left() { // This will not unpack postfix terms so 5!+this => '5!' if ($this->parentnode === null) { @@ -246,6 +254,7 @@ public function get_operand_on_left() { return null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_operator_on_left() { // This will not unpack postfix terms so 5!+this => '+'. if ($this->parentnode === null) { @@ -389,6 +398,7 @@ class MP_Operation extends MP_Node { public $lhs = null; public $rhs = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($op, $lhs, $rhs) { parent::__construct(); $this->op = $op; @@ -396,6 +406,7 @@ public function __construct($op, $lhs, $rhs) { $this->rhs = $rhs; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->rhs = clone $this->rhs; $this->lhs = clone $this->lhs; @@ -403,10 +414,12 @@ public function __clone() { $this->lhs->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->lhs, $this->rhs]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $op = $this->op; @@ -496,6 +509,7 @@ public function toString($params = null): string { return $this->lhs->toString($params) . $op . $rhs; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $lhs = $this->lhs->toString(); $rhs = $this->rhs->toString(); @@ -532,6 +546,7 @@ public function operationOnRight() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function operationOnLeft() { if ($this->parentnode === null || !($this->parentnode instanceof MP_Operation || $this->parentnode instanceof MP_PrefixOp)) { @@ -565,6 +580,7 @@ public function operandOnRight() { return $i->leftmostofright(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function operandOnLeft() { if ($this->parentnode === null || !($this->parentnode instanceof MP_Operation || $this->parentnode instanceof MP_PrefixOp)) { @@ -585,6 +601,7 @@ public function operandOnLeft() { return $i->rightmostofleft(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function leftmostofright() { $i = $this->rhs; @@ -594,6 +611,7 @@ public function leftmostofright() { return $i; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function rightmostofleft() { $i = $this->lhs; @@ -607,17 +625,20 @@ public function rightmostofleft() { class MP_Atom extends MP_Node { public $value = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($value) { parent::__construct(); $this->value = $value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $value = $this->toString(); $this->position['start'] = $offset; $this->position['end'] = $offset + mb_strlen($value); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $op = $this->value; @@ -653,6 +674,7 @@ class MP_Integer extends MP_Atom { // values in which case the representation has more use. public $raw = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct( $value, $raw = null @@ -661,6 +683,7 @@ public function __construct( $this->raw = $raw; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { if ($params !== null && isset($params['flattree'])) { @@ -694,11 +717,13 @@ class MP_Float extends MP_Atom { // In certain cases we want to see the original form of the float. public $raw = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($value, $raw) { parent::__construct($value); $this->raw = $raw; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { if ($params !== null && isset($params['flattree'])) { @@ -738,6 +763,7 @@ public function toString($params = null): string { class MP_String extends MP_Atom { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $dispalue = '"' . str_replace('"', '\\"', str_replace('\\', '\\\\', $this->value)) . '"'; @@ -759,6 +785,7 @@ public function toString($params = null): string { class MP_Boolean extends MP_Atom { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { if ($params !== null && isset($params['flattree'])) { @@ -809,10 +836,12 @@ public function is_function_name(): bool { return false; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_variable_name(): bool { return !$this->is_function_name(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; $op = $this->value; @@ -844,6 +873,7 @@ public function toString($params = null): string { return $indent . $op; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_being_written_to(): bool { if ($this->is_function_name()) { return $this->parentnode->is_definition(); @@ -885,6 +915,7 @@ public function is_being_written_to(): bool { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_global(): bool { // This is expensive as we need to travel the whole parent-chain and do some paraller checks. $i = $this->parentnode; @@ -943,12 +974,14 @@ class MP_Annotation extends MP_Node { public $annotationtype = null; public $params = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($annotationtype, $params) { parent::__construct(); $this->annotationtype = $annotationtype; $this->params = $params; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->params !== null && count($this->params) > 0) { $i = 0; @@ -959,10 +992,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return $this->params; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $params = []; @@ -984,12 +1019,14 @@ class MP_Comment extends MP_Node { public $value = null; public $annotations = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($value, $annotations) { parent::__construct(); $this->value = $value; $this->annotations = $annotations; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->annotations !== null && count($this->annotations) > 0) { $i = 0; @@ -1000,10 +1037,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return $this->annotations; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $annotations = []; foreach ($this->annotations as $value) { @@ -1023,12 +1062,14 @@ class MP_FunctionCall extends MP_Node { public $name = null; public $arguments = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($name, $arguments) { parent::__construct(); $this->name = $name; $this->arguments = $arguments; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->name = clone $this->name; $this->name->parentnode = $this; @@ -1041,10 +1082,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return array_merge([$this->name], $this->arguments); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1057,6 +1100,7 @@ public function remap_position_data(int $offset=0) { $this->name->remap_position_data($offset); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $n = $this->name->toString($params); $sep = ','; @@ -1181,10 +1225,12 @@ public function is_definition(): bool { $this->parentnode->lhs === $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_call(): bool { return !$this->is_definition(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->name === $node) { $this->name = $with; @@ -1205,11 +1251,13 @@ public function replace($node, $with) { class MP_Group extends MP_Node { public $items = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($items) { parent::__construct(); $this->items = $items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->items !== null && count($this->items) > 0) { $i = 0; @@ -1220,10 +1268,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return $this->items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1235,6 +1285,7 @@ public function remap_position_data(int $offset=0) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function isSynthetic() { if (count($this->items) < 1 || !array_key_exists(0, $this->items)) { return false; @@ -1295,6 +1346,7 @@ public function toString($params = null): string { return '(' . implode(',', $ar) . ')'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($node === -1) { // Special case. Append a node to items. @@ -1313,11 +1365,13 @@ public function replace($node, $with) { class MP_Set extends MP_Node { public $items = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($items) { parent::__construct(); $this->items = $items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->items !== null && count($this->items) > 0) { $i = 0; @@ -1328,10 +1382,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return $this->items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1343,6 +1399,7 @@ public function remap_position_data(int $offset=0) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $sep = ','; if ($params !== null && isset($params['listsep'])) { @@ -1388,6 +1445,7 @@ public function toString($params = null): string { return '{' . implode($sep, $ar) . '}'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($node === -1) { // Special case. append a node to items. @@ -1406,11 +1464,13 @@ public function replace($node, $with) { class MP_List extends MP_Node { public $items = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($items) { parent::__construct(); $this->items = $items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->items !== null && count($this->items) > 0) { $i = 0; @@ -1421,10 +1481,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return $this->items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1436,6 +1498,7 @@ public function remap_position_data(int $offset=0) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $sep = ','; if ($params !== null && isset($params['listsep'])) { @@ -1491,6 +1554,7 @@ public function toString($params = null): string { return '[' . implode($sep, $ar) . ']'; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($node === -1) { // Special case. Append a node to items. @@ -1505,6 +1569,7 @@ public function replace($node, $with) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function insertChild(MP_Node $node, $before = null) { if ($before === null) { $this->replace(-1, $node); @@ -1514,6 +1579,7 @@ public function insertChild(MP_Node $node, $before = null) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function removeChild(MP_Node $node) { $i = array_search($node, $this->items, true); array_splice($this->items, $i, 1); @@ -1524,22 +1590,26 @@ class MP_PrefixOp extends MP_Node { public $op = '-'; public $rhs = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($op, $rhs) { parent::__construct(); $this->op = $op; $this->rhs = $rhs; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->rhs = clone $this->rhs; $this->rhs->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->rhs]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1547,6 +1617,7 @@ public function remap_position_data(int $offset=0) { $this->rhs->remap_position_data($offset + mb_strlen($this->op)); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; $op = $this->op; @@ -1612,6 +1683,7 @@ public function toString($params = null): string { return $op . $this->rhs->toString($params); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->rhs === $node) { $this->rhs = $with; @@ -1623,21 +1695,25 @@ class MP_PostfixOp extends MP_Node { public $op = '!'; public $lhs = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($op, $lhs) { parent::__construct(); $this->op = $op; $this->lhs = $lhs; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->lhs = clone $this->lhs; $this->lhs->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->lhs]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1646,6 +1722,7 @@ public function remap_position_data(int $offset=0) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; if ($params !== null && isset($params['pretty'])) { @@ -1663,6 +1740,7 @@ public function toString($params = null): string { return $this->lhs->toString($params) . $this->op; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->lhs === $node) { $this->lhs = $with; @@ -1681,6 +1759,7 @@ public function __construct($target, $indices) { $this->indices = $indices; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->target = clone $this->target; $this->target->parentnode = $this; @@ -1693,10 +1772,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return array_merge([$this->target], $this->indices); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1709,6 +1790,7 @@ public function remap_position_data(int $offset=0) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $r = $this->target->toString($params); @@ -1719,6 +1801,7 @@ public function toString($params = null): string { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->target === $node) { $this->target = $with; @@ -1736,6 +1819,7 @@ class MP_If extends MP_Node { public $conditions = null; public $branches = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($conditions, $branches) { parent::__construct(); $this->conditions = $conditions; @@ -1743,6 +1827,7 @@ public function __construct($conditions, $branches) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->conditions !== null && count($this->conditions) > 0) { $i = 0; @@ -1760,10 +1845,12 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return array_merge($this->conditions, $this->branches); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1771,6 +1858,7 @@ public function remap_position_data(int $offset=0) { // TO-DO: fill in this. } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; if ($params !== null && isset($params['pretty'])) { @@ -1817,6 +1905,7 @@ public function toString($params = null): string { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { foreach ($this->conditions as $key => $value) { @@ -1837,12 +1926,14 @@ class MP_Loop extends MP_Node { public $body = null; public $conf = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($body, $conf) { parent::__construct(); $this->body = $body; $this->conf = $conf; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->conf !== null && count($this->conf) > 0) { $i = 0; @@ -1855,10 +1946,12 @@ public function __clone() { $this->body->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return array_merge($this->conf, [$this->body]); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1866,6 +1959,7 @@ public function remap_position_data(int $offset=0) { // TO-DO: fill in this. } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { foreach ($this->conf as $key => $value) { @@ -1878,6 +1972,7 @@ public function replace($node, $with) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; if ($params !== null && isset($params['pretty'])) { @@ -1908,21 +2003,25 @@ class MP_LoopBit extends MP_Node { public $mode = null; public $param = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($mode, $param) { parent::__construct(); $this->mode = $mode; $this->param = $param; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->param = clone $this->param; $this->param->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->param]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1931,6 +2030,7 @@ public function remap_position_data(int $offset=0) { } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace( $node, $with @@ -1940,6 +2040,7 @@ public function replace( } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { return $this->mode . ' ' . $this->param->toString($params); } @@ -1949,12 +2050,14 @@ class MP_EvaluationFlag extends MP_Node { public $name = null; public $value = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($name, $value) { parent::__construct(); $this->name = $name; $this->value = $value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->name = clone $this->name; $this->name->parentnode = $this; @@ -1962,10 +2065,12 @@ public function __clone() { $this->value->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->name, $this->value]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -1974,10 +2079,12 @@ public function remap_position_data(int $offset=0) { $this->value->remap_position_data($offset + 2 + mb_strlen($this->name->toString())); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { return ',' . $this->name->toString($params) . '=' . $this->value->toString($params); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->name === $node) { $this->name = $with; @@ -1991,12 +2098,14 @@ class MP_Statement extends MP_Node { public $statement = null; public $flags = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($statement, $flags) { parent::__construct(); $this->statement = $statement; $this->flags = $flags; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->flags !== null && count($this->flags) > 0) { $i = 0; @@ -2009,10 +2118,12 @@ public function __clone() { $this->statement->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return array_merge([$this->statement], $this->flags); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -2025,6 +2136,7 @@ public function remap_position_data(int $offset=0) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $r = $this->statement->toString($params); @@ -2035,6 +2147,7 @@ public function toString($params = null): string { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { foreach ($this->flags as $key => $value) { @@ -2051,20 +2164,24 @@ public function replace($node, $with) { class MP_Prefixeq extends MP_Node { public $statement = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($statement) { parent::__construct(); $this->statement = $statement; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->statement = clone $this->statement; $this->statement->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->statement]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; if (isset($params['pretty']) && is_integer($params['pretty'])) { @@ -2079,6 +2196,7 @@ public function toString($params = null): string { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->statement === $node) { @@ -2090,20 +2208,24 @@ public function replace($node, $with) { class MP_Let extends MP_Node { public $statement = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($statement) { parent::__construct(); $this->statement = $statement; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { $this->statement = clone $this->statement; $this->statement->parentnode = $this; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return [$this->statement]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $indent = ''; if (isset($params['pretty']) && is_integer($params['pretty'])) { @@ -2125,6 +2247,7 @@ public function toString($params = null): string { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace($node, $with) { if ($this->statement === $node) { @@ -2136,11 +2259,13 @@ public function replace($node, $with) { class MP_Root extends MP_Node { public $items = null; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($items) { parent::__construct(); $this->items = $items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __clone() { if ($this->items !== null && count($this->items) > 0) { $i = 0; @@ -2151,15 +2276,18 @@ public function __clone() { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function getChildren() { return $this->items; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function removeChild(MP_Node $node) { $i = array_search($node, $this->items, true); array_splice($this->items, $i, 1); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function remap_position_data(int $offset=0) { $total = $this->toString(); $this->position['start'] = $offset; @@ -2171,6 +2299,7 @@ public function remap_position_data(int $offset=0) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function toString($params = null): string { $r = ''; @@ -2194,6 +2323,7 @@ public function toString($params = null): string { return $r; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function replace( $node, $with diff --git a/stack/options.class.php b/stack/options.class.php index 5e3b7cba72e..c10a6546c5a 100644 --- a/stack/options.class.php +++ b/stack/options.class.php @@ -26,6 +26,7 @@ class stack_options { private $options; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($settings = []) { // OptionType can be: boolean, string, html, list. @@ -142,6 +143,7 @@ public function __construct($settings = []) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_site_defaults() { $stackconfig = stack_utils::get_config(); // Display option does not match up to $stackconfig->mathsdisplay). @@ -183,6 +185,7 @@ private function validate_key($key, $val) { return true; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_option($key) { if (!array_key_exists($key, $this->options)) { throw new stack_exception('stack_options get_option: $key '.$key.' is not a valid option name.'); @@ -191,11 +194,13 @@ public function get_option($key) { } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_option($key, $val) { $this->validate_key($key, $val); // Throws an exception on error. $this->options[$key]['value'] = $val; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_cas_commands() { $names = ''; diff --git a/stack/potentialresponsetreestate.class.php b/stack/potentialresponsetreestate.class.php index 5c819e14fe7..c94b89fc5ff 100644 --- a/stack/potentialresponsetreestate.class.php +++ b/stack/potentialresponsetreestate.class.php @@ -115,6 +115,7 @@ public function __construct($weight, $valid = true, $score = null, $penalty = nu $this->_debuginfo = $debuginfo; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __get($field) { switch ($field) { case 'weight': @@ -272,6 +273,7 @@ class stack_prt_feedback_element { /** @var int node id (used as the file area item id). */ public $itemid; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($feedback, $format, $filearea, $itemid) { $this->feedback = $feedback; $this->format = $format; diff --git a/stack/prt.class.php b/stack/prt.class.php index f392be59b81..3dab6bc9560 100644 --- a/stack/prt.class.php +++ b/stack/prt.class.php @@ -72,6 +72,7 @@ class stack_potentialresponse_tree_lite { */ private $trace = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct($prtdata, $value, $question = null) { $this->name = $prtdata->name; $this->simplify = (bool) $prtdata->autosimplify; @@ -102,10 +103,12 @@ public function __construct($prtdata, $value, $question = null) { // Only for get_maxima_representation() and other debug details. } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_value() { return $this->value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_name() { return $this->name; } diff --git a/stack/prt.evaluatable.class.php b/stack/prt.evaluatable.class.php index 3c4a077f072..25a4c1b2aa4 100644 --- a/stack/prt.evaluatable.class.php +++ b/stack/prt.evaluatable.class.php @@ -71,6 +71,7 @@ class prt_evaluatable implements cas_raw_value_extractor { // Stores the human-readable trace created at compile time. private $trace = []; + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function __construct(string $signature, $weight, castext2_static_replacer $statics, $trace) { $this->signature = $signature; $this->weight = $weight; @@ -79,36 +80,44 @@ public function __construct(string $signature, $weight, castext2_static_replacer $this->trace = $trace; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_evaluated_value(string $value) { $this->evaluated = $value; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_valid(): bool { // We count only errors from nodes, and ignore feebdack variable errors. return count($this->get_errors()) === 0; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_evaluationform(): string { return $this->signature; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_cas_status(array $errors, array $answernotes, array $feedback) { $this->errors = $errors; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_source_context(): string { // Assume the signature has the PRT-name... and use it. return explode('(', substr($this->signature, 4))[0]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_key(): string { return ''; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function is_evaluated(): bool { return $this->evaluated !== null; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function override_feedback(string $feedback) { $this->renderedfeedback = $feedback; } @@ -145,6 +154,7 @@ private function unpack() { $this->notes = $value[4]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_score() { if ($this->score === null) { $this->unpack(); @@ -156,14 +166,17 @@ public function get_score() { return $this->score; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_fraction() { return $this->weight * $this->get_score(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_fractionalpenalty() { return $this->weight * $this->get_penalty(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_penalty() { if ($this->penalty === null) { $this->unpack(); @@ -180,6 +193,7 @@ public function get_penalty() { return $this->penalty; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_path() { if ($this->path === null) { $this->unpack(); @@ -187,6 +201,7 @@ public function get_path() { return $this->path; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_feedback($processor=null) { if (!$this->is_evaluated()) { // If not procesed return undefined or any overrides. @@ -221,6 +236,7 @@ public function get_feedback($processor=null) { return trim($this->renderedfeedback); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_answernotes() { if ($this->score === null) { $this->unpack(); @@ -253,6 +269,7 @@ public function get_answernotes() { return $notes; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_errors($format='strings') { // Apparently one wants to separate feedback-var errors? $err = []; @@ -268,6 +285,7 @@ public function get_errors($format='strings') { return $err; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_fverrors($format='strings') { $err = []; foreach ($this->errors as $er) { @@ -282,11 +300,13 @@ public function get_fverrors($format='strings') { return $err; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_trace(): array { // TO-DO: Add in answer test results to the trace array? return $this->trace; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function get_debuginfo(): string { return 'TO-DO DEBUGINFO'; } diff --git a/stack/questiontestresult.php b/stack/questiontestresult.php index 124c30f5b08..6d6f87dd8f0 100644 --- a/stack/questiontestresult.php +++ b/stack/questiontestresult.php @@ -100,10 +100,12 @@ public function set_input_state($inputname, $inputvalue, $inputmodified, $displa $this->inputerrors[$inputname] = $error; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_prt_result($prtname, prt_evaluatable $actualresult) { $this->actualresults[$prtname] = $actualresult; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function set_questionpenalty($penalty) { $this->questionpenalty = $penalty; } diff --git a/tests/editform_test.php b/tests/editform_test.php index 83645c4005f..6fdd6dc3905 100644 --- a/tests/editform_test.php +++ b/tests/editform_test.php @@ -75,6 +75,7 @@ public function __construct($questiontext, $specificfeedback) { */ class editform_test extends \advanced_testcase { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function get_form($questiontext, $specificfeedback) { $this->setAdminUser(); $this->resetAfterTest(); diff --git a/tests/fixtures/test_base.php b/tests/fixtures/test_base.php index ae498383052..a3c88ff7dbb 100644 --- a/tests/fixtures/test_base.php +++ b/tests/fixtures/test_base.php @@ -253,10 +253,12 @@ public function setUp(): void { $this->resetAfterTest(); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function render() { $this->currentoutput = $this->quba->render_question($this->slot, $this->displayoptions); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function get_tag_matcher($tag, $attributes) { return [ 'tag' => $tag, @@ -264,6 +266,7 @@ protected function get_tag_matcher($tag, $attributes) { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_prt_score($index, $score, $penalty, $finalsubmit = false) { $question = $this->quba->get_question($this->slot); $attempt = $this->quba->get_question_attempt($this->slot); @@ -296,6 +299,7 @@ protected function check_prt_score($index, $score, $penalty, $finalsubmit = fals } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_answer_note($index, $note) { $question = $this->quba->get_question($this->slot); $attempt = $this->quba->get_question_attempt($this->slot); @@ -305,6 +309,7 @@ protected function check_answer_note($index, $note) { $this->assertEquals($note, implode(' | ', $result->get_answernotes())); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_response_summary($note) { $question = $this->quba->get_question($this->slot); $attempt = $this->quba->get_question_attempt($this->slot); @@ -322,6 +327,7 @@ protected function check_response_summary_contains($note) { $this->assertTrue((strpos($qs->get_new_response_summary(), $note) !== false)); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_contains_text_input($name, $value = null, $enabled = true) { $attributes = [ 'type' => 'text', @@ -346,6 +352,7 @@ protected function check_output_contains_text_input($name, $value = null, $enabl } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_contains_textarea_input($name, $content = null, $enabled = true) { $attributes = [ 'name' => $this->quba->get_field_prefix($this->slot) . $name, @@ -370,6 +377,7 @@ protected function check_output_contains_textarea_input($name, $content = null, } } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_contains_input_validation($name) { $id = $this->quba->get_question_attempt($this->slot)->get_qt_field_name($name . '_val'); $this->assertMatchesRegularExpression('~
]*\bclass="stackinputfeedback standard")(?=[^>]*\bid="' . @@ -378,6 +386,7 @@ protected function check_output_contains_input_validation($name) { 'Input validation for ' . $name . ' not found in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_contains_input_validation_compact($name) { $id = $this->quba->get_question_attempt($this->slot)->get_qt_field_name($name . '_val'); $this->assertMatchesRegularExpression('~]*\bclass="stackinputfeedback compact")(?=[^>]*\bid="' . @@ -386,6 +395,7 @@ protected function check_output_contains_input_validation_compact($name) { 'Input validation for ' . $name . ' not found in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_does_not_contain_any_input_validation() { $this->assertDoesNotMatchRegularExpression('~
]*\bclass="stackinputfeedback standard(?:(?! empty)[^"])*"~', $this->currentoutput, 'Input validation should not be present in ' . $this->currentoutput); @@ -393,6 +403,7 @@ protected function check_output_does_not_contain_any_input_validation() { $this->currentoutput, 'Input validation should not be present in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_does_not_contain_input_validation($name = null) { if (!$name) { $this->check_output_does_not_contain_any_input_validation(); @@ -405,6 +416,7 @@ protected function check_output_does_not_contain_input_validation($name = null) 'Input validation for ' . $name . ' should not be present in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_contains_prt_feedback($name = null) { $class = 'stackprtfeedback'; if ($name) { @@ -414,6 +426,7 @@ protected function check_output_contains_prt_feedback($name = null) { 'PRT feedback for ' . $name . ' not found in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_does_not_contain_prt_feedback($name = null) { $class = 'stackprtfeedback'; if ($name) { @@ -423,22 +436,26 @@ protected function check_output_does_not_contain_prt_feedback($name = null) { 'PRT feedback for ' . $name . ' should not be present in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_does_not_contain_stray_placeholders() { $this->assertDoesNotMatchRegularExpression('~\[\[|\]\]~', $this->currentoutput, 'Not all placehoders were replaced.'); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_contains_lang_string($identifier, $component = '', $a = null) { $string = get_string($identifier, $component, $a); $this->assertStringContainsString($string, $this->currentoutput, 'Expected string ' . $string . ' not found in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_does_not_contain_lang_string($identifier, $component = '', $a = null) { $string = get_string($identifier, $component, $a); $this->assertStringNotContainsString($string, $this->currentoutput, 'The string ' . $string . ' should not be present in ' . $this->currentoutput); } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function check_output_does_not_contain_text($str) { $this->assertStringNotContainsString($str, $this->currentoutput, 'The string ' . $str . ' should not be present in ' . $this->currentoutput); diff --git a/tests/generator/behat_qtype_stack_generator.php b/tests/generator/behat_qtype_stack_generator.php index 53fa9a6cf36..ff1440adc47 100644 --- a/tests/generator/behat_qtype_stack_generator.php +++ b/tests/generator/behat_qtype_stack_generator.php @@ -28,6 +28,7 @@ */ class behat_qtype_stack_generator extends behat_generator_base { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function get_creatable_entities(): array { return [ 'Deployed variants' => [ diff --git a/tests/input_boolean_rendering_test.php b/tests/input_boolean_rendering_test.php index 40c19af803d..50df8360a33 100644 --- a/tests/input_boolean_rendering_test.php +++ b/tests/input_boolean_rendering_test.php @@ -43,6 +43,7 @@ */ class input_boolean_rendering_test extends question_testcase { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function expected_choices() { return [ stack_boolean_input::F => stack_string('false'), diff --git a/tests/input_checkbox_test.php b/tests/input_checkbox_test.php index 595819d6965..9b71d690168 100644 --- a/tests/input_checkbox_test.php +++ b/tests/input_checkbox_test.php @@ -44,6 +44,7 @@ */ class input_checkbox_test extends qtype_stack_testcase { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function expected_choices() { return [ '' => stack_string('notanswered'), @@ -53,6 +54,7 @@ protected function expected_choices() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function expected_choices_latex() { return [ '' => stack_string('notanswered'), @@ -62,11 +64,13 @@ protected function expected_choices_latex() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_checkbox($parameters = []) { $el = stack_input_factory::make('checkbox', 'ans1', $this->make_ta(), null, $parameters); return $el; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_ta() { return '[[x+1,true],[x+2,false],[sin(pi*n),false]]'; } diff --git a/tests/input_dropdown_exception_test.php b/tests/input_dropdown_exception_test.php index c13fa718584..8975dc39b8c 100644 --- a/tests/input_dropdown_exception_test.php +++ b/tests/input_dropdown_exception_test.php @@ -43,11 +43,13 @@ */ class input_dropdown_exception_test extends qtype_stack_testcase { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_dropdown($parameters = []) { $el = stack_input_factory::make('dropdown', 'ans1', $this->make_ta(), null, $parameters); return $el; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_ta() { return '[[x+1,true],[x+2,false],[sin(pi*n),false]]'; } diff --git a/tests/input_dropdown_test.php b/tests/input_dropdown_test.php index 2023891feb8..c98e4339eb3 100644 --- a/tests/input_dropdown_test.php +++ b/tests/input_dropdown_test.php @@ -52,6 +52,7 @@ protected function expected_choices() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function expected_choices_latex() { return [ '' => stack_string('notanswered'), @@ -61,11 +62,13 @@ protected function expected_choices_latex() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_dropdown($parameters = []) { $el = stack_input_factory::make('dropdown', 'ans1', $this->make_ta(), null, $parameters); return $el; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_ta() { return '[[x+1,true],[x+2,false],[sin(pi*n),false]]'; } diff --git a/tests/input_radio_test.php b/tests/input_radio_test.php index 2c21cb43246..ff1bb7bfa46 100644 --- a/tests/input_radio_test.php +++ b/tests/input_radio_test.php @@ -52,6 +52,7 @@ protected function expected_choices() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function expected_choices_latex() { return [ '' => stack_string('notanswered'), @@ -61,11 +62,13 @@ protected function expected_choices_latex() { ]; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_radio($parameters = []) { $el = stack_input_factory::make('radio', 'ans1', $this->make_ta(), null, $parameters); return $el; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function protected function make_ta() { return '[[x+1,true],[x+2,false],[sin(pi*n),false]]'; } diff --git a/tidyquestionform.php b/tidyquestionform.php index 772cb289ccb..1e75c464303 100644 --- a/tidyquestionform.php +++ b/tidyquestionform.php @@ -111,6 +111,7 @@ protected function get_prt_graph($prt) { return $graph; } + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validation($data, $files) { $errors = parent::validation($data, $files); $question = $this->_customdata; From 590e3b2bf2de7308e2fa7315567b0c4850d340e0 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Thu, 12 Dec 2024 16:23:54 +0000 Subject: [PATCH 06/23] code-tidy - Add copyright docblocks --- locallib.php | 6 ++++++ stack/cas/castext2/block.interface.php | 6 ++++++ stack/cas/castext2/blocks/castext.block.php | 6 ++++++ stack/cas/castext2/blocks/comment.block.php | 6 ++++++ stack/cas/castext2/blocks/commonstring.block.php | 6 ++++++ stack/cas/castext2/blocks/cors.block.php | 6 ++++++ stack/cas/castext2/blocks/debug.block.php | 6 ++++++ stack/cas/castext2/blocks/define.block.php | 6 ++++++ stack/cas/castext2/blocks/demarkdown.block.php | 6 ++++++ stack/cas/castext2/blocks/demoodle.block.php | 6 ++++++ stack/cas/castext2/blocks/escape.block.php | 6 ++++++ stack/cas/castext2/blocks/hint.block.php | 6 ++++++ stack/cas/castext2/blocks/htmlformat.block.php | 6 ++++++ stack/cas/castext2/blocks/if.block.php | 6 ++++++ stack/cas/castext2/blocks/ioblock.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/jsstring.block.php | 6 ++++++ stack/cas/castext2/blocks/jsxgraph.block.php | 6 ++++++ stack/cas/castext2/blocks/lang.block.php | 6 ++++++ stack/cas/castext2/blocks/latex.block.php | 6 ++++++ stack/cas/castext2/blocks/markdownformat.block.php | 6 ++++++ stack/cas/castext2/blocks/moodleformat.block.php | 6 ++++++ stack/cas/castext2/blocks/parsons.block.php | 6 ++++++ stack/cas/castext2/blocks/pfs.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/placeholder.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/quid.block.php | 6 ++++++ stack/cas/castext2/blocks/raw.block.php | 6 ++++++ stack/cas/castext2/blocks/raw.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/reveal.block.php | 6 ++++++ stack/cas/castext2/blocks/root.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/smlt.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/stack_translate.specialblock.php | 6 ++++++ stack/cas/castext2/blocks/todo.block.php | 6 ++++++ stack/cas/castext2/castext2_evaluatable.class.php | 6 ++++++ stack/cas/castext2/castext2_placeholder_holder.class.php | 6 ++++++ stack/cas/castext2/castext2_static_replacer.class.php | 6 ++++++ stack/cas/castext2/processor.class.php | 6 ++++++ stack/cas/installhelper.class.php | 6 ++++++ .../001_fix_call_of_a_group_or_function.filter.php | 6 ++++++ stack/cas/parsingrules/002_log_candy.filter.php | 6 ++++++ stack/cas/parsingrules/003_no_dot_dot.filter.php | 6 ++++++ stack/cas/parsingrules/005_i_is_never_a_function.filter.php | 6 ++++++ stack/cas/parsingrules/022_trig_replace_synonyms.filter.php | 6 ++++++ stack/cas/parsingrules/025_no_trig_power.filter.php | 6 ++++++ stack/cas/parsingrules/030_no_trig_space.filter.php | 6 ++++++ stack/cas/parsingrules/031_no_trig_brackets.filter.php | 6 ++++++ stack/cas/parsingrules/033_no_extra_evaluation.filter.php | 6 ++++++ .../cas/parsingrules/050_no_chained_inequalities.filter.php | 6 ++++++ .../090_special_forbidden_characters.filter.php | 6 ++++++ stack/cas/parsingrules/101_no_floats.filter.php | 6 ++++++ stack/cas/parsingrules/102_no_strings.filter.php | 6 ++++++ stack/cas/parsingrules/103_no_lists.filter.php | 6 ++++++ stack/cas/parsingrules/104_no_sets.filter.php | 6 ++++++ stack/cas/parsingrules/105_no_grouppings.filter.php | 6 ++++++ stack/cas/parsingrules/106_no_control_flow.filter.php | 6 ++++++ stack/cas/parsingrules/120_no_arc.filter.php | 6 ++++++ .../cas/parsingrules/150_replace_unicode_letters.filter.php | 6 ++++++ .../cas/parsingrules/180_char_based_superscripts.filter.php | 6 ++++++ stack/cas/parsingrules/201_sig_figs_validation.filter.php | 6 ++++++ .../parsingrules/202_decimal_places_validation.filter.php | 6 ++++++ .../parsingrules/210_x_used_as_multiplication.filter.php | 6 ++++++ .../402_split_prefix_from_common_function_name.filter.php | 6 ++++++ .../403_split_at_number_letter_boundary.filter.php | 6 ++++++ .../404_split_at_number_letter_number_boundary.filter.php | 6 ++++++ .../406_split_implied_variable_names.filter.php | 6 ++++++ stack/cas/parsingrules/410_single_char_vars.filter.php | 6 ++++++ .../cas/parsingrules/420_consolidate_subscripts.filter.php | 6 ++++++ .../cas/parsingrules/441_split_unknown_functions.filter.php | 6 ++++++ stack/cas/parsingrules/442_split_all_functions.filter.php | 6 ++++++ stack/cas/parsingrules/450_split_floats.filter.php | 6 ++++++ stack/cas/parsingrules/502_replace_pm.filter.php | 6 ++++++ stack/cas/parsingrules/504_insert_tuples_for_groups.php | 6 ++++++ stack/cas/parsingrules/505_no_evaluation_groups.filter.php | 6 ++++++ .../cas/parsingrules/520_no_equality_with_logic.filter.php | 6 ++++++ stack/cas/parsingrules/541_no_unknown_functions.filter.php | 6 ++++++ stack/cas/parsingrules/542_no_functions_at_all.filter.php | 6 ++++++ stack/cas/parsingrules/601_castext.filter.php | 6 ++++++ stack/cas/parsingrules/602_castext_simplifier.filter.php | 6 ++++++ .../610_castext_static_string_extractor.filter.php | 6 ++++++ stack/cas/parsingrules/650_string_protect_slash.filter.php | 6 ++++++ stack/cas/parsingrules/680_gcl_sconcat.filter.php | 6 ++++++ stack/cas/parsingrules/801_singleton_numeric.filter.php | 6 ++++++ stack/cas/parsingrules/802_singleton_units.filter.php | 6 ++++++ stack/cas/parsingrules/901_remove_comments.filter.php | 6 ++++++ .../909_parsons_decode_state_for_display.filter.php | 6 ++++++ .../cas/parsingrules/910_inert_float_for_display.filter.php | 6 ++++++ .../parsingrules/912_inert_string_for_display.filter.php | 6 ++++++ stack/cas/parsingrules/990_no_fixing_spaces.filter.php | 6 ++++++ stack/cas/parsingrules/991_no_fixing_stars.filter.php | 6 ++++++ stack/cas/parsingrules/995_ev_modification.filter.php | 6 ++++++ stack/cas/parsingrules/996_call_modification.filter.php | 6 ++++++ stack/cas/parsingrules/997_string_security.filter.php | 6 ++++++ stack/cas/parsingrules/998_security.filter.php | 6 ++++++ stack/cas/parsingrules/999_strict.filter.php | 6 ++++++ stack/cas/parsingrules/filter.interface.php | 6 ++++++ stack/cas/parsingrules/parsingrule.factory.php | 6 ++++++ stack/cas/parsingrules/pipeline.class.php | 6 ++++++ stack/input/factory.class.php | 6 ++++++ stack/input/inputbase.class.php | 6 ++++++ stack/input/inputstate.class.php | 6 ++++++ stack/input/parsons/parsons.class.php | 6 ++++++ stack/maximaparser/corrective_parser.php | 6 ++++++ stack/prt.class.php | 6 ++++++ stack/prt.evaluatable.class.php | 6 ++++++ tests/fixtures/ast_filter_test_base.php | 6 ++++++ tests/fixtures/test_base.php | 6 ++++++ 105 files changed, 630 insertions(+) diff --git a/locallib.php b/locallib.php index cd364b37924..1c7c05be49f 100644 --- a/locallib.php +++ b/locallib.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/stack/mathsoutput/mathsoutput.class.php'); diff --git a/stack/cas/castext2/block.interface.php b/stack/cas/castext2/block.interface.php index 7a6124ad1f3..bdeb333f147 100644 --- a/stack/cas/castext2/block.interface.php +++ b/stack/cas/castext2/block.interface.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/CTP_classes.php'); diff --git a/stack/cas/castext2/blocks/castext.block.php b/stack/cas/castext2/blocks/castext.block.php index d8c5b4b6417..295f93ac83d 100644 --- a/stack/cas/castext2/blocks/castext.block.php +++ b/stack/cas/castext2/blocks/castext.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/comment.block.php b/stack/cas/castext2/blocks/comment.block.php index 1fc15ffbfb8..df7710d1981 100644 --- a/stack/cas/castext2/blocks/comment.block.php +++ b/stack/cas/castext2/blocks/comment.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/commonstring.block.php b/stack/cas/castext2/blocks/commonstring.block.php index fe732509408..25b2cdf1af3 100644 --- a/stack/cas/castext2/blocks/commonstring.block.php +++ b/stack/cas/castext2/blocks/commonstring.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/cors.block.php b/stack/cas/castext2/blocks/cors.block.php index b5e86b0cba3..21b1176f78c 100644 --- a/stack/cas/castext2/blocks/cors.block.php +++ b/stack/cas/castext2/blocks/cors.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/debug.block.php b/stack/cas/castext2/blocks/debug.block.php index b45d8a4a159..d0ebde50b8d 100644 --- a/stack/cas/castext2/blocks/debug.block.php +++ b/stack/cas/castext2/blocks/debug.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/define.block.php b/stack/cas/castext2/blocks/define.block.php index 0efe452f57f..1fa36c1f40c 100644 --- a/stack/cas/castext2/blocks/define.block.php +++ b/stack/cas/castext2/blocks/define.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/demarkdown.block.php b/stack/cas/castext2/blocks/demarkdown.block.php index 4b7c9a84475..05c9e3fd055 100644 --- a/stack/cas/castext2/blocks/demarkdown.block.php +++ b/stack/cas/castext2/blocks/demarkdown.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; diff --git a/stack/cas/castext2/blocks/demoodle.block.php b/stack/cas/castext2/blocks/demoodle.block.php index 00eaf3210f9..aa92fdb4dc4 100644 --- a/stack/cas/castext2/blocks/demoodle.block.php +++ b/stack/cas/castext2/blocks/demoodle.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; diff --git a/stack/cas/castext2/blocks/escape.block.php b/stack/cas/castext2/blocks/escape.block.php index 7949db73bfa..8d8fa50625a 100644 --- a/stack/cas/castext2/blocks/escape.block.php +++ b/stack/cas/castext2/blocks/escape.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/hint.block.php b/stack/cas/castext2/blocks/hint.block.php index 76bdc977483..925e90197cd 100644 --- a/stack/cas/castext2/blocks/hint.block.php +++ b/stack/cas/castext2/blocks/hint.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/htmlformat.block.php b/stack/cas/castext2/blocks/htmlformat.block.php index a7609c6630b..52d03502f20 100644 --- a/stack/cas/castext2/blocks/htmlformat.block.php +++ b/stack/cas/castext2/blocks/htmlformat.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with STACK. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/if.block.php b/stack/cas/castext2/blocks/if.block.php index 0eb56a2379c..2311795ae80 100644 --- a/stack/cas/castext2/blocks/if.block.php +++ b/stack/cas/castext2/blocks/if.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/ioblock.specialblock.php b/stack/cas/castext2/blocks/ioblock.specialblock.php index f3034d4d9dd..4dc6903917a 100644 --- a/stack/cas/castext2/blocks/ioblock.specialblock.php +++ b/stack/cas/castext2/blocks/ioblock.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/jsstring.block.php b/stack/cas/castext2/blocks/jsstring.block.php index 924a083f6a9..d1153db6d42 100644 --- a/stack/cas/castext2/blocks/jsstring.block.php +++ b/stack/cas/castext2/blocks/jsstring.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/jsxgraph.block.php b/stack/cas/castext2/blocks/jsxgraph.block.php index 8bda55badc4..7a2974b7063 100644 --- a/stack/cas/castext2/blocks/jsxgraph.block.php +++ b/stack/cas/castext2/blocks/jsxgraph.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/lang.block.php b/stack/cas/castext2/blocks/lang.block.php index daa5cec53c2..0138c724da4 100644 --- a/stack/cas/castext2/blocks/lang.block.php +++ b/stack/cas/castext2/blocks/lang.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/latex.block.php b/stack/cas/castext2/blocks/latex.block.php index 429d2b6f4eb..ee2f9f5936f 100644 --- a/stack/cas/castext2/blocks/latex.block.php +++ b/stack/cas/castext2/blocks/latex.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/raw.block.php'); diff --git a/stack/cas/castext2/blocks/markdownformat.block.php b/stack/cas/castext2/blocks/markdownformat.block.php index 5b70ba70fe0..71c44c836e1 100644 --- a/stack/cas/castext2/blocks/markdownformat.block.php +++ b/stack/cas/castext2/blocks/markdownformat.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; diff --git a/stack/cas/castext2/blocks/moodleformat.block.php b/stack/cas/castext2/blocks/moodleformat.block.php index 3ef466d42ef..6c7d77f139d 100644 --- a/stack/cas/castext2/blocks/moodleformat.block.php +++ b/stack/cas/castext2/blocks/moodleformat.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; diff --git a/stack/cas/castext2/blocks/parsons.block.php b/stack/cas/castext2/blocks/parsons.block.php index 63061cae1ee..a5aaa86f536 100644 --- a/stack/cas/castext2/blocks/parsons.block.php +++ b/stack/cas/castext2/blocks/parsons.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with STACK. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/pfs.specialblock.php b/stack/cas/castext2/blocks/pfs.specialblock.php index e9260c2d18b..aeddf3b906c 100644 --- a/stack/cas/castext2/blocks/pfs.specialblock.php +++ b/stack/cas/castext2/blocks/pfs.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; diff --git a/stack/cas/castext2/blocks/placeholder.specialblock.php b/stack/cas/castext2/blocks/placeholder.specialblock.php index 88fa100b76a..461862645c6 100644 --- a/stack/cas/castext2/blocks/placeholder.specialblock.php +++ b/stack/cas/castext2/blocks/placeholder.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/quid.block.php b/stack/cas/castext2/blocks/quid.block.php index 26de12078c3..08cd3ed9d9b 100644 --- a/stack/cas/castext2/blocks/quid.block.php +++ b/stack/cas/castext2/blocks/quid.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/raw.block.php b/stack/cas/castext2/blocks/raw.block.php index 5f8c98685b1..1db361f4b2b 100644 --- a/stack/cas/castext2/blocks/raw.block.php +++ b/stack/cas/castext2/blocks/raw.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/raw.specialblock.php b/stack/cas/castext2/blocks/raw.specialblock.php index d77e888aa81..c598febb4e1 100644 --- a/stack/cas/castext2/blocks/raw.specialblock.php +++ b/stack/cas/castext2/blocks/raw.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/reveal.block.php b/stack/cas/castext2/blocks/reveal.block.php index d18b914ec2f..ab6c47d4d88 100644 --- a/stack/cas/castext2/blocks/reveal.block.php +++ b/stack/cas/castext2/blocks/reveal.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with STACK. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/root.specialblock.php b/stack/cas/castext2/blocks/root.specialblock.php index d8351f9edd3..150aaefc723 100644 --- a/stack/cas/castext2/blocks/root.specialblock.php +++ b/stack/cas/castext2/blocks/root.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/smlt.specialblock.php b/stack/cas/castext2/blocks/smlt.specialblock.php index 4b49c6dd20e..1401823e120 100644 --- a/stack/cas/castext2/blocks/smlt.specialblock.php +++ b/stack/cas/castext2/blocks/smlt.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/stack_translate.specialblock.php b/stack/cas/castext2/blocks/stack_translate.specialblock.php index 7ed2d916587..1db0b7bd13e 100644 --- a/stack/cas/castext2/blocks/stack_translate.specialblock.php +++ b/stack/cas/castext2/blocks/stack_translate.specialblock.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/blocks/todo.block.php b/stack/cas/castext2/blocks/todo.block.php index b3b080e6932..3a378911c6b 100644 --- a/stack/cas/castext2/blocks/todo.block.php +++ b/stack/cas/castext2/blocks/todo.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/stack/cas/castext2/castext2_evaluatable.class.php b/stack/cas/castext2/castext2_evaluatable.class.php index 72a6a3c6685..d2675ad5a8d 100644 --- a/stack/cas/castext2/castext2_evaluatable.class.php +++ b/stack/cas/castext2/castext2_evaluatable.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../evaluatable_object.interfaces.php'); diff --git a/stack/cas/castext2/castext2_placeholder_holder.class.php b/stack/cas/castext2/castext2_placeholder_holder.class.php index c4105de2303..3fecd584e19 100644 --- a/stack/cas/castext2/castext2_placeholder_holder.class.php +++ b/stack/cas/castext2/castext2_placeholder_holder.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../maximaparser/utils.php'); diff --git a/stack/cas/castext2/castext2_static_replacer.class.php b/stack/cas/castext2/castext2_static_replacer.class.php index 480afbfa2da..742c30ed607 100644 --- a/stack/cas/castext2/castext2_static_replacer.class.php +++ b/stack/cas/castext2/castext2_static_replacer.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../maximaparser/utils.php'); diff --git a/stack/cas/castext2/processor.class.php b/stack/cas/castext2/processor.class.php index 4c3869bcf27..0e35501ad25 100644 --- a/stack/cas/castext2/processor.class.php +++ b/stack/cas/castext2/processor.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/blocks/root.specialblock.php'); diff --git a/stack/cas/installhelper.class.php b/stack/cas/installhelper.class.php index 11e01d103d7..2825a7e3c54 100644 --- a/stack/cas/installhelper.class.php +++ b/stack/cas/installhelper.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); // This provides helper code for creating the files needed to connect to the CAS. diff --git a/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php b/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php index 013e2cedfed..1d1df52c82b 100644 --- a/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php +++ b/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/002_log_candy.filter.php b/stack/cas/parsingrules/002_log_candy.filter.php index d6ba37619b6..c8fd1f7a33a 100644 --- a/stack/cas/parsingrules/002_log_candy.filter.php +++ b/stack/cas/parsingrules/002_log_candy.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/003_no_dot_dot.filter.php b/stack/cas/parsingrules/003_no_dot_dot.filter.php index 0ad6f3e3ae9..9f4ecf66214 100644 --- a/stack/cas/parsingrules/003_no_dot_dot.filter.php +++ b/stack/cas/parsingrules/003_no_dot_dot.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/005_i_is_never_a_function.filter.php b/stack/cas/parsingrules/005_i_is_never_a_function.filter.php index e62e9bbc19c..cce81f9a42a 100644 --- a/stack/cas/parsingrules/005_i_is_never_a_function.filter.php +++ b/stack/cas/parsingrules/005_i_is_never_a_function.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php b/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php index a412e214487..43ad990a37f 100644 --- a/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php +++ b/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/025_no_trig_power.filter.php b/stack/cas/parsingrules/025_no_trig_power.filter.php index 46bb86a206c..4754b2a77e5 100644 --- a/stack/cas/parsingrules/025_no_trig_power.filter.php +++ b/stack/cas/parsingrules/025_no_trig_power.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/030_no_trig_space.filter.php b/stack/cas/parsingrules/030_no_trig_space.filter.php index c33d2557f79..e49f020f3df 100644 --- a/stack/cas/parsingrules/030_no_trig_space.filter.php +++ b/stack/cas/parsingrules/030_no_trig_space.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/031_no_trig_brackets.filter.php b/stack/cas/parsingrules/031_no_trig_brackets.filter.php index 295b0a58969..8317d2dd1c2 100644 --- a/stack/cas/parsingrules/031_no_trig_brackets.filter.php +++ b/stack/cas/parsingrules/031_no_trig_brackets.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php index a69044af934..d073c766d32 100644 --- a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php +++ b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/050_no_chained_inequalities.filter.php b/stack/cas/parsingrules/050_no_chained_inequalities.filter.php index d52d59c274f..63703f3c7f6 100644 --- a/stack/cas/parsingrules/050_no_chained_inequalities.filter.php +++ b/stack/cas/parsingrules/050_no_chained_inequalities.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/090_special_forbidden_characters.filter.php b/stack/cas/parsingrules/090_special_forbidden_characters.filter.php index 6970889dd53..3316c3f8105 100644 --- a/stack/cas/parsingrules/090_special_forbidden_characters.filter.php +++ b/stack/cas/parsingrules/090_special_forbidden_characters.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/101_no_floats.filter.php b/stack/cas/parsingrules/101_no_floats.filter.php index 12b05336498..335a7f44261 100644 --- a/stack/cas/parsingrules/101_no_floats.filter.php +++ b/stack/cas/parsingrules/101_no_floats.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/102_no_strings.filter.php b/stack/cas/parsingrules/102_no_strings.filter.php index a4ea2b69059..eea3f88e82b 100644 --- a/stack/cas/parsingrules/102_no_strings.filter.php +++ b/stack/cas/parsingrules/102_no_strings.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/103_no_lists.filter.php b/stack/cas/parsingrules/103_no_lists.filter.php index f8163f09afd..a3e4898aad0 100644 --- a/stack/cas/parsingrules/103_no_lists.filter.php +++ b/stack/cas/parsingrules/103_no_lists.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/104_no_sets.filter.php b/stack/cas/parsingrules/104_no_sets.filter.php index c75242a86d4..282bbbd78dc 100644 --- a/stack/cas/parsingrules/104_no_sets.filter.php +++ b/stack/cas/parsingrules/104_no_sets.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/105_no_grouppings.filter.php b/stack/cas/parsingrules/105_no_grouppings.filter.php index e72c09b1387..23a243a82ce 100644 --- a/stack/cas/parsingrules/105_no_grouppings.filter.php +++ b/stack/cas/parsingrules/105_no_grouppings.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/106_no_control_flow.filter.php b/stack/cas/parsingrules/106_no_control_flow.filter.php index 27a32e529c9..c9693807189 100644 --- a/stack/cas/parsingrules/106_no_control_flow.filter.php +++ b/stack/cas/parsingrules/106_no_control_flow.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/120_no_arc.filter.php b/stack/cas/parsingrules/120_no_arc.filter.php index 967e61a63b5..92e1a4726d7 100644 --- a/stack/cas/parsingrules/120_no_arc.filter.php +++ b/stack/cas/parsingrules/120_no_arc.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/150_replace_unicode_letters.filter.php b/stack/cas/parsingrules/150_replace_unicode_letters.filter.php index a1b93c020e5..c49c57ec7c5 100644 --- a/stack/cas/parsingrules/150_replace_unicode_letters.filter.php +++ b/stack/cas/parsingrules/150_replace_unicode_letters.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../maximaparser/corrective_parser.php'); diff --git a/stack/cas/parsingrules/180_char_based_superscripts.filter.php b/stack/cas/parsingrules/180_char_based_superscripts.filter.php index 70518416419..110d6451c3d 100644 --- a/stack/cas/parsingrules/180_char_based_superscripts.filter.php +++ b/stack/cas/parsingrules/180_char_based_superscripts.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../maximaparser/corrective_parser.php'); diff --git a/stack/cas/parsingrules/201_sig_figs_validation.filter.php b/stack/cas/parsingrules/201_sig_figs_validation.filter.php index 2a15fd1a50c..bab414f7255 100644 --- a/stack/cas/parsingrules/201_sig_figs_validation.filter.php +++ b/stack/cas/parsingrules/201_sig_figs_validation.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../utils.class.php'); diff --git a/stack/cas/parsingrules/202_decimal_places_validation.filter.php b/stack/cas/parsingrules/202_decimal_places_validation.filter.php index 98a0b6d28a4..8d6170e7903 100644 --- a/stack/cas/parsingrules/202_decimal_places_validation.filter.php +++ b/stack/cas/parsingrules/202_decimal_places_validation.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../utils.class.php'); diff --git a/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php b/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php index 535550007b1..37f941ac90a 100644 --- a/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php +++ b/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../utils.class.php'); diff --git a/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php b/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php index 7043bc131c4..ad80e7ab4d5 100644 --- a/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php +++ b/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php b/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php index 8a69514af19..48f0e716106 100644 --- a/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php +++ b/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php b/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php index 5b9185c784a..c468c494dd1 100644 --- a/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php +++ b/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/406_split_implied_variable_names.filter.php b/stack/cas/parsingrules/406_split_implied_variable_names.filter.php index 43ff7650e8f..8f8b723731b 100644 --- a/stack/cas/parsingrules/406_split_implied_variable_names.filter.php +++ b/stack/cas/parsingrules/406_split_implied_variable_names.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/410_single_char_vars.filter.php b/stack/cas/parsingrules/410_single_char_vars.filter.php index 32186c82679..31207408974 100644 --- a/stack/cas/parsingrules/410_single_char_vars.filter.php +++ b/stack/cas/parsingrules/410_single_char_vars.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/420_consolidate_subscripts.filter.php b/stack/cas/parsingrules/420_consolidate_subscripts.filter.php index 4262e16b023..1948dc18c5e 100644 --- a/stack/cas/parsingrules/420_consolidate_subscripts.filter.php +++ b/stack/cas/parsingrules/420_consolidate_subscripts.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/441_split_unknown_functions.filter.php b/stack/cas/parsingrules/441_split_unknown_functions.filter.php index 08143f0972e..77abb117295 100644 --- a/stack/cas/parsingrules/441_split_unknown_functions.filter.php +++ b/stack/cas/parsingrules/441_split_unknown_functions.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/442_split_all_functions.filter.php b/stack/cas/parsingrules/442_split_all_functions.filter.php index fe9cda44c59..89640dfd924 100644 --- a/stack/cas/parsingrules/442_split_all_functions.filter.php +++ b/stack/cas/parsingrules/442_split_all_functions.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/450_split_floats.filter.php b/stack/cas/parsingrules/450_split_floats.filter.php index 1e661036f2b..9347f6d25d8 100644 --- a/stack/cas/parsingrules/450_split_floats.filter.php +++ b/stack/cas/parsingrules/450_split_floats.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/502_replace_pm.filter.php b/stack/cas/parsingrules/502_replace_pm.filter.php index eae940f1c88..584edb267ff 100644 --- a/stack/cas/parsingrules/502_replace_pm.filter.php +++ b/stack/cas/parsingrules/502_replace_pm.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/504_insert_tuples_for_groups.php b/stack/cas/parsingrules/504_insert_tuples_for_groups.php index d0bd8c8d8e5..e6c5b9c32f4 100644 --- a/stack/cas/parsingrules/504_insert_tuples_for_groups.php +++ b/stack/cas/parsingrules/504_insert_tuples_for_groups.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/505_no_evaluation_groups.filter.php b/stack/cas/parsingrules/505_no_evaluation_groups.filter.php index e1810c5fa2e..c81fa380fef 100644 --- a/stack/cas/parsingrules/505_no_evaluation_groups.filter.php +++ b/stack/cas/parsingrules/505_no_evaluation_groups.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/520_no_equality_with_logic.filter.php b/stack/cas/parsingrules/520_no_equality_with_logic.filter.php index c4480800fb7..468b7e12054 100644 --- a/stack/cas/parsingrules/520_no_equality_with_logic.filter.php +++ b/stack/cas/parsingrules/520_no_equality_with_logic.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/541_no_unknown_functions.filter.php b/stack/cas/parsingrules/541_no_unknown_functions.filter.php index 2941eabf265..642741570ee 100644 --- a/stack/cas/parsingrules/541_no_unknown_functions.filter.php +++ b/stack/cas/parsingrules/541_no_unknown_functions.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/542_no_functions_at_all.filter.php b/stack/cas/parsingrules/542_no_functions_at_all.filter.php index 320ebc3efad..547c00cbc4d 100644 --- a/stack/cas/parsingrules/542_no_functions_at_all.filter.php +++ b/stack/cas/parsingrules/542_no_functions_at_all.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/601_castext.filter.php b/stack/cas/parsingrules/601_castext.filter.php index 93f4a547f0d..9ebe3240d9c 100644 --- a/stack/cas/parsingrules/601_castext.filter.php +++ b/stack/cas/parsingrules/601_castext.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/602_castext_simplifier.filter.php b/stack/cas/parsingrules/602_castext_simplifier.filter.php index 5360e0fe0f9..dc93824250b 100644 --- a/stack/cas/parsingrules/602_castext_simplifier.filter.php +++ b/stack/cas/parsingrules/602_castext_simplifier.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php b/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php index ebfe58c92d6..397f598a619 100644 --- a/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php +++ b/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/650_string_protect_slash.filter.php b/stack/cas/parsingrules/650_string_protect_slash.filter.php index 97242aec9cf..0439bac5a7a 100644 --- a/stack/cas/parsingrules/650_string_protect_slash.filter.php +++ b/stack/cas/parsingrules/650_string_protect_slash.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/680_gcl_sconcat.filter.php b/stack/cas/parsingrules/680_gcl_sconcat.filter.php index 4e174c26d94..9c100ba87e2 100644 --- a/stack/cas/parsingrules/680_gcl_sconcat.filter.php +++ b/stack/cas/parsingrules/680_gcl_sconcat.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/801_singleton_numeric.filter.php b/stack/cas/parsingrules/801_singleton_numeric.filter.php index ff3a8f96280..a339f398643 100644 --- a/stack/cas/parsingrules/801_singleton_numeric.filter.php +++ b/stack/cas/parsingrules/801_singleton_numeric.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../maximaparser/utils.php'); diff --git a/stack/cas/parsingrules/802_singleton_units.filter.php b/stack/cas/parsingrules/802_singleton_units.filter.php index 6b9b3d4b923..d7286486f9b 100644 --- a/stack/cas/parsingrules/802_singleton_units.filter.php +++ b/stack/cas/parsingrules/802_singleton_units.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/801_singleton_numeric.filter.php'); diff --git a/stack/cas/parsingrules/901_remove_comments.filter.php b/stack/cas/parsingrules/901_remove_comments.filter.php index 313a64584cc..6b1eca07750 100644 --- a/stack/cas/parsingrules/901_remove_comments.filter.php +++ b/stack/cas/parsingrules/901_remove_comments.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php b/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php index ee9f0134757..3154f766682 100644 --- a/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php +++ b/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../utils.class.php'); diff --git a/stack/cas/parsingrules/910_inert_float_for_display.filter.php b/stack/cas/parsingrules/910_inert_float_for_display.filter.php index 89dd701644c..8d9ec0f593c 100644 --- a/stack/cas/parsingrules/910_inert_float_for_display.filter.php +++ b/stack/cas/parsingrules/910_inert_float_for_display.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../utils.class.php'); diff --git a/stack/cas/parsingrules/912_inert_string_for_display.filter.php b/stack/cas/parsingrules/912_inert_string_for_display.filter.php index 2382b8b3ea2..ad518f21312 100644 --- a/stack/cas/parsingrules/912_inert_string_for_display.filter.php +++ b/stack/cas/parsingrules/912_inert_string_for_display.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/../../utils.class.php'); diff --git a/stack/cas/parsingrules/990_no_fixing_spaces.filter.php b/stack/cas/parsingrules/990_no_fixing_spaces.filter.php index 20aaefda76d..2ae3c4642c6 100644 --- a/stack/cas/parsingrules/990_no_fixing_spaces.filter.php +++ b/stack/cas/parsingrules/990_no_fixing_spaces.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/991_no_fixing_stars.filter.php b/stack/cas/parsingrules/991_no_fixing_stars.filter.php index c821c50bfb0..49b6852867b 100644 --- a/stack/cas/parsingrules/991_no_fixing_stars.filter.php +++ b/stack/cas/parsingrules/991_no_fixing_stars.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/995_ev_modification.filter.php b/stack/cas/parsingrules/995_ev_modification.filter.php index b74fc52b717..a6277d6b2b3 100644 --- a/stack/cas/parsingrules/995_ev_modification.filter.php +++ b/stack/cas/parsingrules/995_ev_modification.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); require_once(__DIR__ . '/996_call_modification.filter.php'); diff --git a/stack/cas/parsingrules/996_call_modification.filter.php b/stack/cas/parsingrules/996_call_modification.filter.php index e2413ad6b59..71c402787f5 100644 --- a/stack/cas/parsingrules/996_call_modification.filter.php +++ b/stack/cas/parsingrules/996_call_modification.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/997_string_security.filter.php b/stack/cas/parsingrules/997_string_security.filter.php index c3032e40cea..6937b165d81 100644 --- a/stack/cas/parsingrules/997_string_security.filter.php +++ b/stack/cas/parsingrules/997_string_security.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/998_security.filter.php b/stack/cas/parsingrules/998_security.filter.php index f1bf4f28b65..f2de37381d8 100644 --- a/stack/cas/parsingrules/998_security.filter.php +++ b/stack/cas/parsingrules/998_security.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/999_strict.filter.php b/stack/cas/parsingrules/999_strict.filter.php index a7672f473c6..0427ceaed54 100644 --- a/stack/cas/parsingrules/999_strict.filter.php +++ b/stack/cas/parsingrules/999_strict.filter.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/filter.interface.php b/stack/cas/parsingrules/filter.interface.php index 6f7a7c29a00..51096cf3bf7 100644 --- a/stack/cas/parsingrules/filter.interface.php +++ b/stack/cas/parsingrules/filter.interface.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../maximaparser/MP_classes.php'); diff --git a/stack/cas/parsingrules/parsingrule.factory.php b/stack/cas/parsingrules/parsingrule.factory.php index 0db2521ae37..bfde39d93af 100644 --- a/stack/cas/parsingrules/parsingrule.factory.php +++ b/stack/cas/parsingrules/parsingrule.factory.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL')|| die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/cas/parsingrules/pipeline.class.php b/stack/cas/parsingrules/pipeline.class.php index bbee15c827e..f2ead1508bf 100644 --- a/stack/cas/parsingrules/pipeline.class.php +++ b/stack/cas/parsingrules/pipeline.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL')|| die(); require_once(__DIR__ . '/filter.interface.php'); diff --git a/stack/input/factory.class.php b/stack/input/factory.class.php index b76aa7b400a..c0630d3c2a5 100644 --- a/stack/input/factory.class.php +++ b/stack/input/factory.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../options.class.php'); diff --git a/stack/input/inputbase.class.php b/stack/input/inputbase.class.php index 3e8dc7ef2be..8763ca40a20 100644 --- a/stack/input/inputbase.class.php +++ b/stack/input/inputbase.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../locallib.php'); diff --git a/stack/input/inputstate.class.php b/stack/input/inputstate.class.php index 020f9fcb4e9..ea61d308ca9 100644 --- a/stack/input/inputstate.class.php +++ b/stack/input/inputstate.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../locallib.php'); diff --git a/stack/input/parsons/parsons.class.php b/stack/input/parsons/parsons.class.php index 499a622c049..6307b2082ab 100644 --- a/stack/input/parsons/parsons.class.php +++ b/stack/input/parsons/parsons.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../string/string.class.php'); diff --git a/stack/maximaparser/corrective_parser.php b/stack/maximaparser/corrective_parser.php index 754847106aa..86cd4281253 100644 --- a/stack/maximaparser/corrective_parser.php +++ b/stack/maximaparser/corrective_parser.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/autogen/parser.mbstring.php'); diff --git a/stack/prt.class.php b/stack/prt.class.php index 3dab6bc9560..6667452fe97 100644 --- a/stack/prt.class.php +++ b/stack/prt.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/cas/ast.container.class.php'); diff --git a/stack/prt.evaluatable.class.php b/stack/prt.evaluatable.class.php index 25a4c1b2aa4..235d12012ff 100644 --- a/stack/prt.evaluatable.class.php +++ b/stack/prt.evaluatable.class.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL')|| die(); require_once(__DIR__ . '/cas/evaluatable_object.interfaces.php'); diff --git a/tests/fixtures/ast_filter_test_base.php b/tests/fixtures/ast_filter_test_base.php index df2cf39bdc1..37c3ee821c4 100644 --- a/tests/fixtures/ast_filter_test_base.php +++ b/tests/fixtures/ast_filter_test_base.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../locallib.php'); diff --git a/tests/fixtures/test_base.php b/tests/fixtures/test_base.php index a3c88ff7dbb..7307d302f60 100644 --- a/tests/fixtures/test_base.php +++ b/tests/fixtures/test_base.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; From 9a94dd1153d19b8d90eb380005f4afe785fa9ab2 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Thu, 12 Dec 2024 16:44:55 +0000 Subject: [PATCH 07/23] code-tidy - Language order --- lang/de/qtype_stack.php | 3 ++- lang/en/qtype_stack.php | 6 +++--- stack/cas/castext2/blocks/foreach.block.php | 6 ++++++ vle_specific.php | 6 ++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lang/de/qtype_stack.php b/lang/de/qtype_stack.php index e3dd1466af6..201fa6ad41b 100644 --- a/lang/de/qtype_stack.php +++ b/lang/de/qtype_stack.php @@ -24,7 +24,8 @@ */ defined('MOODLE_INTERNAL') || die(); - +// phpcs:disable moodle.Files.LangFilesOrdering.IncorrectOrder +// phpcs:disable moodle.Files.LangFilesOrdering.UnexpectedComment $string['ATAlgEquiv_SA_not_equation'] = 'Ihre Anwort sollte eine Gleichung sein, ist es aber nicht.'; $string['ATAlgEquiv_SA_not_expression'] = 'Ihre Antwort sollte ein Ausdruck und keine Gleichung/Ungleichung/Liste/Menge/Matrix sein.'; $string['ATAlgEquiv_SA_not_function'] = 'Ihre Antwort sollte eine Funktion sein, die durch den Operator := definiert wird. Sie ist es aber nicht.'; diff --git a/lang/en/qtype_stack.php b/lang/en/qtype_stack.php index 9b428830500..ea2d30f5ae5 100644 --- a/lang/en/qtype_stack.php +++ b/lang/en/qtype_stack.php @@ -21,7 +21,8 @@ * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - +// phpcs:disable moodle.Files.LangFilesOrdering.IncorrectOrder +// phpcs:disable moodle.Files.LangFilesOrdering.UnexpectedComment $string['pluginname'] = 'STACK'; $string['pluginname_help'] = 'STACK is an assessment system for mathematics.'; $string['pluginnameadding'] = 'Adding a STACK question'; @@ -317,9 +318,8 @@ $string['questionwarnings'] = 'Question warnings'; $string['questionwarnings_help'] = 'Question warnings are issues you might want to address, but which are not outright errors.'; $string['questiontext'] = 'Question text'; -// @codingStandardsIgnoreStart +// phpcs:ignore $string['questiontext_help'] = 'The question text is CASText. This is the "question" which the student actually sees. You must put input elements, and the validation strings, in this field, and only in this field. For example, using `[[input:ans1]] [[validation:ans1]]`.'; -// @codingStandardsIgnoreEnd $string['questiontext_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php/Authoring/CASText.md#question_text'; $string['questiontextnonempty'] = 'The question text must be non-empty.'; $string['questiontextmustcontain'] = 'The question text must contain the token \'{$a}\'.'; diff --git a/stack/cas/castext2/blocks/foreach.block.php b/stack/cas/castext2/blocks/foreach.block.php index 847a4874b64..fda36903dd1 100644 --- a/stack/cas/castext2/blocks/foreach.block.php +++ b/stack/cas/castext2/blocks/foreach.block.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stateful. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../block.interface.php'); diff --git a/vle_specific.php b/vle_specific.php index 54e22ea675d..0d2a1504773 100644 --- a/vle_specific.php +++ b/vle_specific.php @@ -14,6 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, see . +/** + * @package qtype_stack + * @copyright 2024 University of Edinburgh. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + defined('MOODLE_INTERNAL') || die(); global $CFG; // This file defines question_display_options which the next class extends. From 8c755b6f0c0ea8374f689c7d5e30093b31b1a053 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Thu, 12 Dec 2024 17:04:14 +0000 Subject: [PATCH 08/23] code-tidy - Add return type for tests --- tests/answertest_general_cas_test.php | 213 ++++++---- tests/api_controller_test.php | 51 ++- tests/api_stackquestionloader_test.php | 9 +- tests/api_tests_stateful_test.php | 42 +- tests/ast_container_test.php | 174 +++++--- tests/caskeyval_exception_test.php | 21 +- tests/caskeyval_test.php | 69 ++- tests/cassession2_exception_test.php | 15 +- tests/cassession2_test.php | 315 +++++++++----- tests/castext2_internals_test.php | 12 +- tests/castext2_test.php | 165 ++++--- tests/castext_exception_test.php | 6 +- tests/castext_test.php | 324 +++++++++----- tests/connection_test.php | 12 +- tests/docslib_test.php | 15 +- tests/editform_test.php | 6 +- tests/fact_sheets_test.php | 9 +- tests/graphlayout_test.php | 18 +- tests/input_algebraic_test.php | 402 ++++++++++++------ tests/input_boolean_rendering_test.php | 15 +- tests/input_boolean_validation_test.php | 24 +- tests/input_checkbox_test.php | 81 ++-- tests/input_dropdown_exception_test.php | 9 +- tests/input_dropdown_test.php | 81 ++-- tests/input_equiv_test.php | 150 ++++--- tests/input_matrix_test.php | 84 ++-- tests/input_notes_test.php | 12 +- tests/input_numerical_test.php | 210 ++++++--- tests/input_parsons_test.php | 36 +- tests/input_radio_test.php | 75 ++-- tests/input_singlechar_test.php | 12 +- tests/input_singlechar_validation_test.php | 9 +- tests/input_string_test.php | 45 +- tests/input_textarea_test.php | 51 ++- tests/input_units_test.php | 276 ++++++++---- tests/input_varmatrix_test.php | 72 ++-- tests/inputstate_test.php | 9 +- tests/mathsoutput_test.php | 3 +- tests/mathsoutputmathjax_test.php | 3 +- tests/mathsoutputmaths_test.php | 3 +- tests/mathsoutputtex_test.php | 3 +- tests/maxima_corrective_parser_test.php | 3 +- tests/maxima_replication_test.php | 39 +- tests/multilang_test.php | 27 +- tests/parser_rule_201_test.php | 6 +- tests/parser_rule_202_test.php | 3 +- tests/parser_rule_410_test.php | 9 +- tests/parser_rule_541_test.php | 15 +- tests/parser_rule_542_test.php | 15 +- tests/parser_rule_801_test.php | 21 +- tests/parsons_block_test.php | 27 +- tests/prt_test.php | 12 +- tests/qtype_stack_test_base_test.php | 6 +- tests/question_test.php | 66 ++- tests/questiontype_test.php | 54 ++- tests/responseanalysis_test.php | 42 +- tests/restore_logic_test.php | 15 +- tests/stack_options_test.php | 15 +- tests/stack_utils_test.php | 45 +- tests/studentinput_test.php | 12 +- tests/subscript_test.php | 12 +- tests/vle_specific_test.php | 3 +- tests/walkthrough_adaptive_test.php | 207 ++++++--- tests/walkthrough_deferred_cbm_test.php | 15 +- tests/walkthrough_deferred_feedback_test.php | 27 +- tests/walkthrough_immediate_feedback_test.php | 9 +- tests/walkthrough_interactive_test.php | 15 +- tests/walkthrough_survey_test.php | 9 +- 68 files changed, 2580 insertions(+), 1290 deletions(-) diff --git a/tests/answertest_general_cas_test.php b/tests/answertest_general_cas_test.php index 0fcfd61f646..4edd3a1d784 100644 --- a/tests/answertest_general_cas_test.php +++ b/tests/answertest_general_cas_test.php @@ -55,39 +55,45 @@ public function stack_answertest_general_cas_builder($sans, $tans, $atname, return new stack_answertest_general_cas($sa, $ta, $atname, $op, $options); } - public function test_is_true_for_equivalent_expressions_diff() { + public function test_is_true_for_equivalent_expressions_diff(): void { + $at = $this->stack_answertest_general_cas_builder('2*x', '2*x', 'Diff', 'x'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_equivalent_expressions_diff() { + public function test_is_false_for_equivalent_expressions_diff(): void { + $at = $this->stack_answertest_general_cas_builder('x^3/3', '2*x', 'Diff', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_null_for_missing_option_diff() { + public function test_is_null_for_missing_option_diff(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '2*x', 'Diff', ''); $this->assertNull($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_for_equal_expressions_algequiv() { + public function test_is_true_for_equal_expressions_algequiv(): void { + $at = $this->stack_answertest_general_cas_builder('1', '1', 'AlgEquiv'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); $this->assertEquals('', $at->get_at_feedback()); } - public function test_is_false_for_unequal_expressions_algequiv() { + public function test_is_false_for_unequal_expressions_algequiv(): void { + $at = $this->stack_answertest_general_cas_builder('x^2+2*x-1', '(x+1)^2', 'AlgEquiv'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('', $at->get_at_feedback()); } - public function test_is_false_for_expressions_with_different_type_algequiv() { + public function test_is_false_for_expressions_with_different_type_algequiv(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '[a,b,c]', 'AlgEquiv'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -96,7 +102,8 @@ public function test_is_false_for_expressions_with_different_type_algequiv() { $this->assertEquals("ATAlgEquiv_SA_not_list.", $at->get_at_answernote()); } - public function test_algequivfeedback_1() { + public function test_algequivfeedback_1(): void { + $at = $this->stack_answertest_general_cas_builder('[1,2]', '[1,2,3]', 'AlgEquiv'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -107,7 +114,8 @@ public function test_algequivfeedback_1() { $this->assertEquals("ATList_wronglen.", $at->get_at_answernote()); } - public function test_algequivfeedback_2() { + public function test_algequivfeedback_2(): void { + $at = $this->stack_answertest_general_cas_builder('x', '{1,2,3}', 'AlgEquiv'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -116,7 +124,8 @@ public function test_algequivfeedback_2() { $this->assertEquals("ATAlgEquiv_SA_not_set.", $at->get_at_answernote()); } - public function test_algequivfeedback_3() { + public function test_algequivfeedback_3(): void { + $at = $this->stack_answertest_general_cas_builder('{1,2}', '{1,2,3}', 'AlgEquiv'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -125,67 +134,78 @@ public function test_algequivfeedback_3() { $this->assertEquals("ATSet_wrongsz.", $at->get_at_answernote()); } - public function test_is_true_for_equal_expressions_comass() { + public function test_is_true_for_equal_expressions_comass(): void { + $at = $this->stack_answertest_general_cas_builder('x+y', 'x+y', 'EqualComAss'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_unequal_expressions_comass() { + public function test_is_false_for_unequal_expressions_comass(): void { + $at = $this->stack_answertest_general_cas_builder('x+x', '2*x', 'EqualComAss'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_false_for_expressions_with_different_type_comass() { + public function test_is_false_for_expressions_with_different_type_comass(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '[a,b,c]', 'EqualComAss'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_for_equal_expressions_caseq() { + public function test_is_true_for_equal_expressions_caseq(): void { + $at = $this->stack_answertest_general_cas_builder('x+y', 'x+y', 'CasEqual'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_unequal_expressions_caseq() { + public function test_is_false_for_unequal_expressions_caseq(): void { + $at = $this->stack_answertest_general_cas_builder('(1-x)^2', '(x-1)^2', 'CasEqual'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_false_for_expressions_with_different_type_caseq() { + public function test_is_false_for_expressions_with_different_type_caseq(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '[a,b,c]', 'CasEqual'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_sametype() { + public function test_is_true_sametype(): void { + $at = $this->stack_answertest_general_cas_builder('x+1', 'x^3+x', 'SameType'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_sametype() { + public function test_is_false_sametype(): void { + $at = $this->stack_answertest_general_cas_builder('x^2+2*x-1', '{(x+1)^2}', 'SameType'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_substequiv() { + public function test_is_true_substequiv(): void { + $at = $this->stack_answertest_general_cas_builder('a^2+b^2=c^2', 'x^2+y^2=z^2', 'SubstEquiv', '[]'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_substequiv() { + public function test_is_false_substequiv(): void { + $at = $this->stack_answertest_general_cas_builder('2*x', '3*z', 'SubstEquiv', '[]'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_substequiv_op_true() { + public function test_is_substequiv_op_true(): void { + $at = $this->stack_answertest_general_cas_builder('A*cos(t)+B', 'P*cos(t)+Q', 'SubstEquiv', '[t]'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); @@ -193,7 +213,8 @@ public function test_is_substequiv_op_true() { $this->assertEquals('ATSubstEquiv(A*cos(t)+B, P*cos(t)+Q, [t]);', $at->get_trace(false)); } - public function test_is_substequiv_op_false() { + public function test_is_substequiv_op_false(): void { + $at = $this->stack_answertest_general_cas_builder('A*cos(x)+B', 'P*cos(t)+Q', 'SubstEquiv', '[t]'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -201,120 +222,139 @@ public function test_is_substequiv_op_false() { $this->assertEquals('ATSubstEquiv(A*cos(x)+B, P*cos(t)+Q, [t]);', $at->get_trace(false)); } - public function test_is_true_for_equal_expressions_expanded() { + public function test_is_true_for_equal_expressions_expanded(): void { + $at = $this->stack_answertest_general_cas_builder('x^2+2*x-1', 'x^2+2*x-1', 'Expanded'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_unequal_expressions_expanded() { + public function test_is_false_for_unequal_expressions_expanded(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'Expanded'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('ATExpanded((x+1)^2, (x+1)^2, null);', $at->get_trace(false)); } - public function test_is_true_for_equal_expression_facforms() { + public function test_is_true_for_equal_expression_facforms(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'FacForm', 'x'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); $this->assertEquals('ATFacForm((x+1)^2, (x+1)^2, x);', $at->get_trace(false)); } - public function test_is_false_for_unequal_expressions_facform() { + public function test_is_false_for_unequal_expressions_facform(): void { + $at = $this->stack_answertest_general_cas_builder('x^2+2*x+1', '(x+1)^2', 'FacForm', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_null_for_missing_option_facform() { + public function test_is_null_for_missing_option_facform(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'FacForm', ''); $this->assertNull($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_atsinglefrac() { + public function test_is_true_atsinglefrac(): void { + $at = $this->stack_answertest_general_cas_builder('1/(x*(x+1))', '1/(x*(x+1))', 'SingleFrac'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_atsinglefrac() { + public function test_is_false_atsinglefrac(): void { + $at = $this->stack_answertest_general_cas_builder('1/n+1/(n+1)', '1/n+1/(n+1)', 'SingleFrac'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_partfrac() { + public function test_is_true_partfrac(): void { + $at = $this->stack_answertest_general_cas_builder('1/n+1/(n+1)', '1/n+1/(n+1)', 'PartFrac', 'n'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_partfrac() { + public function test_is_false_partfrac(): void { + $at = $this->stack_answertest_general_cas_builder('1/(x*(x+1))', '1/(x*(x+1))', 'PartFrac', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('ATPartFrac(1/(x*(x+1)), 1/(x*(x+1)), x);', $at->get_trace(false)); } - public function test_is_null_for_missing_option_partfrac() { + public function test_is_null_for_missing_option_partfrac(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'PartFrac', ''); $this->assertNull($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals([true, ''], $at->validate_atoptions('x')); } - public function test_is_true_for_completed_quadratics_compsquare() { + public function test_is_true_for_completed_quadratics_compsquare(): void { + $at = $this->stack_answertest_general_cas_builder('(x-1)^2-2', '(x-1)^2-2', 'CompSquare', 'x'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_wrong_form_compsquare() { + public function test_is_false_for_wrong_form_compsquare(): void { + $at = $this->stack_answertest_general_cas_builder('x^2+2*x+1', '(x+1)^2', 'CompSquare', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('ATCompSquare(x^2+2*x+1, (x+1)^2, x);', $at->get_trace(false)); } - public function test_is_null_for_missing_option_compsquare() { + public function test_is_null_for_missing_option_compsquare(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'CompSquare', ''); $this->assertNull($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_for_equal_expressions_gt() { + public function test_is_true_for_equal_expressions_gt(): void { + $at = $this->stack_answertest_general_cas_builder('2', '1', 'GT'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_true_for_equal_expressions_gte() { + public function test_is_true_for_equal_expressions_gte(): void { + $at = $this->stack_answertest_general_cas_builder('2', '1', 'GTE'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_true_for_equivalent_expressions_int() { + public function test_is_true_for_equivalent_expressions_int(): void { + $at = $this->stack_answertest_general_cas_builder('x^3/3+c', 'x^3/3', 'Int', 'x'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_equivalent_expressions_int() { + public function test_is_false_for_equivalent_expressions_int(): void { + $at = $this->stack_answertest_general_cas_builder('x^3/3', '2*x', 'Int', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_null_for_missing_option_int() { + public function test_is_null_for_missing_option_int(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'Int', ''); $this->assertNull($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_invalid_option_int() { + public function test_invalid_option_int(): void { + $at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'Int', '(x'); $this->assertNull($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -330,46 +370,53 @@ public function test_invalid_option_int() { '2*x.', $err); } - public function test_is_true_numabsolute() { + public function test_is_true_numabsolute(): void { + $at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumAbsolute', '0.05'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_numabsolute() { + public function test_is_false_numabsolute(): void { + $at = $this->stack_answertest_general_cas_builder('1.0501', '1', 'NumAbsolute', '0.01'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('ATNumAbsolute(1.0501, 1, 0.01);', $at->get_trace(false)); } - public function test_is_missingopt_numabsolute() { + public function test_is_missingopt_numabsolute(): void { + $at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumAbsolute'); // If the option is missing then we take 5% of the teacher's answer. $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_numrelative() { + public function test_is_true_numrelative(): void { + $at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumRelative', '0.05'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_numrelative() { + public function test_is_false_numrelative(): void { + $at = $this->stack_answertest_general_cas_builder('1.0501', '1', 'NumRelative', '0.01'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_missingopt_numrelative() { + public function test_is_missingopt_numrelative(): void { + $at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumRelative'); // If the option is missing then we take 5%. $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_invalidopt_numrelative() { + public function test_is_invalidopt_numrelative(): void { + $at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumRelative', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -406,7 +453,8 @@ public function test_is_invalidopt_numrelative() { // This needs to be converted into something which can be translated by Moodle. // This is the role of stack_maxima_translate in locallib.php. // @codingStandardsIgnoreEND - public function test_stack_maxima_translate_int() { + public function test_stack_maxima_translate_int(): void { + $at = $this->stack_answertest_general_cas_builder('x^6', 'x^6/6', 'Int', 'x'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); @@ -418,7 +466,8 @@ public function test_stack_maxima_translate_int() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_stack_maxima_translate_algequiv_list() { + public function test_stack_maxima_translate_algequiv_list(): void { + // This test points out which element in the list is incorrect. $at = $this->stack_answertest_general_cas_builder('[x^2,x^2,x^4]', '[x^2,x^3,x^4]', 'AlgEquiv'); $this->assertFalse($at->do_test()); @@ -432,7 +481,8 @@ public function test_stack_maxima_translate_algequiv_list() { $this->assert_content_with_maths_equals($fbt, stack_maxima_translate($at->get_at_feedback())); } - public function test_stack_maxima_translate_algequiv_list_decimals() { + public function test_stack_maxima_translate_algequiv_list_decimals(): void { + // This test points out which element in the list is incorrect. $options = new stack_options(); $options->set_option('decimals', ','); @@ -448,7 +498,8 @@ public function test_stack_maxima_translate_algequiv_list_decimals() { $this->assert_content_with_maths_equals($fbt, stack_maxima_translate($at->get_at_feedback())); } - public function test_stack_maxima_translate_algequiv_matrix() { + public function test_stack_maxima_translate_algequiv_matrix(): void { + // Matrices have newline characters in them. $at = $this->stack_answertest_general_cas_builder('matrix([1,2],[2,4])', 'matrix([1,2],[3,4])', 'AlgEquiv'); $this->assertFalse($at->do_test()); @@ -463,7 +514,8 @@ public function test_stack_maxima_translate_algequiv_matrix() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_stack_maxima_int_feedback_1() { + public function test_stack_maxima_int_feedback_1(): void { + $at = $this->stack_answertest_general_cas_builder('((5*%e^7*x-%e^7)*%e^(5*x))', '((5*%e^7*x-%e^7)*%e^(5*x))/25+c', 'Int', 'x'); $this->assertFalse($at->do_test()); @@ -477,7 +529,8 @@ public function test_stack_maxima_int_feedback_1() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_stack_maxima_int_feedback_2() { + public function test_stack_maxima_int_feedback_2(): void { + $at = $this->stack_answertest_general_cas_builder('((5*%e^7*x-%e^7)*%e^(5*x))', '((5*%e^7*x-%e^7)*%e^(5*x))/25+c', 'Int', '[x,x*%e^(5*x+7)]'); $this->assertFalse($at->do_test()); @@ -490,7 +543,8 @@ public function test_stack_maxima_int_feedback_2() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_stack_maxima_int_feedback_3() { + public function test_stack_maxima_int_feedback_3(): void { + $at = $this->stack_answertest_general_cas_builder('e^-(4*pi*x)/(4*pi)', 'int(exp(-4*pi*x),x)', 'Int', '[x,NOCONST]'); $this->assertFalse($at->do_test()); @@ -502,35 +556,40 @@ public function test_stack_maxima_int_feedback_3() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_is_true_units_relative() { + public function test_is_true_units_relative(): void { + $at = $this->stack_answertest_general_cas_builder('3.1*m/s', '3.2*m/s', 'UnitsRelative', '0.1'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); $this->assertEquals('ATUnits_units_match.', $at->get_at_answernote()); } - public function test_is_false_units_relative() { + public function test_is_false_units_relative(): void { + $at = $this->stack_answertest_general_cas_builder('3.0*m/s', '3.2*m/s', 'UnitsRelative', '0.05'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('ATUnits_units_match.', $at->get_at_answernote()); } - public function test_is_true_units_absolute() { + public function test_is_true_units_absolute(): void { + $at = $this->stack_answertest_general_cas_builder('3.1*m/s', '3.2*m/s', 'UnitsAbsolute', '0.2'); $this->assertTrue($at->do_test()); $this->assertEquals(1, $at->get_at_mark()); $this->assertEquals('ATUnits_units_match.', $at->get_at_answernote()); } - public function test_is_false_units_absolute() { + public function test_is_false_units_absolute(): void { + $at = $this->stack_answertest_general_cas_builder('3.1*m/s', '3.2*m/s', 'UnitsAbsolute', '0.05'); $this->assertFalse($at->do_test()); $this->assertEquals(0, $at->get_at_mark()); $this->assertEquals('ATUnits_units_match.', $at->get_at_answernote()); } - public function test_equiv_true() { + public function test_equiv_true(): void { + $at = $this->stack_answertest_general_cas_builder('[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]', '[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]', 'Equiv', 'null'); $this->assertTrue($at->do_test()); @@ -541,7 +600,8 @@ public function test_equiv_true() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_equiv_false() { + public function test_equiv_false(): void { + $at = $this->stack_answertest_general_cas_builder('[x^2-1=0,(x-1)*(x+1)=0,x=i or x=-1]', '[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]', 'Equiv', 'null'); $this->assertFalse($at->do_test()); @@ -552,7 +612,8 @@ public function test_equiv_false() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_equiv_comment() { + public function test_equiv_comment(): void { + $at = $this->stack_answertest_general_cas_builder('[x^2-1=0,(x-1)*(x+1)=0,"Could be",x=i or x=-1]', '[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]', 'Equiv', 'null'); $this->assertFalse($at->do_test()); @@ -563,7 +624,8 @@ public function test_equiv_comment() { $this->assert_content_with_maths_equals($fbt, $at->get_at_feedback()); } - public function test_is_true_for_equal_expressions() { + public function test_is_true_for_equal_expressions(): void { + $at = new stack_ans_test_controller('NumDecPlaces', stack_ast_container::make_from_teacher_source('1.01'), stack_ast_container::make_from_teacher_source('1.01'), @@ -574,7 +636,8 @@ public function test_is_true_for_equal_expressions() { $this->assertTrue(stack_ans_test_controller::required_atoptions('NumDecPlaces')); } - public function test_is_false_for_unequal_expressions() { + public function test_is_false_for_unequal_expressions(): void { + $at = new stack_ans_test_controller('NumDecPlaces', stack_ast_container::make_from_teacher_source('2'), stack_ast_container::make_from_teacher_source('1'), @@ -584,7 +647,8 @@ public function test_is_false_for_unequal_expressions() { $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_false_for_unequal_expressions_2() { + public function test_is_false_for_unequal_expressions_2(): void { + $at = new stack_ans_test_controller('NumDecPlaces', stack_ast_container::make_from_teacher_source('2.000'), stack_ast_container::make_from_teacher_source('1'), @@ -595,7 +659,8 @@ public function test_is_false_for_unequal_expressions_2() { $this->assertEquals('ATNumDecPlaces_Correct. ATNumDecPlaces_Not_equiv.', $at->get_at_answernote()); } - public function test_is_true_for_equal_strings() { + public function test_is_true_for_equal_strings(): void { + $at = new stack_ans_test_controller('String', stack_ast_container::make_from_teacher_source('"hello"'), stack_ast_container::make_from_teacher_source('"hello"')); @@ -604,7 +669,8 @@ public function test_is_true_for_equal_strings() { $this->assertEquals('', $at->get_at_answernote()); } - public function test_is_false_for_unequal_strings() { + public function test_is_false_for_unequal_strings(): void { + $at = new stack_ans_test_controller('String', stack_ast_container::make_from_teacher_source('"hello"'), stack_ast_container::make_from_teacher_source('"heloo"'), @@ -613,7 +679,8 @@ public function test_is_false_for_unequal_strings() { $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_false_for_strings_with_different_case() { + public function test_is_false_for_strings_with_different_case(): void { + $at = new stack_ans_test_controller('String', stack_ast_container::make_from_teacher_source('"Hello"'), stack_ast_container::make_from_teacher_source('"hello"'), @@ -622,7 +689,8 @@ public function test_is_false_for_strings_with_different_case() { $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_for_equal_strings_sloppy() { + public function test_is_true_for_equal_strings_sloppy(): void { + $at = new stack_ans_test_controller('StringSloppy', stack_ast_container::make_from_teacher_source('"hello"'), stack_ast_container::make_from_teacher_source('"hello"'), @@ -631,7 +699,8 @@ public function test_is_true_for_equal_strings_sloppy() { $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_false_for_unequal_strings_sloppy() { + public function test_is_false_for_unequal_strings_sloppy(): void { + $at = new stack_ans_test_controller('StringSloppy', stack_ast_container::make_from_teacher_source('"hello"'), stack_ast_container::make_from_teacher_source('"heloo"'), @@ -640,7 +709,8 @@ public function test_is_false_for_unequal_strings_sloppy() { $this->assertEquals(0, $at->get_at_mark()); } - public function test_is_true_for_strings_with_different_case_sloppy() { + public function test_is_true_for_strings_with_different_case_sloppy(): void { + $at = new stack_ans_test_controller('StringSloppy', stack_ast_container::make_from_teacher_source('"Hello"'), stack_ast_container::make_from_teacher_source('"hello"'), @@ -649,7 +719,8 @@ public function test_is_true_for_strings_with_different_case_sloppy() { $this->assertEquals(1, $at->get_at_mark()); } - public function test_is_true_for_nearly_equal_strings_sloppy() { + public function test_is_true_for_nearly_equal_strings_sloppy(): void { + $at = new stack_ans_test_controller('StringSloppy', stack_ast_container::make_from_teacher_source('"hel lo"'), stack_ast_container::make_from_teacher_source('"Hello"'), diff --git a/tests/api_controller_test.php b/tests/api_controller_test.php index 7d70d62c421..03164df5c6b 100644 --- a/tests/api_controller_test.php +++ b/tests/api_controller_test.php @@ -92,7 +92,8 @@ public function setUp(): void { ->getMock(); // Need to use callback so data can be altered in each test. $this->request->method("getParsedBody")->will($this->returnCallback( - function() { + function(): void { + return $this->requestdata; }) ); @@ -120,7 +121,8 @@ function() { ->getMock(); $this->result->expects($this->any())->method('write')->will($this->returnCallback( - function() { + function(): void { + $this->output = json_decode(func_get_args()[0]); return 1; }) @@ -130,7 +132,8 @@ function() { // so we have to mock both. We override the write method to write to a propery of the testsuite // so we have something easily accessible to perform some asserts on. $this->response->expects($this->any())->method('getBody')->will($this->returnCallback( - function() { + function(): void { + return $this->result; }) ); @@ -147,7 +150,8 @@ public static function tearDownAfterClass(): void { set_config('stackapi', false, 'qtype_stack'); } - public function test_render() { + public function test_render(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices'); $rc = new RenderController(); $rc->__invoke($this->request, $this->response, []); @@ -165,7 +169,8 @@ public function test_render() { $this->assertEquals(0, count($this->output->iframes)); } - public function test_render_specified_seed() { + public function test_render_specified_seed(): void { + $this->requestdata['seed'] = 219862533; $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices'); $rc = new RenderController(); @@ -174,7 +179,8 @@ public function test_render_specified_seed() { $this->assertEquals(219862533, $this->output->questionseed); } - public function test_render_plots() { + public function test_render_plots(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('plots'); $rc = new RenderController(); $rc->__invoke($this->request, $this->response, []); @@ -185,21 +191,24 @@ public function test_render_plots() { $this->assertEquals(true, isset($this->output->questionassets->{'input-ans1-4-0.svg'})); } - public function test_render_iframes() { + public function test_render_iframes(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('iframes'); $rc = new RenderController(); $rc->__invoke($this->request, $this->response, []); $this->assertEquals(1, count($this->output->iframes)); } - public function test_render_download() { + public function test_render_download(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('download'); $rc = new RenderController(); $rc->__invoke($this->request, $this->response, []); $this->assertMatchesRegularExpression('/javascript\:download\(\'data.csv\'\, 1\)/s', $this->output->questionrender); } - public function test_validation() { + public function test_validation(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices'); $this->requestdata['answers'] = (array) json_decode(stack_api_test_data::get_answer_string('matrices_correct')); $this->requestdata['inputName'] = 'ans1'; @@ -210,7 +219,8 @@ public function test_validation() { $this->assertEquals(0, count($this->output->iframes)); } - public function test_grade() { + public function test_grade(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices'); $this->requestdata['answers'] = (array) json_decode(stack_api_test_data::get_answer_string('matrices_correct')); $this->requestdata['inputName'] = 'ans1'; @@ -229,7 +239,8 @@ public function test_grade() { $this->assertEquals(0, count($this->output->iframes)); } - public function test_grade_scores() { + public function test_grade_scores(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('multipleanswers'); $this->requestdata['answers'] = (array) json_decode(stack_api_test_data::get_answer_string('multiple_mixed')); $this->requestdata['inputName'] = 'ans1'; @@ -249,7 +260,8 @@ public function test_grade_scores() { $this->assertEquals(10, $this->output->scoreweights->total); } - public function test_download() { + public function test_download(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('download'); $this->requestdata['filename'] = 'data.csv'; $this->requestdata['fileid'] = 1; @@ -264,7 +276,8 @@ public function test_download() { $this->expectOutputRegex('/^A,B,C\n0.37,5.04,2.72/s'); } - public function test_test_controller() { + public function test_test_controller(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices'); $this->requestdata['filepath'] = 'testpath/test.xml'; $tc = new TestController(); @@ -284,7 +297,8 @@ public function test_test_controller() { $this->assertEquals(4, count(get_object_vars($results->results->{'86'}->outcomes))); } - public function test_test_controller_fail() { + public function test_test_controller_fail(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('test'); $this->requestdata['filepath'] = 'testpath/test.xml'; $tc = new TestController(); @@ -305,7 +319,8 @@ public function test_test_controller_fail() { $this->assertEquals(2, count(get_object_vars($results->results->noseed->outcomes))); } - public function test_test_controller_upgrade() { + public function test_test_controller_upgrade(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('test2'); $this->requestdata['filepath'] = 'testpath/test.xml'; $tc = new TestController(); @@ -321,7 +336,8 @@ public function test_test_controller_upgrade() { $this->assertEquals([], $results->results); } - public function test_test_controller_default_test_fail() { + public function test_test_controller_default_test_fail(): void { + $this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('test3'); $this->requestdata['filepath'] = 'testpath/test.xml'; $tc = new TestController(); @@ -338,7 +354,8 @@ public function test_test_controller_default_test_fail() { $this->assertEquals(0, $results->results->noseed->passes); } - public function test_test_controller_default_test_pass() { + public function test_test_controller_default_test_pass(): void { + $this->requestdata['questionDefinition'] = str_replace('wrong', 'ta', stack_api_test_data::get_question_string('test3')); $this->requestdata['filepath'] = 'testpath/test.xml'; diff --git a/tests/api_stackquestionloader_test.php b/tests/api_stackquestionloader_test.php index 1598e3f2e19..a8796ac5b2c 100644 --- a/tests/api_stackquestionloader_test.php +++ b/tests/api_stackquestionloader_test.php @@ -40,7 +40,8 @@ */ class api_stackquestionloader_test extends qtype_stack_testcase { - public function test_question_loader() { + public function test_question_loader(): void { + $xml = stack_api_test_data::get_question_string('matrices'); $ql = new StackQuestionLoader(); $question = $ql->loadXML($xml)['question']; @@ -65,7 +66,8 @@ public function test_question_loader() { $this->assertEquals(3, count($question->deployedseeds)); } - public function test_question_loader_use_defaults() { + public function test_question_loader_use_defaults(): void { + global $CFG; $xml = stack_api_test_data::get_question_string('usedefaults'); $ql = new StackQuestionLoader(); @@ -96,7 +98,8 @@ public function test_question_loader_use_defaults() { $this->assertEquals($question->inputs['ans1']->get_parameter('boxWidth'), get_config('qtype_stack', 'inputboxsize')); } - public function test_question_loader_do_not_use_defaults() { + public function test_question_loader_do_not_use_defaults(): void { + global $CFG; $xml = stack_api_test_data::get_question_string('optionset'); $ql = new StackQuestionLoader(); diff --git a/tests/api_tests_stateful_test.php b/tests/api_tests_stateful_test.php index fbb5eba12df..43adee73ec6 100644 --- a/tests/api_tests_stateful_test.php +++ b/tests/api_tests_stateful_test.php @@ -57,14 +57,16 @@ */ class api_tests_stateful_test extends \qtype_stack_testcase { - public function test_security_map_path() { + public function test_security_map_path(): void { + $this->assertTrue(file_exists(__DIR__ . '/../stack/cas/security-map.json')); $map = file_get_contents(__DIR__ . '/../stack/cas/security-map.json'); $map = json_decode($map); $this->assertEquals(JSON_ERROR_NONE, json_last_error()); } - public function test_names_of_interfaces_and_classes() { + public function test_names_of_interfaces_and_classes(): void { + $this->assertTrue(class_exists("MP_Root")); $this->assertTrue(class_exists("MP_Statement")); $this->assertTrue(class_exists("MP_FunctionCall")); @@ -91,7 +93,8 @@ public function test_names_of_interfaces_and_classes() { $this->assertTrue(interface_exists("cas_raw_value_extractor")); } - public function test_stack_utils() { + public function test_stack_utils(): void { + $this->assertTrue(method_exists('stack_utils', 'get_config')); $this->assertTrue(method_exists('stack_utils', 'php_string_to_maxima_string')); $this->assertTrue(method_exists('stack_utils', 'maxima_string_to_php_string')); @@ -106,7 +109,8 @@ public function test_stack_utils() { $this->assertEquals(["foo", "bar", "baz"], \stack_utils::all_substring_strings('["foo","bar",1+"baz"]')); } - public function test_maxima_parser_utils() { + public function test_maxima_parser_utils(): void { + $this->assertTrue(method_exists('maxima_parser_utils', 'parse')); $this->assertTrue(method_exists('maxima_parser_utils', 'variable_usage_finder')); @@ -118,12 +122,14 @@ public function test_maxima_parser_utils() { $this->assertEquals(['sqrt' => true], $usage['calls']); } - public function test_stack_ast_container() { + public function test_stack_ast_container(): void { + $this->assertTrue(method_exists('stack_ast_container', 'get_evaluated')); $this->assertTrue(method_exists('stack_ast_container', 'get_evaluationform')); } - public function test_stack_ast_container_silent() { + public function test_stack_ast_container_silent(): void { + $this->assertTrue(method_exists('stack_ast_container_silent', 'get_evaluationform')); $this->assertTrue(method_exists('stack_ast_container_silent', 'get_errors')); $this->assertTrue(method_exists('stack_ast_container_silent', 'get_inputform')); @@ -133,45 +139,53 @@ public function test_stack_ast_container_silent() { $this->assertTrue(method_exists('stack_ast_container_silent', 'make_from_teacher_source')); } - public function test_stack_cas_security() { + public function test_stack_cas_security(): void { + $this->assertTrue(method_exists('stack_cas_security', 'set_allowedwords')); $this->assertTrue(method_exists('stack_cas_security', 'set_forbiddenwords')); $this->assertTrue(method_exists('stack_cas_security', 'get_units')); } - public function test_stack_cas_session2() { + public function test_stack_cas_session2(): void { + $this->assertTrue(method_exists('stack_cas_session2', 'get_valid')); $this->assertTrue(method_exists('stack_cas_session2', 'get_errors')); $this->assertTrue(method_exists('stack_cas_session2', 'get_session')); $this->assertTrue(method_exists('stack_cas_session2', 'instantiate')); } - public function test_stack_cas_keyval() { + public function test_stack_cas_keyval(): void { + $this->assertTrue(method_exists('stack_cas_keyval', 'get_session')); $this->assertTrue(method_exists('stack_cas_keyval', 'get_variable_usage')); } - public function test_stack_maths() { + public function test_stack_maths(): void { + $this->assertTrue(method_exists('stack_maths', 'process_display_castext')); } - public function test_stack_options() { + public function test_stack_options(): void { + $this->assertTrue(method_exists('stack_options', 'set_option')); $this->assertTrue(method_exists('stack_options', 'get_option')); $this->assertTrue(method_exists('stack_options', 'set_site_defaults')); } - public function test_stack_secure_loader() { + public function test_stack_secure_loader(): void { + $this->assertTrue(method_exists('stack_secure_loader', 'get_valid')); $this->assertTrue(method_exists('stack_secure_loader', 'get_evaluationform')); } - public function test_stack_secure_loader_value() { + public function test_stack_secure_loader_value(): void { + $this->assertTrue(method_exists('stack_secure_loader_value', 'get_value')); } - public function test_globals() { + public function test_globals(): void { + $this->assertTrue(function_exists('stack_maxima_latex_tidy')); } } diff --git a/tests/ast_container_test.php b/tests/ast_container_test.php index 3cda5e0ab01..d10cdfa69b4 100644 --- a/tests/ast_container_test.php +++ b/tests/ast_container_test.php @@ -42,7 +42,8 @@ */ class ast_container_test extends qtype_stack_testcase { - public function test_types() { + public function test_types(): void { + $matrix = stack_ast_container::make_from_teacher_source('foo:matrix([1,2],[3,4])', 'type test', new stack_cas_security()); $this->assertTrue($matrix->is_matrix()); $this->assertFalse($matrix->is_int()); @@ -84,7 +85,8 @@ public function test_types() { $this->assertEquals(3, $list->is_list()); } - public function test_list_accessor() { + public function test_list_accessor(): void { + $list = stack_ast_container::make_from_teacher_source('x:[1,2*x,3-4]', 'list access test', new stack_cas_security()); $this->assertEquals(3, $list->is_list()); @@ -102,7 +104,8 @@ public function get_valid($s, $st, $te) { $this->assertEquals($te, $at2->get_valid()); } - public function test_get_valid() { + public function test_get_valid(): void { + $cases = [ ['', false, true], ['1', true, true], @@ -141,7 +144,8 @@ public function test_get_valid() { } } - public function test_get_valid_inequalities() { + public function test_get_valid_inequalities(): void { + $cases = [ ['x>1 and x<4', true, true], ['not (x>1)', true, true], @@ -161,7 +165,8 @@ public function test_get_valid_inequalities() { } } - public function test_validation_alias() { + public function test_validation_alias(): void { + $casstring = stack_ast_container::make_from_student_source(json_decode('"\u03C0"').'*r^2', '', new stack_cas_security()); $casstring->get_valid(); $this->assertEquals($casstring->get_evaluationform(), '%pi*r^2'); @@ -169,7 +174,8 @@ public function test_validation_alias() { $this->assertEquals('', $casstring->get_answernote()); } - public function test_validation_unicode() { + public function test_validation_unicode(): void { + // Note the error with the * in this expression. $casstring = stack_ast_container::make_from_student_source(json_decode('"\u212F"').'*^x', '', new stack_cas_security()); $casstring->get_valid(); @@ -180,7 +186,8 @@ public function test_validation_unicode() { $this->assertEquals('ParseError', $casstring->get_answernote()); } - public function test_validation_error() { + public function test_validation_error(): void { + // Consider A union B. $casstring = stack_ast_container::make_from_student_source('A ' . json_decode('"\u222A"') . ' B', '', new stack_cas_security()); @@ -190,7 +197,8 @@ public function test_validation_error() { $this->assertEquals('forbiddenChar', $casstring->get_answernote()); } - public function test_spurious_operators() { + public function test_spurious_operators(): void { + $casstring = stack_ast_container::make_from_student_source('2/*x', '', new stack_cas_security()); $casstring->get_valid(); $this->assertEquals('Unknown operator: /*.', @@ -198,7 +206,8 @@ public function test_spurious_operators() { $this->assertEquals('spuriousop', $casstring->get_answernote()); } - public function test_spurious_operators_2() { + public function test_spurious_operators_2(): void { + $casstring = stack_ast_container::make_from_student_source('x==2*x', '', new stack_cas_security()); $casstring->get_valid(); $this->assertEquals('Unknown operator: ==.', @@ -206,7 +215,8 @@ public function test_spurious_operators_2() { $this->assertEquals('spuriousop', $casstring->get_answernote()); } - public function test_global_forbidden_words() { + public function test_global_forbidden_words(): void { + $s = 'system("rm *")'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); @@ -222,7 +232,8 @@ public function test_global_forbidden_words() { $this->assertEquals('forbiddenFunction', $at1->get_answernote()); } - public function test_global_forbidden_words_case() { + public function test_global_forbidden_words_case(): void { + // This is a change of behaviour in Dec 2018. $s = 'System("rm *")'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); @@ -237,7 +248,8 @@ public function test_global_forbidden_words_case() { $this->assertEquals('', $at2->get_answernote()); } - public function test_teacher_only_words() { + public function test_teacher_only_words(): void { + $s = 'setelmx(2,1,1,C)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); @@ -250,7 +262,8 @@ public function test_teacher_only_words() { $this->assertEquals('', $at2->get_errors()); } - public function test_allow_words() { + public function test_allow_words(): void { + $s = '2*dumvariable+3'; $secrules = new stack_cas_security(); $secrules->set_allowedwords('dumvariable'); @@ -258,7 +271,8 @@ public function test_allow_words() { $this->assertTrue($at1->get_valid()); } - public function test_allow_words_fail() { + public function test_allow_words_fail(): void { + $s = 'sin(2*dumvariable+3)'; $secrules = new stack_cas_security(); $secrules->set_allowedwords('dvariable'); @@ -266,7 +280,8 @@ public function test_allow_words_fail() { $this->assertFalse($at1->get_valid()); } - public function test_allow_words_teacher() { + public function test_allow_words_teacher(): void { + $s = 'sin(2*dumvariable+3)'; $secrules = new stack_cas_security(); $secrules->set_allowedwords('dvariable'); @@ -274,7 +289,8 @@ public function test_allow_words_teacher() { $this->assertTrue($at1->get_valid()); } - public function test_check_external_forbidden_words() { + public function test_check_external_forbidden_words(): void { + $cases = [ ['sin(ta)', 'ta', false, 'forbiddenVariable'], ['sin(ta)', 'ta,a,b', false, 'forbiddenVariable'], @@ -295,7 +311,8 @@ public function test_check_external_forbidden_words() { } } - public function test_check_external_forbidden_words_literal() { + public function test_check_external_forbidden_words_literal(): void { + $cases = [ ['3+5', '+', false], ['sin(a)', 'a', false], // It includes single letters. @@ -317,19 +334,22 @@ public function test_check_external_forbidden_words_literal() { } } - public function test_strings_1() { + public function test_strings_1(): void { + $s = 'a:"hello"'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); } - public function test_strings_2() { + public function test_strings_2(): void { + $s = 'a:["2x)",3*x]'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); } - public function test_strings_mismatched_string_delimiters() { + public function test_strings_mismatched_string_delimiters(): void { + $s = 'a:""hello""'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); @@ -384,7 +404,8 @@ public function test_strings_mismatched_string_delimiters() { $this->assertEquals('You are missing a quotation sign ". ', $at1->get_errors()); } - public function test_system_execution() { + public function test_system_execution(): void { + // First the obvious one, just eval that string. $s = 'a:eval_string("system(\\"rm /tmp/test\\")")'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); @@ -519,75 +540,86 @@ public function test_system_execution() { $at1->get_errors()); } - public function test_scientific_1() { + public function test_scientific_1(): void { + $s = 'a:3e2'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); $this->assertEquals('', $at1->get_answernote()); } - public function test_trig_1() { + public function test_trig_1(): void { + $s = 'a:sin[2*x]'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('trigparens', $at1->get_answernote()); } - public function test_trig_2() { + public function test_trig_2(): void { + $s = 'a:cot*2*x'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('forbiddenVariable', $at1->get_answernote()); } - public function test_trig_3() { + public function test_trig_3(): void { + $s = 'a:tan^-1(x)-1'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('missing_stars | trigexp', $at1->get_answernote()); } - public function test_trig_4() { + public function test_trig_4(): void { + $s = 'a:sin^2(x)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('missing_stars | trigexp', $at1->get_answernote()); } - public function test_trig_5() { + public function test_trig_5(): void { + $s = 'a:Sim(x)-1'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('forbiddenFunction', $at1->get_answernote()); } - public function test_trig_6() { + public function test_trig_6(): void { + $s = 'a:Sin(x)-1'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('unknownFunctionCase', $at1->get_answernote()); } - public function test_in_1() { + public function test_in_1(): void { + $s = 'a:1+In(x)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('stackCas_badLogIn', $at1->get_answernote()); } - public function test_in_2() { + public function test_in_2(): void { + $s = 'a:1+In(x)'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); } - public function test_greek_1() { + public function test_greek_1(): void { + $s = 'a:Delta-1'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); } - public function test_greek_2() { + public function test_greek_2(): void { + $s = 'a:DELTA-1'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); @@ -598,14 +630,16 @@ public function test_greek_2() { $at1->get_errors()); } - public function test_unencapsulated_commas_1() { + public function test_unencapsulated_commas_1(): void { + $s = 'a,b'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertFalse($at1->get_valid()); $this->assertEquals('unencapsulated_comma', $at1->get_answernote()); } - public function test_forbid_function_single_letter() { + public function test_forbid_function_single_letter(): void { + $s = 'a:x^2+a+f(x)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -618,7 +652,8 @@ public function test_forbid_function_single_letter() { $this->assertTrue($at1->get_valid()); } - public function test_implied_complex_mult1() { + public function test_implied_complex_mult1(): void { + $s = '-(1/512)+i(sqrt(3)/512)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -626,13 +661,15 @@ public function test_implied_complex_mult1() { $this->assertEquals('-(1/512)+i*(sqrt(3)/512)', $at1->get_inputform()); } - public function test_implied_complex_mult2() { + public function test_implied_complex_mult2(): void { + $s = '-(1/512)+i(sqrt(3)/512)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); } - public function test_semicolon() { + public function test_semicolon(): void { + $s = 'a:3;b:4'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); // This is a change in STACK 4.3. @@ -640,7 +677,8 @@ public function test_semicolon() { $this->assertEquals('', $at1->get_answernote()); } - public function test_log_sugar_1() { + public function test_log_sugar_1(): void { + $s = 'log(x)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -649,7 +687,8 @@ public function test_log_sugar_1() { $this->assertEquals('log(x)', $at1->get_inputform()); } - public function test_log_sugar_2() { + public function test_log_sugar_2(): void { + $s = 'log_10(a+x^2)+log_a(b)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -658,7 +697,8 @@ public function test_log_sugar_2() { $this->assertEquals('logsubs', $at1->get_answernote()); } - public function test_log_sugar_3() { + public function test_log_sugar_3(): void { + // Note that STACK spots there is a missing * here. // Note that in the new 4.3 world we need to define a filter to note // the star we do not want to be inserted. @@ -670,7 +710,8 @@ public function test_log_sugar_3() { $this->assertEquals('missing_stars | logsubs', $at1->get_answernote()); } - public function test_log_sugar_4() { + public function test_log_sugar_4(): void { + // The missing * in this expression is correctly inserted. $s = 'log_5x(3)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); @@ -680,7 +721,8 @@ public function test_log_sugar_4() { $this->assertEquals('missing_stars | logsubs', $at1->get_answernote()); } - public function test_log_sugar_5() { + public function test_log_sugar_5(): void { + $s = 'log_x^2(3)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -689,7 +731,8 @@ public function test_log_sugar_5() { $this->assertEquals('missing_stars | logsubs', $at1->get_answernote()); } - public function test_log_sugar_6() { + public function test_log_sugar_6(): void { + $s = 'log_%e(%e)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -698,7 +741,8 @@ public function test_log_sugar_6() { $this->assertEquals('logsubs', $at1->get_answernote()); } - public function unary_plus() { + public function unary_plus(): void { + // This is an interesting parser edge case. $s = 'p:+a^b*c'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); @@ -707,14 +751,16 @@ public function unary_plus() { $this->assertEquals('', $at1->get_answernote()); } - public function test_chained_inequalities_s() { + public function test_chained_inequalities_s(): void { + $s = 'sa:3assertFalse($at1->get_valid()); $this->assertEquals('chained_inequalities', $at1->get_answernote()); } - public function test_chained_inequalities_t() { + public function test_chained_inequalities_t(): void { + $s = 'f(x) := if x < 0 then (if x < 1 then 1 else 2) else 3'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -722,7 +768,8 @@ public function test_chained_inequalities_t() { $this->assertEquals('', $at1->get_answernote()); } - public function test_decimal_digits() { + public function test_decimal_digits(): void { + $tests = stack_numbers_test_data::get_raw_test_data(); @@ -737,7 +784,8 @@ public function test_decimal_digits() { } - public function test_decimal_digits_utils() { + public function test_decimal_digits_utils(): void { + $tests = stack_numbers_test_data::get_raw_test_data_utils(); @@ -751,7 +799,8 @@ public function test_decimal_digits_utils() { } } - public function test_spaces_1_brackets() { + public function test_spaces_1_brackets(): void { + $s = 'a (b c)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -761,7 +810,8 @@ public function test_spaces_1_brackets() { $this->assertEquals('spaces', $at1->get_answernote()); } - public function test_spaces_1_bracket_brackets() { + public function test_spaces_1_bracket_brackets(): void { + $s = '(1+c) (x+1)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -771,7 +821,8 @@ public function test_spaces_1_bracket_brackets() { $this->assertEquals('spaces', $at1->get_answernote()); } - public function test_spaces_1_logic() { + public function test_spaces_1_logic(): void { + $s = 'a b and c'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -781,7 +832,8 @@ public function test_spaces_1_logic() { $this->assertEquals('spaces', $at1->get_answernote()); } - public function test_remove_add_nouns() { + public function test_remove_add_nouns(): void { + $s = "['sum(k^2,k,1,n),'product(k^2,k,1,n),a nounand b, noundiff(y,x)+y=0, nounnot false, nounnot(false)]"; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -847,7 +899,8 @@ public function test_remove_add_nouns() { $at1->get_inputform(true, 2)); } - public function test_stacklet() { + public function test_stacklet(): void { + $s = 'stacklet(a,x*%i+y)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); @@ -867,7 +920,8 @@ public function test_stacklet() { $this->assertEquals('', $at1->get_answernote()); } - public function test_pm() { + public function test_pm(): void { + $s = 'a+-b'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -925,7 +979,8 @@ public function test_pm() { $this->assertEquals('', $at1->get_answernote()); } - public function test_input_varmatix() { + public function test_input_varmatix(): void { + $s = 'matrix([a,b],[c,d])'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); $expected = '([FunctionCall: ([Id] matrix)] ([List] ([Id] a), ([Id] b)),([List] ([Id] c), ([Id] d)))'; @@ -953,7 +1008,8 @@ public function test_input_varmatix() { ['inputform' => true, 'varmatrix' => true])); } - public function test_ntuple() { + public function test_ntuple(): void { + $s = '(x,y)'; $at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security()); $this->assertTrue($at1->get_valid()); @@ -1003,7 +1059,8 @@ public function test_ntuple() { } - public function test_identify_simplification_modifications() { + public function test_identify_simplification_modifications(): void { + $t1 = 'foo+bar'; $t1 = stack_ast_container::make_from_teacher_source($t1, '', new stack_cas_security()); $t1 = $t1->identify_simplification_modifications(); @@ -1031,7 +1088,8 @@ public function test_identify_simplification_modifications() { } - public function test_teacher_answer_decimals() { + public function test_teacher_answer_decimals(): void { + // This tests the functions which generate "The teacher's answer is". $s = '{4.4,4}'; $at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security()); diff --git a/tests/caskeyval_exception_test.php b/tests/caskeyval_exception_test.php index fc12f609d98..0c6989fe088 100644 --- a/tests/caskeyval_exception_test.php +++ b/tests/caskeyval_exception_test.php @@ -35,38 +35,45 @@ */ class caskeyval_exception_test extends qtype_stack_testcase { - public function test_exception_1() { + public function test_exception_1(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_keyval([], false, false); } - public function test_exception_2() { + public function test_exception_2(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_keyval(1, false, false); } - public function test_exception_3() { + public function test_exception_3(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_keyval('x=1', false, false); } - public function test_exception_4() { + public function test_exception_4(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_keyval('x=1', null, false); } - public function test_exception_5() { + public function test_exception_5(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_keyval('x=1', 'z', false); } - public function test_exception_7() { + public function test_exception_7(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_keyval('x=1', 't', false); } - public function test_stack_compile_unexpected_lambda() { + public function test_stack_compile_unexpected_lambda(): void { + $this->expectException(stack_exception::class); // This is related to issue #1279. $tests = 'a:b+1; c:a-a(d+1);'; diff --git a/tests/caskeyval_test.php b/tests/caskeyval_test.php index 5b3c9ff6942..3595df8c174 100644 --- a/tests/caskeyval_test.php +++ b/tests/caskeyval_test.php @@ -49,7 +49,8 @@ public function get_valid($s, $val, $session) { $kv->get_session()->get_keyval_representation()); } - public function test_get_valid() { + public function test_get_valid(): void { + $cs0 = new stack_cas_session2([], null, 123); $cs0->instantiate(); @@ -90,7 +91,8 @@ public function test_get_valid() { } } - public function test_empty_case_1() { + public function test_empty_case_1(): void { + $at1 = new stack_cas_keyval('', null, 123); $this->assertTrue($at1->get_valid()); } @@ -98,7 +100,8 @@ public function test_empty_case_1() { // Now here we have a problem, keyvals do not generate output values // they just load stuff to the session, therefore you cannot get // the instantiated values. - public function test_equations_1() { + public function test_equations_1(): void { + $at1 = new stack_cas_keyval('ta1 : x=1; ta2 : x^2-2*x=1; ta3:x=1 nounor x=2', null, 123); $at1->instantiate(); $s = $at1->get_session(); @@ -108,7 +111,8 @@ public function test_equations_1() { $this->assertEquals($s->get_by_key('ta3')->get_evaluationform(), 'ta3:x = 1 nounor x = 2'); } - public function test_equations_2() { + public function test_equations_2(): void { + $at1 = new stack_cas_keyval('ta1 : x=1$ ta2 : x^2-2*x=1$ ta3:x=1 nounor x=2', null, 123); $at1->instantiate(); $s = $at1->get_session(); @@ -118,7 +122,8 @@ public function test_equations_2() { $this->assertEquals($s->get_by_key('ta3')->get_evaluationform(), 'ta3:x = 1 nounor x = 2'); } - public function test_keyval_session_keyval_0() { + public function test_keyval_session_keyval_0(): void { + $kvin = ""; $at1 = new stack_cas_keyval($kvin, null, 123); $session = $at1->get_session(); @@ -126,7 +131,8 @@ public function test_keyval_session_keyval_0() { $this->assertEquals($kvin, $kvout); } - public function test_keyval_session_keyval_1() { + public function test_keyval_session_keyval_1(): void { + $kvin = "a:1;\nc:3;"; $at1 = new stack_cas_keyval($kvin, null, 123); $session = $at1->get_session(); @@ -134,7 +140,8 @@ public function test_keyval_session_keyval_1() { $this->assertEquals($kvin, $kvout); } - public function test_keyval_session_keyval_2() { + public function test_keyval_session_keyval_2(): void { + // Equation and function. $kvin = "ans1:x^2-2*x = 1;\nf(x):=x^2;\nsin(x^3);"; $at1 = new stack_cas_keyval($kvin, null, 123); @@ -143,7 +150,8 @@ public function test_keyval_session_keyval_2() { $this->assertEquals($kvin, $kvout); } - public function test_basic_logic() { + public function test_basic_logic(): void { + $tests = "t1: is(1>0); t2: t1 and true; t3: true or true; @@ -164,13 +172,15 @@ public function test_basic_logic() { } } - public function test_keyval_input_capture() { + public function test_keyval_input_capture(): void { + $s = 'a:x^2; ans1:a+1; ta:a^2'; $kv = new stack_cas_keyval($s, null, 123); $this->assertFalse($kv->get_valid(['ans1'])); } - public function test_remove_comment() { + public function test_remove_comment(): void { + $at1 = new stack_cas_keyval("a:1\n /* This is a comment \n b:2\n */\n c:3^2", null, 123); $this->assertTrue($at1->get_valid()); $at1->instantiate(); @@ -186,13 +196,15 @@ public function test_remove_comment() { } } - public function test_remove_comment_hanging() { + public function test_remove_comment_hanging(): void { + $at1 = new stack_cas_keyval("a:1\n /* This is an open comment \n b:2\n \n c:3^2", null, 123); $this->assertFalse($at1->get_valid()); $at1->instantiate(); } - public function test_multiline_input() { + public function test_multiline_input(): void { + $tests = "n:3;\nif is(n=3) then (\nk1:1,\nk2:2\n) else (\nk1:3,\nk2:4\n);\na:k2^2;"; $kv = new stack_cas_keyval($tests); @@ -206,7 +218,8 @@ public function test_multiline_input() { $this->assertEquals($expected, $s->get_keyval_representation(true)); } - public function test_brackets_in_strings() { + public function test_brackets_in_strings(): void { + $tests = "k1:4^2;\nprefix:\"[\";\nsuffix:\"]\";"; $kv = new stack_cas_keyval($tests); @@ -220,7 +233,8 @@ public function test_brackets_in_strings() { $this->assertEquals($expected, $s->get_keyval_representation(true)); } - public function test_ampersand_in_strings() { + public function test_ampersand_in_strings(): void { + $tests = 'k1:"~@r";n1:2*4;'; $kv = new stack_cas_keyval($tests); @@ -234,7 +248,8 @@ public function test_ampersand_in_strings() { $this->assertEquals($expected, $s->get_keyval_representation(true)); } - public function test_ampersand_outside_strings() { + public function test_ampersand_outside_strings(): void { + $tests = 'k1:u@x;n1:2*4;'; $kv = new stack_cas_keyval($tests); @@ -243,7 +258,8 @@ public function test_ampersand_outside_strings() { $this->assertEquals($expected, $kv->get_errors()); } - public function test_needs_mbstring() { + public function test_needs_mbstring(): void { + $tests = "x : rand([1,2,3])\ny : rand([2,3,4])\nA : matrix([x,2,1],[3,4,2],[1,y,5])\n" . "R : get_lu_factors(lu_factor(A))\nL : R[2]\nU : R[3]\n\n/* Help for worked solutions */\n" . @@ -268,7 +284,8 @@ public function test_needs_mbstring() { $this->assertEquals($expected, $s->get_keyval_representation()); } - public function test_usage() { + public function test_usage(): void { + // Notes, for global variable usage: // The ev case where both : and = work as the definition of values. // The block case where some variables may be listed as locals. @@ -297,7 +314,8 @@ public function test_usage() { $this->assertTrue(isset($usage['write']['V'])); } - public function test_unclear_subs() { + public function test_unclear_subs(): void { + $tests = 'v:2;trig:[sin,cos][v];sub:[(sin(x))^2=1-(cos(x))^2,(cos(x))^2=1-(sin(x))^2][v];f:(trig(x))^n;' . 'df:diff(f,x);df_simp:(subst(sub,df));ta1:expand(df_simp);'; @@ -319,7 +337,8 @@ public function test_unclear_subs() { $this->assertEquals($expected, $s->get_keyval_representation()); } - public function test_stack_seed_redef() { + public function test_stack_seed_redef(): void { + $tests = 'v:2;stack_seed:2'; $kv = new stack_cas_keyval($tests); $this->assertFalse($kv->get_valid()); @@ -330,7 +349,8 @@ public function test_stack_seed_redef() { $this->assertEquals($expected, $kv->get_errors()); } - public function test_stack_compile() { + public function test_stack_compile(): void { + $tests = 'stack_reset_vars(true);ordergreat(i,j,k);p:matrix([-7],[2],[-3]);' . 'q:matrix([i],[j],[k]);v:dotproduct(p,q);'; $kv = new stack_cas_keyval($tests); @@ -348,7 +368,8 @@ public function test_stack_compile() { $this->assertEquals($expected, $compiled['contextvariables']); } - public function test_stack_compile_preamble_end1() { + public function test_stack_compile_preamble_end1(): void { + $tests = 'stack_reset_vars(true);n1:1;ordergreat(i,j,k);%_stack_preamble_end;' . 'p:matrix([-7],[2],[-3]);' . 'q:matrix([i],[j],[k]);v:dotproduct(p,q);'; @@ -367,7 +388,8 @@ public function test_stack_compile_preamble_end1() { $this->assertEquals($expected, $compiled['contextvariables']); } - public function test_stack_compile_unexpected_lambda() { + public function test_stack_compile_unexpected_lambda(): void { + // This is related to issue #1279. $tests = 'c:(b+1)-(b+1)(d+1);'; $kv = new stack_cas_keyval($tests); @@ -378,7 +400,8 @@ public function test_stack_compile_unexpected_lambda() { $this->assertEquals($expected, $kv->get_errors()); } - public function test_stack_add_slash() { + public function test_stack_add_slash(): void { + // This is related to issue #1279. $tests = 's1:"String with LaTeX: \(x^2\).";'; $kv = new stack_cas_keyval($tests, null, 0, '', true); diff --git a/tests/cassession2_exception_test.php b/tests/cassession2_exception_test.php index 35df658d293..1019f93499b 100644 --- a/tests/cassession2_exception_test.php +++ b/tests/cassession2_exception_test.php @@ -36,28 +36,33 @@ */ class cassession2_exception_test extends qtype_stack_testcase { - public function test_exception_1() { + public function test_exception_1(): void { + $this->expectException(TypeError::class); $at1 = new stack_cas_session2("x=1", false, false); } - public function test_exception_2() { + public function test_exception_2(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_session2([], null, false); $at1->get_valid(); } - public function test_exception_3() { + public function test_exception_3(): void { + $this->expectException(stack_exception::class); $at1 = new stack_cas_session2([1, 2, 3], null, false); } - public function test_exception_4() { + public function test_exception_4(): void { + $this->expectException(TypeError::class); $at1 = new stack_cas_session2(null, 123, false); } - public function test_exception_5() { + public function test_exception_5(): void { + $pref = new stack_options(); $this->expectException(TypeError::class); $at1 = new stack_cas_session2(null, $pref, 'abc'); diff --git a/tests/cassession2_test.php b/tests/cassession2_test.php index 0481d095cc2..e2b7ffee67f 100644 --- a/tests/cassession2_test.php +++ b/tests/cassession2_test.php @@ -41,7 +41,8 @@ */ class cassession2_test extends qtype_stack_testcase { - public function test_internal_config() { + public function test_internal_config(): void { + // This test checks if the version number returned by Maxima matches our internal config. $cs = ['m:MAXIMA_VERSION_NUM']; foreach ($cs as $s) { @@ -56,7 +57,8 @@ public function test_internal_config() { $this->assertEquals($maximaconfig, $maximaversion); } - public function test_get_valid() { + public function test_get_valid(): void { + $strings = ['foo', 'bar', 'sqrt(4)']; $casstrings = []; @@ -71,7 +73,8 @@ public function test_get_valid() { $this->assertTrue($session->get_valid()); } - public function test_get_valid_false() { + public function test_get_valid_false(): void { + $strings = ['foo', 'bar', 'system(4)']; $casstrings = []; @@ -86,7 +89,8 @@ public function test_get_valid_false() { $this->assertFalse($session->get_valid()); } - public function test_instantiation_and_return_values() { + public function test_instantiation_and_return_values(): void { + $strings = [ '1+2' => '3', 'sqrt(4)' => '2', @@ -114,7 +118,8 @@ public function test_instantiation_and_return_values() { } } - public function test_keys_or_not() { + public function test_keys_or_not(): void { + // Keys are optional in the new cassession, we can extract the values // if need be even if keys do not exist, and if you do an assignement // it wont be visible in the return values anyway. @@ -145,7 +150,8 @@ public function test_keys_or_not() { } } - public function test_error() { + public function test_error(): void { + $simpon = stack_ast_container::make_from_teacher_source('simp:true', 'test_error()', new stack_cas_security()); $divzero = stack_ast_container::make_from_teacher_source('1/0', 'test_error()', new stack_cas_security()); $foo = stack_ast_container::make_from_teacher_source('sconcat("f","o","o")', 'test_error()', new stack_cas_security()); @@ -166,7 +172,8 @@ public function test_error() { $this->assertEquals(['Division by zero.'], $divzero->get_errors(true)); } - public function test_feedback() { + public function test_feedback(): void { + $simpoff = stack_ast_container::make_from_teacher_source('simp:false', 'test_answernote()', new stack_cas_security()); $validation = stack_ast_container::make_from_teacher_source('stack_validate_typeless([2/4], true, 1/2, 0, true)', 'test_answernote()', new stack_cas_security()); @@ -182,7 +189,8 @@ public function test_feedback() { $this->assertStringContainsString('lowest terms', $validation->get_feedback()); } - public function test_answertest_usage() { + public function test_answertest_usage(): void { + $qv = 'ta:diff(sin(x),x);'; $qv = new stack_cas_keyval($qv, null, 123); @@ -246,7 +254,8 @@ public function test_answertest_usage() { } - public function test_get_display() { + public function test_get_display(): void { + $cs = ['a:x^2', 'b:1/(1+x^2)', 'c:e^(i*pi)']; foreach ($cs as $s) { @@ -264,7 +273,8 @@ public function test_get_display() { } - public function test_polarform_simp() { + public function test_polarform_simp(): void { + $cs = ['p0:polarform_simp(%i+1)']; $cs[] = 'p1:polarform_simp(2)'; $cs[] = 'p2:polarform_simp(-2)'; @@ -286,7 +296,8 @@ public function test_polarform_simp() { $this->assertEquals('%e^((%i*%pi)/2)', $s1[3]->get_value()); } - public function test_multiplication_option_complexno_i() { + public function test_multiplication_option_complexno_i(): void { + $cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j']; foreach ($cs as $s) { @@ -307,7 +318,8 @@ public function test_multiplication_option_complexno_i() { $this->assertEquals('a+b\cdot j', $r->get_display()); } - public function test_multiplication_option_complexno_j() { + public function test_multiplication_option_complexno_j(): void { + $cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j']; foreach ($cs as $s) { @@ -328,7 +340,8 @@ public function test_multiplication_option_complexno_j() { $this->assertEquals('a+b\cdot \mathrm{j}', $r->get_display()); } - public function test_multiplication_option_complexno_symi() { + public function test_multiplication_option_complexno_symi(): void { + $cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j']; foreach ($cs as $s) { @@ -349,7 +362,8 @@ public function test_multiplication_option_complexno_symi() { $this->assertEquals('a+b\cdot j', $r->get_display()); } - public function test_multiplication_option_complexno_vector_order() { + public function test_multiplication_option_complexno_vector_order(): void { + $cs = ['ordergreat(i,j,k)', 'texput(i,"\\\\vec{i}")', 'texput(j,"\\\\vec{j}")', 'texput(k,"\\\\vec{k}")', 'p:j*4+3*i+5*k', 'q:j*b+a*i+c*k', ]; @@ -369,7 +383,8 @@ public function test_multiplication_option_complexno_vector_order() { $this->assertEquals('a\cdot \vec{i}+b\cdot \vec{j}+c\cdot \vec{k}', $q->get_display()); } - public function test_multiplication_option_complexno_symj() { + public function test_multiplication_option_complexno_symj(): void { + $cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j']; foreach ($cs as $s) { @@ -390,7 +405,8 @@ public function test_multiplication_option_complexno_symj() { $this->assertEquals('a+b\cdot j', $r->get_display()); } - public function test_multiplication_option_dot() { + public function test_multiplication_option_dot(): void { + $cs = ['a:x*y', 'b:x*y*z', 'c:x*(y*z)', 'd:(x*y)*z']; foreach ($cs as $s) { @@ -410,7 +426,8 @@ public function test_multiplication_option_dot() { $this->assertEquals('x\cdot y\cdot z', $s1[3]->get_display()); } - public function test_multiplication_option_none() { + public function test_multiplication_option_none(): void { + $cs = ['a:x*y', 'b:x*y*z', 'c:x*(y*z)', 'd:(x*y)*z']; foreach ($cs as $s) { @@ -430,7 +447,8 @@ public function test_multiplication_option_none() { $this->assertEquals('x\,y\,z', $s1[3]->get_display()); } - public function test_multiplication_option_cross() { + public function test_multiplication_option_cross(): void { + $cs = ['a:x*y', 'b:x*y*z', 'c:x*(y*z)', 'd:(x*y)*z']; foreach ($cs as $s) { @@ -451,7 +469,8 @@ public function test_multiplication_option_cross() { } - public function test_multiplication_option_onum() { + public function test_multiplication_option_onum(): void { + $s1 = []; $cs = ['a:2*x', 'b:2*3*x', 'c:3*5^2', 'd:3*x^2', 's1:x*(-y)', 's2:3*(-4)*x*(-y)']; @@ -495,7 +514,8 @@ public function test_multiplication_option_onum() { $this->assertEquals('3\, \left(\frac{5}{2}\right)', $s1[5]->get_display()); } - public function test_function_power_display() { + public function test_function_power_display(): void { + $cs = ['A:f(0)', 'B:f(0)^5', 'C:f(x)', 'D:f(x)^3', 'E:f(x+1)', 'F:f(x+1)^30']; $s1 = []; @@ -534,7 +554,8 @@ public function test_function_power_display() { $this->assertEquals('\sin ^{50}', $s1[6]->get_display()); } - public function test_acos_option_cosmone() { + public function test_acos_option_cosmone(): void { + $cs = ['a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30']; foreach ($cs as $s) { @@ -556,7 +577,8 @@ public function test_acos_option_cosmone() { // Babbage comlained around 1820 about people using this notation and people still use this notation! } - public function test_acos_option_acos() { + public function test_acos_option_acos(): void { + $cs = ['a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30']; foreach ($cs as $s) { @@ -575,7 +597,8 @@ public function test_acos_option_acos() { $this->assertEquals('{\rm asin}^{30}\left(x^2+1\right)', $s1[4]->get_display()); } - public function test_acos_option_arccos() { + public function test_acos_option_arccos(): void { + $cs = ['a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30']; foreach ($cs as $s) { @@ -594,7 +617,8 @@ public function test_acos_option_arccos() { $this->assertEquals('\arcsin ^{30}\left(x^2+1\right)', $s1[4]->get_display()); } - public function test_acos_option_arcosh() { + public function test_acos_option_arcosh(): void { + $cs = [ 'a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30', @@ -618,7 +642,8 @@ public function test_acos_option_arcosh() { $this->assertEquals('{\rm arsinh}^{70}\left(x\right)', $s1[6]->get_display()); } - public function test_logicsymbol_option_lang() { + public function test_logicsymbol_option_lang(): void { + $cs = ['a:A and B', 'b:A nounand B', 'c:A and (B or C)', 'd:A nounand (B nounor C)']; foreach ($cs as $s) { @@ -636,7 +661,8 @@ public function test_logicsymbol_option_lang() { $this->assertEquals('A\,{\text{ and }}\, \left(B\,{\text{ or }}\, C\right)', $s1[3]->get_display()); } - public function test_logicsymbol_option_symbol() { + public function test_logicsymbol_option_symbol(): void { + $cs = ['a:A and B', 'b:A nounand B', 'c:A and (B or C)', 'd:A nounand (B nounor C)']; foreach ($cs as $s) { @@ -654,7 +680,8 @@ public function test_logicsymbol_option_symbol() { $this->assertEquals('A\land \left(B\lor C\right)', $s1[3]->get_display()); } - public function test_keyval_representation_1() { + public function test_keyval_representation_1(): void { + $cs = ['a:x^2', 'b:1/(1+x^2)', 'c:e^(i*pi)']; foreach ($cs as $s) { @@ -666,7 +693,8 @@ public function test_keyval_representation_1() { $this->assertEquals("a:x^2;\nb:1/(1+x^2);\nc:e^(i*%pi);", $at1->get_keyval_representation()); } - public function test_keyval_representation_2() { + public function test_keyval_representation_2(): void { + $cs = ['a:(-1)^2']; foreach ($cs as $s) { @@ -679,7 +707,8 @@ public function test_keyval_representation_2() { $this->assertEquals('a:1;', $at1->get_keyval_representation(true)); } - public function test_get_display_unary_minus() { + public function test_get_display_unary_minus(): void { + $cs = ['p1:y^3-2*y^2-8*y', 'p2:y^2-2*y-8', 'p3:y^2-2*y-0.5', 'p4:x#pm#3+y', 'p5:x+(-5+y)']; // Notice the subtle difference in p4 & p5. @@ -701,7 +730,8 @@ public function test_get_display_unary_minus() { $this->assertEquals('x+\\left(-5+y\\right)', $s1[4]->get_display()); } - public function test_string1() { + public function test_string1(): void { + $cs = ['s:"This is a string"']; foreach ($cs as $s) { @@ -712,7 +742,8 @@ public function test_string1() { $this->assertEquals('"This is a string"', $s1[0]->get_value()); } - public function test_qmchar() { + public function test_qmchar(): void { + $cs = ['s:5*?+6*?', 'A:matrix([?,1],[1,?])']; foreach ($cs as $s) { @@ -727,7 +758,8 @@ public function test_qmchar() { $this->assertEquals('matrix([QMCHAR,1],[1,QMCHAR])', $s1[1]->get_value()); } - public function test_subscript_disp() { + public function test_subscript_disp(): void { + // Fails with actual display output like '{\it pi_{025}}'. $this->skip_if_old_maxima('5.23.2'); @@ -757,7 +789,8 @@ public function test_subscript_disp() { $this->assertEquals($s1[4]->get_display(), '{{\pi}_{4}}^5'); } - public function test_matrix_eigenvalues() { + public function test_matrix_eigenvalues(): void { + $cs = ['A:matrix([7,1,3],[5,-3,4],[5,3,-4])', 'E:first(eigenvalues(A))', 'dt:determinant(A)']; foreach ($cs as $s) { @@ -777,7 +810,8 @@ public function test_matrix_eigenvalues() { } - public function test_assignmatrixelements() { + public function test_assignmatrixelements(): void { + // Assign a value to matrix entries. $cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3', 'B:A']; foreach ($cs as $s) { @@ -790,7 +824,8 @@ public function test_assignmatrixelements() { $this->assertEquals('matrix([1,3],[1,1])', $s1[2]->get_value()); } - public function test_simplify_false() { + public function test_simplify_false(): void { + $cs = ['a:2+3', 'b:ev(a,simp)']; @@ -807,7 +842,8 @@ public function test_simplify_false() { $this->assertEquals('5', $s1[1]->get_value()); } - public function test_disp_control_structures() { + public function test_disp_control_structures(): void { + $csl = [ 'p:if a>b then setelmx(0,m[k],m[j],A)', @@ -844,7 +880,8 @@ public function test_disp_control_structures() { $this->assertEquals('[sin,cos,log,rho,atan]', $s1[5]->get_value()); } - public function test_redefine_variable() { + public function test_redefine_variable(): void { + // This example redefines the value of n. // It should return the last value. @@ -876,7 +913,8 @@ public function test_redefine_variable() { $this->assertEquals('36', $s1[2]->get_display()); } - public function test_indirect_redefinition_of_varibale() { + public function test_indirect_redefinition_of_varibale(): void { + // This example uses a loop to change the values of elements of C. // However the loop returns "done", and the values of C are changed. @@ -904,7 +942,8 @@ public function test_indirect_redefinition_of_varibale() { $this->assertEquals('matrix([5*4+2*6,5*5+2*5],[4*4+3*6,4*5+3*5])', $s1[6]->get_value()); } - public function test_numerical_precision() { + public function test_numerical_precision(): void { + $cs = ['a:1385715.257']; foreach ($cs as $s) { @@ -915,7 +954,8 @@ public function test_numerical_precision() { $this->assertEquals('1385715.257', $s1[0]->get_value()); } - public function test_rat() { + public function test_rat(): void { + $cs = ['a:ratsimp(sqrt(27))', 'b:rat(sqrt(27))', 'm:MAXIMA_VERSION_NUM']; foreach ($cs as $s) { @@ -940,7 +980,8 @@ public function test_rat() { } } - public function test_ordergreat() { + public function test_ordergreat(): void { + $cs = [ 'stack_reset_vars(true)', 'ordergreat(i,j,k)', 'p:matrix([-7],[2],[-3])', 'q:matrix([i],[j],[k])', 'v:dotproduct(p,q)', @@ -954,7 +995,8 @@ public function test_ordergreat() { $this->assertEquals('-7\cdot i+2\cdot j-3\cdot k', $s1[4]->get_display()); } - public function test_ordergreat_2() { + public function test_ordergreat_2(): void { + $cs = ['ordergreat(a,b,c)', 'p:matrix([-7],[2],[-3])', 'q:matrix([a],[b],[c])', 'v:dotproduct(p,q)']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []); @@ -965,7 +1007,8 @@ public function test_ordergreat_2() { $this->assertEquals('-7\cdot a+2\cdot b-3\cdot c', $s1[3]->get_display()); } - public function test_plot_constant_function() { + public function test_plot_constant_function(): void { + $cs = ['a:0', 'p:plot(a*x,[x,-2,2],[y,-2,2])']; foreach ($cs as $s) { @@ -978,7 +1021,8 @@ public function test_plot_constant_function() { $this->assertEquals('', trim($s1[0]->get_errors())); } - public function test_plot_fail() { + public function test_plot_fail(): void { + $cs = ['a:0', 'p:plot(a*x/0,[x,-2,2],[y,-2,2])']; foreach ($cs as $s) { @@ -991,7 +1035,8 @@ public function test_plot_fail() { $this->assertFalse(strpos($s1[1]->get_value(), 'STACK auto-generated plot of 0 with parameters')); } - public function test_rand_selection_err_1() { + public function test_rand_selection_err_1(): void { + $cs = ['a:rand_selection(1,1)']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []); @@ -1002,7 +1047,8 @@ public function test_rand_selection_err_1() { $this->assertEquals('rand_selection error: first argument must be a list or set.', $s1[0]->get_errors()); } - public function test_rand_selection_err_2() { + public function test_rand_selection_err_2(): void { + $cs = ['a:rand_selection([a,b,c,d], 7)']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []); @@ -1013,7 +1059,8 @@ public function test_rand_selection_err_2() { $this->assertEquals('rand_selection error: insuffient elements in the list/set.', $s1[0]->get_errors()); } - public function test_rand_selection() { + public function test_rand_selection(): void { + $cs = ['a:rand_selection([a,b,c,d], 4)', 'b:sort(a)']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []); @@ -1023,7 +1070,8 @@ public function test_rand_selection() { $this->assertEquals('[a,b,c,d]', $s1[1]->get_value()); } - public function test_rand_selection_set() { + public function test_rand_selection_set(): void { + $cs = ['a:rand_selection({a,b,c,d}, 4)', 'b:sort(a)']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []); @@ -1033,7 +1081,8 @@ public function test_rand_selection_set() { $this->assertEquals('[a,b,c,d]', $s1[1]->get_value()); } - public function test_trivial_rand_range() { + public function test_trivial_rand_range(): void { + // Cases should be in the form array('input', 'value', 'display'). $cases = []; $cmds = []; @@ -1063,7 +1112,8 @@ public function test_trivial_rand_range() { } } - public function test_greek_lower() { + public function test_greek_lower(): void { + // The case gamma is separated out below, so we can skip it on old Maxima where it is a known fail. $cs = [ 'greek1:[alpha,beta,delta,epsilon]', @@ -1091,7 +1141,8 @@ public function test_greek_lower() { $s1[3]->get_display()); } - public function test_greek_lower_gamma() { + public function test_greek_lower_gamma(): void { + // In old maxima, you get '\Gamma' for the display output. $this->skip_if_old_maxima('5.23.2'); $cs = stack_ast_container::make_from_student_source('greek1:gamma', '', new stack_cas_security(), []); @@ -1102,7 +1153,8 @@ public function test_greek_lower_gamma() { $this->assertEquals('\gamma', $cs->get_display()); } - public function test_greek_upper() { + public function test_greek_upper(): void { + $cs = [ 'greek1:[Alpha,Beta,Gamma,Delta,Epsilon]', 'greek2:[Zeta,Eta,Theta,Iota,Kappa]', @@ -1131,7 +1183,8 @@ public function test_greek_upper() { $this->assertEquals('3', $s1[4]->get_value()); } - public function test_taylor_cos_simp() { + public function test_taylor_cos_simp(): void { + $cs = [ 'c1:taylor(cos(x),x,0,1)', 'c3:taylor(cos(x),x,0,3)', @@ -1152,7 +1205,8 @@ public function test_taylor_cos_simp() { $this->assertEquals('1-\frac{x^2}{2}+\cdots', $s1[1]->get_display()); } - public function test_taylor_cos_nosimp() { + public function test_taylor_cos_nosimp(): void { + $cs = [ 'c1:taylor(cos(x),x,0,1)', 'c3:taylor(cos(x),x,0,3)', @@ -1173,7 +1227,8 @@ public function test_taylor_cos_nosimp() { $this->assertEquals('1-\frac{x^2}{2}+\cdots', $s1[1]->get_display()); } - public function test_lambda() { + public function test_lambda(): void { + $cs = [ 'l1:lambda([ex], ex^3)', 'l2:[1,2,3]', @@ -1189,7 +1244,8 @@ public function test_lambda() { $this->assertEquals('[1,8,27]', $s1[2]->get_value()); } - public function test_sets_simp() { + public function test_sets_simp(): void { + $cs = ['c1:{}', 'c2:{b,a,c}']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_student_source($s, '', new stack_cas_security(), []); @@ -1206,7 +1262,8 @@ public function test_sets_simp() { $this->assertEquals('\left \{a , b , c \right \}', $s1[1]->get_display()); } - public function test_sets_simp_false() { + public function test_sets_simp_false(): void { + $cs = ['c1:{}', 'c2:{b,a,c}']; foreach ($cs as $s) { $s1[] = stack_ast_container::make_from_student_source($s, '', new stack_cas_security(), []); @@ -1223,7 +1280,8 @@ public function test_sets_simp_false() { $this->assertEquals('\left \{b , a , c \right \}', $s1[1]->get_display()); } - public function test_numerical_rounding() { + public function test_numerical_rounding(): void { + $tests = stack_numbers_test_data::get_raw_test_data(); $s1 = []; @@ -1252,7 +1310,8 @@ public function test_numerical_rounding() { } } - public function test_dispdp() { + public function test_dispdp(): void { + // @codingStandardsIgnoreStart // Tests in the following form. @@ -1313,7 +1372,8 @@ public function test_dispdp() { } } - public function test_dispdp_systematic() { + public function test_dispdp_systematic(): void { + $cs = stack_ast_container::make_from_teacher_source("L:makelist(dispdp(10^-1+10^-k,k+1),k,12,20)", '', new stack_cas_security(), []); $s1[] = $cs; @@ -1343,7 +1403,8 @@ public function test_dispdp_systematic() { $this->assertEquals($expected, $s1[0]->get_value()); } - public function test_dispdp_systematic_longer() { + public function test_dispdp_systematic_longer(): void { + $cs = stack_ast_container::make_from_teacher_source("fpprintprec:16", '', new stack_cas_security(), []); $s1[] = $cs; @@ -1376,7 +1437,8 @@ public function test_dispdp_systematic_longer() { $this->assertEquals($expected, $s1[1]->get_value()); } - public function test_dispsf() { + public function test_dispsf(): void { + // @codingStandardsIgnoreStart // Tests in the following form. @@ -1423,7 +1485,8 @@ public function test_dispsf() { } } - public function test_significantfigures_errors() { + public function test_significantfigures_errors(): void { + $tests = [ ['significantfigures(%pi/3,3)', '1.05', ''], [ @@ -1452,7 +1515,8 @@ public function test_significantfigures_errors() { } } - public function test_significantfigures_list() { + public function test_significantfigures_list(): void { + $tests = [ [ 'significantfigures([0.2,0.4,0.5,0.6,0.7,0.8,1]*1.9,3)', @@ -1474,7 +1538,8 @@ public function test_significantfigures_list() { } } - public function test_sf() { + public function test_sf(): void { + // @codingStandardsIgnoreStart // Tests in the following form. @@ -1527,7 +1592,8 @@ public function test_sf() { } } - public function test_scientific_notation() { + public function test_scientific_notation(): void { + // @codingStandardsIgnoreStart // Tests in the following form. @@ -1805,7 +1871,8 @@ public function test_scientific_notation() { } } - public function test_pm_simp_false() { + public function test_pm_simp_false(): void { + $cs = [ 'c0:a#pm#b', 'c1:x = (-b #pm# sqrt(b^2-4*a*c))/(2*a)', @@ -1851,7 +1918,8 @@ public function test_pm_simp_false() { $this->assertEquals('\sin ^2\left({x \pm a}\right)', $s1[9]->get_display()); } - public function test_pm_simp_true() { + public function test_pm_simp_true(): void { + $cs = [ 'c1:a#pm#b', 'c2:x=(-b #pm# sqrt(b^2-4*a*c))/(2*a)', @@ -1897,7 +1965,8 @@ public function test_pm_simp_true() { $this->assertEquals('\sin ^2\left({x \pm a}\right)', $s1[9]->get_display()); } - public function test_logic_nouns() { + public function test_logic_nouns(): void { + // Nouns forms of logic operators are added by student validation. $s1 = []; $s1[] = stack_ast_container::make_from_teacher_source('p0:x=1 or x=2', '', new stack_cas_security(), []); @@ -1921,7 +1990,8 @@ public function test_logic_nouns() { $this->assertEquals('false', $s1[3]->get_value()); } - public function test_natural_domain() { + public function test_natural_domain(): void { + // Cases should be in the form array('input', 'value', 'display'). $cases = []; @@ -1955,7 +2025,8 @@ public function test_natural_domain() { } } - public function test_union_tex() { + public function test_union_tex(): void { + // Cases should be in the form array('input value', 'display'). $cases[] = ['%union(a,b,c)', 'a \cup b \cup c']; @@ -2000,7 +2071,8 @@ public function test_union_tex() { } } - public function test_stack_disp_comma_separate() { + public function test_stack_disp_comma_separate(): void { + // Cases should be in the form array('input', 'value', 'display'). $cases = []; @@ -2023,7 +2095,8 @@ public function test_stack_disp_comma_separate() { } } - public function test_stack_disp_innards_ntuple() { + public function test_stack_disp_innards_ntuple(): void { + // Cases should be in the form array('input', 'value', 'display'). $cases = []; @@ -2046,7 +2119,8 @@ public function test_stack_disp_innards_ntuple() { } } - public function test_stack_stackintfmt() { + public function test_stack_stackintfmt(): void { + // Cases should be in the form array('input', 'value', 'display'). $cases = []; @@ -2074,7 +2148,8 @@ public function test_stack_stackintfmt() { } } - public function test_stack_stack_equiv_find_step() { + public function test_stack_stack_equiv_find_step(): void { + $r1 = [ 'ta:[lg(25,5),stackeq(lg(5^2,5)),stackeq(2*lg(5,5)),stackeq(2*1),stackeq(2)]', @@ -2111,7 +2186,8 @@ public function test_stack_stack_equiv_find_step() { } } - public function test_dispvalue() { + public function test_dispvalue(): void { + // These are tests of test-case generation. $tests = [ @@ -2153,7 +2229,8 @@ public function test_dispvalue() { } } - public function test_stack_strip_percent() { + public function test_stack_strip_percent(): void { + $tests = [ 'assume(x>0)', 'eq1:x^2*\'diff(y,x)+3*y*x=sin(x)/x', @@ -2176,7 +2253,8 @@ public function test_stack_strip_percent() { $this->assertEquals('y = (k-cos(x))/x^3', $s1[4]->get_value()); } - public function test_stack_quantile_gamma() { + public function test_stack_quantile_gamma(): void { + // This command has lisp throw an error. $tests = ['p:quantile_gamma(0.5,26896/81,81/164)']; @@ -2197,7 +2275,8 @@ public function test_stack_quantile_gamma() { $this->assertEquals('163.835395267', $actual); } - public function test_stack_parse_inequalities() { + public function test_stack_parse_inequalities(): void { + // This command has lisp throw an error. $tests = ['f(x) := if x < 0 then (if x < 1 then 1 else 2) else 3;', 'v1:f(-5);', 'v2:f(4);']; @@ -2215,7 +2294,8 @@ public function test_stack_parse_inequalities() { $this->assertEquals('f(x):=if x < 0 then (if x < 1 then 1 else 2) else 3', $s1[0]->get_value()); } - public function test_stack_rat() { + public function test_stack_rat(): void { + $tests = [ 's1 : 8.5*sin(rat(2*pi*((0.37/1.86440677966E-4)-(5.8/0.22))))', 's2:1', 'm:MAXIMA_VERSION_NUM', @@ -2239,7 +2319,8 @@ public function test_stack_rat() { } } - public function test_stack_pmpoly() { + public function test_stack_pmpoly(): void { + $tests = [ 's1:-(4*x^7)+3*x^5-2*x^3+x', 'p1:-a/b', 'p2:(-a)/b', 'p3:-(a/b)', @@ -2277,7 +2358,8 @@ public function test_stack_pmpoly() { $this->assertEquals('{a \pm b}', $s1[4]->get_display()); } - public function test_stack_pm_maximaoutput() { + public function test_stack_pm_maximaoutput(): void { + $tests = ['a*b+c*d+-A*B']; foreach ($tests as $key => $c) { @@ -2305,7 +2387,8 @@ public function test_stack_pm_maximaoutput() { $this->assertEquals($expected, $s1[0]->get_ast_test()); } - public function test_stack_pm_taylor() { + public function test_stack_pm_taylor(): void { + $tests = ['ta:ev(taylor(10*cos(2*x),x,%pi/4,2),simp)']; foreach ($tests as $key => $c) { @@ -2336,7 +2419,8 @@ public function test_stack_pm_taylor() { $this->assertEquals($expected, $s1[0]->get_ast_test()); } - public function test_stack_scientific_notationp() { + public function test_stack_scientific_notationp(): void { + $truetests = [ '3*10^2', '3.1*10^2', @@ -2398,7 +2482,8 @@ public function test_stack_scientific_notationp() { } } - public function test_stack_regex_match_exactp() { + public function test_stack_regex_match_exactp(): void { + $t1 = []; $t1[] = ['regex_match_exactp("(aaa)*(b|d)c", "aaaaaabc")', 'true']; @@ -2420,7 +2505,8 @@ public function test_stack_regex_match_exactp() { } } - public function test_stack_at_units_sigfigs() { + public function test_stack_at_units_sigfigs(): void { + $t1 = []; $t1[] = ['simp:false', 'false']; @@ -2442,7 +2528,8 @@ public function test_stack_at_units_sigfigs() { } } - public function test_stack_rational_numberp() { + public function test_stack_rational_numberp(): void { + $s1 = []; $t1 = []; @@ -2485,7 +2572,8 @@ public function test_stack_rational_numberp() { } } - public function test_stack_numerical_not_alg_equiv_edge() { + public function test_stack_numerical_not_alg_equiv_edge(): void { + $s1 = []; $t1 = []; @@ -2508,7 +2596,8 @@ public function test_stack_numerical_not_alg_equiv_edge() { } } - public function test_stack_blockexternal() { + public function test_stack_blockexternal(): void { + $s1 = []; $t1 = []; @@ -2541,7 +2630,8 @@ public function test_stack_blockexternal() { } } - public function test_silent_tellsimp() { + public function test_silent_tellsimp(): void { + $qv = "matchdeclare(pmpatex1,true);\nmatchdeclare(pmpatex2,true);" . "tellsimpafter((pmpatex1 #pm# pmpatex2)!,(pmpatex1^2) #pm# pmpatex2);\n" . @@ -2554,7 +2644,8 @@ public function test_silent_tellsimp() { $this->assertEquals("b^2#pm#c", $cs->get_value()); } - public function test_eval_in_block() { + public function test_eval_in_block(): void { + $qv = "f:ev(2*x,x=2);\n" . "ev(g:3*x,x=3);\n" . "h:5*x,x=5;\n". @@ -2573,7 +2664,8 @@ public function test_eval_in_block() { $this->assertEquals('[4,9,25,36]', $s1->get_value()); } - public function test_confirm_induced_timeout() { + public function test_confirm_induced_timeout(): void { + $qv = "p:1;\n" . "for i:1 thru 2^100 do p:p+(-1)^i;\n"; $qv = new stack_cas_keyval($qv, null, 123); @@ -2589,7 +2681,8 @@ public function test_confirm_induced_timeout() { $this->assertEquals('CAS failed to return any data due to timeout.', $s1->get_errors()); } - public function test_complex_number_display() { + public function test_complex_number_display(): void { + // These test cases get wrapped in the general display_complex(ex) function to test the default conversion. $cases = []; @@ -2671,7 +2764,8 @@ public function test_complex_number_display() { } } - public function test_complex_number_display_options() { + public function test_complex_number_display_options(): void { + // These test cases get wrapped in the general display_complex(ex) function to test the default conversion. $cases = []; @@ -2703,7 +2797,8 @@ public function test_complex_number_display_options() { } } - public function test_parens_delect_display() { + public function test_parens_delect_display(): void { + $cases = []; $cases[] = ['disp_parens(a+b)+c', '\left( a+b \right)+c']; @@ -2733,7 +2828,8 @@ public function test_parens_delect_display() { } } - public function test_parens_select() { + public function test_parens_select(): void { + $cases = []; $cases[] = ['select(integerp, 3)', '\color{red}{\underline{3}}']; @@ -2764,7 +2860,8 @@ public function test_parens_select() { } } - public function test_fboundp() { + public function test_fboundp(): void { + $cases = []; $cases[] = ['fboundp(sinner)', 'false']; @@ -2791,7 +2888,8 @@ public function test_fboundp() { } } - public function test_diag() { + public function test_diag(): void { + $cases = []; $cases[] = [ @@ -2819,7 +2917,8 @@ public function test_diag() { } } - public function test_cartesian_product() { + public function test_cartesian_product(): void { + $cases = []; $cases[] = [ @@ -2843,7 +2942,8 @@ public function test_cartesian_product() { } } - public function test_keyword_end() { + public function test_keyword_end(): void { + $cases = [ 'v1: (-x^2+1)/(x^2+1)^2', 'v2: 1/(x^2+1)-(2*x^2)/(x^2+1)^2', 'end:3', @@ -2868,7 +2968,8 @@ public function test_keyword_end() { } - public function test_use_at() { + public function test_use_at(): void { + // This testcase arose as issue #762. $cases = [ @@ -2920,7 +3021,8 @@ public function test_use_at() { $this->assertEquals('matrix([-4],[1])', $t1->get_value()); } - public function test_s_test() { + public function test_s_test(): void { + $cases = ['t1:s_assert(a,b)']; @@ -2938,7 +3040,8 @@ public function test_s_test() { $this->assertEquals('s_assert: STACK expected \' b \' but was given \' a \'.', $session->get_errors()); } - public function test_let() { + public function test_let(): void { + // Note, the rule deliberarly does not correspond to normal mathematics! $cases = [ @@ -2959,7 +3062,8 @@ public function test_let() { $this->assertEquals('cos(x)^6-2*cos(x)^3+1', $p->get_value()); } - public function test_let_matrix() { + public function test_let_matrix(): void { + $cases = ['orderless(I);', 'matchdeclare([a],true)', '(let(I*a, a), let(I^2, I), true)', @@ -2997,7 +3101,8 @@ public function test_let_matrix() { $this->assertEquals('X^3-3*X^2+3*X-1', $p->get_value()); } - public function test_stackmaximaversion() { + public function test_stackmaximaversion(): void { + // This test ensures that we are not running against different // version number of the STACK-Maxima scripts. For example, // old image in a server setup or a cache layer somewhere. diff --git a/tests/castext2_internals_test.php b/tests/castext2_internals_test.php index 2cd8a34224e..f24e4a04c72 100644 --- a/tests/castext2_internals_test.php +++ b/tests/castext2_internals_test.php @@ -44,7 +44,8 @@ class castext2_internals_test extends qtype_stack_testcase { * @covers \qtype_stack\CTP_Parser * @covers \qtype_stack\CTP_Parser::parse */ - public function test_parser() { + public function test_parser(): void { + $parser = new CTP_Parser(); $code = '[[ if test="0"]] {#1#} {@2@}[[/if]]'; $ast = $parser->parse($code); @@ -86,7 +87,8 @@ public function test_parser() { * @covers \qtype_stack\CTP_Parser::parse * @covers \qtype_stack\CTP_IOBlock */ - public function test_ioblockextensions() { + public function test_ioblockextensions(): void { + $parser = new CTP_Parser(); $code = '[[list_errors:ans1,ans2]][[ whatever : ans3 ]]'; $ast = $parser->parse($code); @@ -105,7 +107,8 @@ public function test_ioblockextensions() { /** * @covers \qtype_stack\castext2_parser_utils::math_paint */ - public function test_math_paint_1() { + public function test_math_paint_1(): void { + $parser = new CTP_Parser(); $code = '\({#1#}\) {@3@} \[{@5@}\] \begin{equation}{@7@} \end{equation} {#9#}'; $ast = $parser->parse($code); @@ -126,7 +129,8 @@ public function test_math_paint_1() { /** * @covers \qtype_stack\castext2_parser_utils::math_paint */ - public function test_math_paint_2() { + public function test_math_paint_2(): void { + $parser = new CTP_Parser(); $code = '

[[commonstring key="your_answer_interpreted_as"/]]

'; $code .= '[[if test="stringp(ans1)"]]

{@false@}

'; diff --git a/tests/castext2_test.php b/tests/castext2_test.php index 1538e982565..854d908fa81 100644 --- a/tests/castext2_test.php +++ b/tests/castext2_test.php @@ -88,7 +88,8 @@ private function evaluate(string $code, array $preamble=[], stack_options $optio * * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_latex_injection_1() { + public function test_latex_injection_1(): void { + $input = '{@1+2@}, \[{@sqrt(2)@}\]'; $output = '\({3}\), \[{\sqrt{2}}\]'; $this->assertEquals($output, $this->evaluate($input)); @@ -97,7 +98,8 @@ public function test_latex_injection_1() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_latex_injection_2() { + public function test_latex_injection_2(): void { + $input = '{@a@}, {@c:b@}, {@3/9,simp=false@}, {@c@}, {@d@}'; // Note that last one if we are in global simp:true we just cannot know // whether that needs to be protected. @@ -109,7 +111,8 @@ public function test_latex_injection_2() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_latex_injection_3() { + public function test_latex_injection_3(): void { + $input = '{@a@}, {@3/9@}, {@3/9,simp@}, {@a,simp=false@}, {@a,simp@}'; $preamble = ['a:3/9']; $output = '\({\frac{3}{9}}\), \({\frac{3}{9}}\), \({\frac{1}{3}}\), \({\frac{3}{9}}\), \({\frac{1}{3}}\)'; @@ -120,7 +123,8 @@ public function test_latex_injection_3() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_latex_injection_4() { + public function test_latex_injection_4(): void { + $input = ' {@"test string"@} '; $output = ' test string '; $this->assertEquals($output, $this->evaluate($input)); @@ -129,7 +133,8 @@ public function test_latex_injection_4() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_latex_injection_5() { + public function test_latex_injection_5(): void { + // Issue #849, let the simplification state stay after injection if // modified globally. // While this is a bad way to do things and is essenttialy authoring with @@ -150,7 +155,8 @@ public function test_latex_injection_5() { * @covers \qtype_stack\stack_cas_castext2_markdownformat * @covers \qtype_stack\castext2_parser_utils::math_paint */ - public function test_latex_injection_mixed_formats_1() { + public function test_latex_injection_mixed_formats_1(): void { + // The default format is raw HTML. // The actual injection is not visible here as the markdown gets rendered, but // the math-mode detection should be. @@ -173,7 +179,8 @@ public function test_latex_injection_mixed_formats_1() { * * @covers \qtype_stack\stack_cas_castext2_raw */ - public function test_value_injection_1() { + public function test_value_injection_1(): void { + $input = '{#1+2#}, {#sqrt(2)#}'; $output = '3, sqrt(2)'; $this->assertEquals($output, $this->evaluate($input)); @@ -182,7 +189,8 @@ public function test_value_injection_1() { /** * @covers \qtype_stack\stack_cas_castext2_raw */ - public function test_value_injection_2() { + public function test_value_injection_2(): void { + $input = '{#a#}, {#c:b#}, {#3/9,simp=false#}, {#c#}, {#d#}'; // Note that last one if we are in global simp:true we just cannot know // whether that needs to be protected. @@ -194,7 +202,8 @@ public function test_value_injection_2() { /** * @covers \qtype_stack\stack_cas_castext2_raw */ - public function test_value_injection_3() { + public function test_value_injection_3(): void { + $input = '{#a#}, {#3/9#}, {#3/9,simp#}, {#a,simp=false#}, {#a,simp#}'; $preamble = ['a:3/9']; $output = '3/9, 3/9, 1/3, 3/9, 1/3'; @@ -208,7 +217,8 @@ public function test_value_injection_3() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_multiplicationsign_dot() { + public function test_latex_injection_multiplicationsign_dot(): void { + $input = '{@a@}, {@pi*x^2@}'; $preamble = ['a:x*y*z']; $output = '\({x\cdot y\cdot z}\), \({\pi\cdot x^2}\)'; @@ -220,7 +230,8 @@ public function test_latex_injection_multiplicationsign_dot() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_multiplicationsign_cross() { + public function test_latex_injection_multiplicationsign_cross(): void { + $input = '{@a@}, {@pi*x^2@}'; $preamble = ['a:x*y*z']; $output = '\({x\times y\times z}\), \({\pi\times x^2}\)'; @@ -232,7 +243,8 @@ public function test_latex_injection_multiplicationsign_cross() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_multiplicationsign_none() { + public function test_latex_injection_multiplicationsign_none(): void { + $input = '{@a@}, {@pi*x^2@}'; $preamble = ['a:x*y*z']; $output = '\({x\,y\,z}\), \({\pi\,x^2}\)'; @@ -246,7 +258,8 @@ public function test_latex_injection_multiplicationsign_none() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_inversetrig_acos() { + public function test_latex_injection_inversetrig_acos(): void { + $input = '\({@acos(alpha)@}, {@asin(alpha)@}, {@a@}\)'; $preamble = ['a:asech(alpha)']; $output = '\({{\rm acos}\left( \alpha \right)}, {{\rm asin}\left( \alpha \right)}, {{\rm asech}\left( \alpha \right)}\)'; @@ -258,7 +271,8 @@ public function test_latex_injection_inversetrig_acos() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_inversetrig_cos_1() { + public function test_latex_injection_inversetrig_cos_1(): void { + $input = '\({@acos(alpha)@}, {@asin(alpha)@}, {@a@}\)'; $preamble = ['a:asech(alpha)']; $output = '\({\cos^{-1}\left( \alpha \right)}, {\sin^{-1}\left( \alpha \right)}, {{\rm sech}^{-1}\left( \alpha \right)}\)'; @@ -270,7 +284,8 @@ public function test_latex_injection_inversetrig_cos_1() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_inversetrig_arccos() { + public function test_latex_injection_inversetrig_arccos(): void { + $input = '\({@acos(alpha)@}, {@asin(alpha)@}, {@a@}\)'; $preamble = ['a:asech(alpha)']; $output = '\({\arccos \left( \alpha \right)}, {\arcsin \left( \alpha \right)}, {{\rm arcsech}\left( \alpha \right)}\)'; @@ -284,7 +299,8 @@ public function test_latex_injection_inversetrig_arccos() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_matrixparens_brackets() { + public function test_latex_injection_matrixparens_brackets(): void { + $input = '{@matrix([1,0],[0,1])@}'; $preamble = []; $output = '\({\left[\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right]}\)'; @@ -296,7 +312,8 @@ public function test_latex_injection_matrixparens_brackets() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_matrixparens_parens() { + public function test_latex_injection_matrixparens_parens(): void { + $input = '{@matrix([1,0],[0,1])@}'; $preamble = []; $output = '\({\left(\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right)}\)'; @@ -308,7 +325,8 @@ public function test_latex_injection_matrixparens_parens() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_matrixparens_braces() { + public function test_latex_injection_matrixparens_braces(): void { + $input = '{@matrix([1,0],[0,1])@}'; $preamble = []; $output = '\({\left\{\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right\}}\)'; @@ -320,7 +338,8 @@ public function test_latex_injection_matrixparens_braces() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_matrixparens_none() { + public function test_latex_injection_matrixparens_none(): void { + $input = '{@matrix([1,0],[0,1])@}'; $preamble = []; $output = '\({\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}}\)'; @@ -332,7 +351,8 @@ public function test_latex_injection_matrixparens_none() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_injection_matrixparens_pipe() { + public function test_latex_injection_matrixparens_pipe(): void { + $input = '{@matrix([1,0],[0,1])@}'; $preamble = []; $output = '\({\left|\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right|}\)'; @@ -344,7 +364,8 @@ public function test_latex_injection_matrixparens_pipe() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_latex_matrixparens_indirect_lmxchar() { + public function test_latex_matrixparens_indirect_lmxchar(): void { + $input = '\[ f(x) := \left\{ {@(lmxchar:"", f)@} \right. \]'; $preamble = ['f:matrix([4*x+4, x<1],[-x^2-4*x-8, x>=1])']; $output = '\[ f(x) := \left\{ {\begin{array}{cc} 4\cdot x+4 & x < 1 \\\\ ' . @@ -362,7 +383,8 @@ public function test_latex_matrixparens_indirect_lmxchar() { * * @covers \qtype_stack\stack_cas_castext2_define */ - public function test_blocks_define() { + public function test_blocks_define(): void { + $input = '{#a#}, [[ define a="a+1" a="a*a" b="3/9" c="3/9,simp"/]] {#a#} {#b#} {#b,simp#} {#c#}'; $preamble = ['a:x']; $output = 'x, (x+1)*(x+1) 3/9 1/3 1/3'; @@ -378,7 +400,8 @@ public function test_blocks_define() { * * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_blocks_if_1() { + public function test_blocks_if_1(): void { + $input = '{#a#}, [[ if test="a=x" ]]yes[[ else ]]no[[define a="3"/]][[/if]], [[ if test="a=3"]]maybe[[/ if ]]'; $preamble = ['a:x']; $output = 'x, yes, '; @@ -389,7 +412,8 @@ public function test_blocks_if_1() { /** * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_blocks_if_2() { + public function test_blocks_if_2(): void { + $input = '{#a#}, [[ if test="a=x" ]]yes[[define a="3"/]][[ else ]]no[[/if]], [[ if test="a=3"]]maybe[[/ if ]]'; $preamble = ['a:x']; $output = 'x, yes, maybe'; @@ -400,7 +424,8 @@ public function test_blocks_if_2() { /** * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_blocks_if_3() { + public function test_blocks_if_3(): void { + $input = '{#a#}, [[ if test="a=x" ]]yes[[define a="3"/]][[ else ]]no[[/if]], ' . '[[ if test="a=x"]]no[[elif test="a=3"]]maybe[[/ if ]]'; $preamble = ['a:x']; @@ -412,7 +437,8 @@ public function test_blocks_if_3() { /** * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_blocks_if_4() { + public function test_blocks_if_4(): void { + $input = '{#a#}, [[ if test="a=x" ]]yes[[if test="b=y"]][[define b="x"/]][[/if]][[ else ]]no[[/if]], {#b#}'; $preamble = ['a:x', 'b:y']; $output = 'x, yes, x'; @@ -433,7 +459,8 @@ public function test_blocks_if_4() { * * @covers \qtype_stack\stack_cas_castext2_foreach */ - public function test_blocks_foreach_1() { + public function test_blocks_foreach_1(): void { + $input = '[[ foreach foo="a"]][[ foreach bar="foo"]]{#bar#}, [[/foreach]] - [[/foreach]]'; $preamble = ['a:[[1,1+1,1+1+1],[1,2,3]]']; $output = '1, 1+1, 1+1+1, - 1, 2, 3, - '; @@ -444,7 +471,8 @@ public function test_blocks_foreach_1() { /** * @covers \qtype_stack\stack_cas_castext2_foreach */ - public function test_blocks_foreach_2() { + public function test_blocks_foreach_2(): void { + $input = '[[ foreach foo="a"]][[ foreach bar="foo"]]{#bar#}, [[/foreach]] - [[/foreach]]'; $preamble = ['a:[{1,1+1,1+1+1},{3,2,1}]']; $output = '1, 2, 3, - 1, 2, 3, - '; @@ -455,7 +483,8 @@ public function test_blocks_foreach_2() { /** * @covers \qtype_stack\stack_cas_castext2_foreach */ - public function test_blocks_foreach_3() { + public function test_blocks_foreach_3(): void { + $input = '[[ foreach foo="a"]][[ foreach bar="foo,simp"]]{#bar#}, [[/foreach]] - [[/foreach]]'; $preamble = ['a:[[1,1+1,1+1+1],[1,2,3]]']; $output = '1, 2, 3, - 1, 2, 3, - '; @@ -466,7 +495,8 @@ public function test_blocks_foreach_3() { /** * @covers \qtype_stack\stack_cas_castext2_foreach */ - public function test_blocks_foreach_4() { + public function test_blocks_foreach_4(): void { + $input = '[[ foreach foo="a" bar="b"]]{@foo^bar@}, [[/foreach]]'; $preamble = ['a:[1,2,3,4]', 'b:[x,y,z]']; $output = '\({1^{x}}\), \({2^{y}}\), \({3^{z}}\), '; @@ -481,7 +511,8 @@ public function test_blocks_foreach_4() { * * @covers \qtype_stack\stack_cas_castext2_comment */ - public function test_blocks_comment() { + public function test_blocks_comment(): void { + $input = '1[[ comment]] [[ foreach bar="foo"]] {#y@} [[/comment]]2'; $output = '12'; $this->assertEquals($output, $this->evaluate($input)); @@ -494,7 +525,8 @@ public function test_blocks_comment() { * * @covers \qtype_stack\stack_cas_castext2_todo */ - public function test_blocks_todo() { + public function test_blocks_todo(): void { + $input = '1[[ todo]] [[ foreach bar="foo"]] {#y@} [[/todo]]2'; $output = '12'; $this->assertEquals($output, $this->evaluate($input)); @@ -503,7 +535,8 @@ public function test_blocks_todo() { /** * @covers \qtype_stack\stack_cas_castext2_hint */ - public function test_blocks_hint() { + public function test_blocks_hint(): void { + $input = "1[[hint title=\"Show solution\"]][[if test='is(1>0)']]Solution[[/if]][[/hint]]2"; $output = '1
Show solution' . '
Solution
2'; @@ -513,7 +546,8 @@ public function test_blocks_hint() { /** * @covers \qtype_stack\stack_cas_castext2_hint */ - public function test_blocks_hint_hint() { + public function test_blocks_hint_hint(): void { + $input = "[[hint title=\"Show solution\"]][[hint title=\"Go on....\"]]Solution[[/hint]][[/hint]]"; $output = '
Show solution' . '
' . @@ -529,7 +563,8 @@ public function test_blocks_hint_hint() { * * @covers \qtype_stack\stack_cas_castext2_escape */ - public function test_blocks_escape() { + public function test_blocks_escape(): void { + $input = '1[[ escape]] [[ foreach bar="foo"]] {#y@} [[/escape]]2'; $output = '1 [[ foreach bar="foo"]] {#y@} 2'; $this->assertEquals($output, $this->evaluate($input)); @@ -541,7 +576,8 @@ public function test_blocks_escape() { * @covers \qtype_stack\CTP_Parser * @covers \qtype_stack\stack_cas_castext2_escape */ - public function test_blocks_escape_space_end() { + public function test_blocks_escape_space_end(): void { + $input = '1[[ escape ]] [[ foreach bar="foo"]] {#y@} [[/escape]]2'; $output = '1 [[ foreach bar="foo"]] {#y@} 2'; $this->assertEquals($output, $this->evaluate($input)); @@ -553,7 +589,8 @@ public function test_blocks_escape_space_end() { * @covers \qtype_stack\CTP_Parser * @covers \qtype_stack\stack_cas_castext2_escape */ - public function test_blocks_escape_space_none() { + public function test_blocks_escape_space_none(): void { + $input = '1[[escape]] [[ foreach bar="foo"]] {#y@} [[/escape]]2'; $output = '1 [[ foreach bar="foo"]] {#y@} 2'; $this->assertEquals($output, $this->evaluate($input)); @@ -565,7 +602,8 @@ public function test_blocks_escape_space_none() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_keyval */ - public function test_texput_1() { + public function test_texput_1(): void { + $input = '\({@foo@}\)'; $preamble = ['texput(foo, "\\\\frac{foo}{bar}")']; $output = '\({\frac{foo}{bar}}\)'; @@ -576,7 +614,8 @@ public function test_texput_1() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_texput_2() { + public function test_texput_2(): void { + $input = '{@x^2+foo(a,sqrt(b))@}'; $preamble = [ 'footex(e):=block([a,b],[a,b]:args(e),sconcat(tex1(a)," \\\\rightarrow ",tex1(b)))', @@ -590,7 +629,8 @@ public function test_texput_2() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_stackfltfmt() { + public function test_stackfltfmt(): void { + $input = '{@a@}, {@(stackfltfmt:"~f",a)@}'; // Note that 0.000012 has rounding in clisp which is not the point of this test. // And 0.000013 has rounding in SBCL/GCL. @@ -604,7 +644,8 @@ public function test_stackfltfmt() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_stackintfmt() { + public function test_stackintfmt(): void { + $input = '{@(stackintfmt:"~:r",a)@}, {@(stackintfmt:"~@R",a)@}'; $preamble = ['a:1998']; $output = '\({\text{one thousand nine hundred ninety-eighth}}\), \({MCMXCVIII}\)'; @@ -618,7 +659,8 @@ public function test_stackintfmt() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_stack_disp_fractions() { + public function test_stack_disp_fractions(): void { + $input = '{@(stack_disp_fractions("i"),a/b)@}, {@(stack_disp_fractions("d"),a/b)@}'; $output = '\({{a}/{b}}\), \({\frac{a}{b}}\)'; $this->assertEquals($output, $this->evaluate($input)); @@ -628,7 +670,8 @@ public function test_stack_disp_fractions() { /** * @covers \qtype_stack\stack_cas_castext2_jsstring */ - public function test_jsstring() { + public function test_jsstring(): void { + $input = 'var feedback = [[jsstring]]Something \({@sqrt(2)@}\) {@sqrt(2)@}.[[/jsstring]];'; $output = 'var feedback = "Something \\\\({\\\\sqrt{2}}\\\\) \\\\({\\\\sqrt{2}}\\\\).";'; $this->assertEquals($output, $this->evaluate($input)); @@ -644,7 +687,8 @@ public function test_jsstring() { * @covers \qtype_stack\stack_cas_keyval * @covers \qtype_stack\stack_cas_castext2_castext */ - public function test_inline_castext() { + public function test_inline_castext(): void { + $keyval = 'B:castext("B");sq:castext("{@sqrt(2)@}");'; // The inline castext compilation currently only happens for keyvals, not for // singular statements so we need to do something special to get this done. @@ -668,7 +712,8 @@ public function test_inline_castext() { * @covers \qtype_stack\stack_cas_keyval * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_inline_castext_normal_injection() { + public function test_inline_castext_normal_injection(): void { + $keyval = 'B:castext("B");sq:castext("{@sqrt(2)@}");'; // The inline castext compilation currently only happens for keyvals, not for // singular statements so we need to do something special to get this done. @@ -692,7 +737,8 @@ public function test_inline_castext_normal_injection() { /** * @covers \qtype_stack\stack_cas_castext2_special_root */ - public function test_inline_castext_inline() { + public function test_inline_castext_inline(): void { + $input = 'A [[castext evaluated="castext(\\"B\\")"/]] C, [[castext evaluated="castext(\\"{@sqrt(2)@}\\")"/]]'; $output = 'A B C, \\({\\sqrt{2}}\\)'; $this->assertEquals($output, $this->evaluate($input)); @@ -702,7 +748,8 @@ public function test_inline_castext_inline() { * @covers \qtype_stack\stack_cas_keyval * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_inline_castext_error() { + public function test_inline_castext_error(): void { + $keyval = 'S:1;T:castext(A_11);'; // The inline castext compilation currently only happens for keyvals, not for // singular statements so we need to do something special to get this done. @@ -730,7 +777,8 @@ public function test_inline_castext_error() { /** * @covers \qtype_stack\stack_cas_castext2_commonstring */ - public function test_commonsstring() { + public function test_commonsstring(): void { + $preamble = ['simp:false', 'a:52+x-x', 'b:"text"', 'c:sqrt(5)', 'simp:true']; // The string "stackversionerror" just happens to have multiple named parameters so we use it, // feel free to use any other if things change. @@ -740,7 +788,8 @@ public function test_commonsstring() { $this->assertEquals($output, $this->evaluate($input, $preamble)); } - public function test_plot_if() { + public function test_plot_if(): void { + // This test case caused an error in Maxima 5.45.0. // The fix to this error is the use of ex:%_ce_expedite(ex) in the plot function to remove %_C. // However, we need to actively evaluate the %_C functions at the point we remove them. @@ -753,19 +802,22 @@ public function test_plot_if() { $this->assertTrue(strpos($this->evaluate($input), '!ploturl!stackplot') > 0); } - public function test_templates_1() { + public function test_templates_1(): void { + $input = '[[template name="foobar"/]]'; $output = 'Warning no template defined with name "foobar"'; $this->assertEquals($output, $this->evaluate($input)); } - public function test_templates_2() { + public function test_templates_2(): void { + $input = '[[template name="foobar" mode="ignore missing"/]]'; $output = ''; $this->assertEquals($output, $this->evaluate($input)); } - public function test_templates_3() { + public function test_templates_3(): void { + $preamble = ['a:1']; $input = '[[template name="foobar"]]FOOBAR{#a#}[[/template]][[template name="foobar"/]]' . '[[define a="2"/]] [[template name="foobar"/]]'; @@ -773,19 +825,22 @@ public function test_templates_3() { $this->assertEquals($output, $this->evaluate($input, $preamble)); } - public function test_templates_4() { + public function test_templates_4(): void { + $input = '[[template name="foobar" mode="default"]]default[[/template]]'; $output = 'default'; $this->assertEquals($output, $this->evaluate($input)); } - public function test_templates_5() { + public function test_templates_5(): void { + $input = '[[template name="foobar"]]override[[/template]]X[[template name="foobar" mode="default"]]default[[/template]]'; $output = 'Xoverride'; $this->assertEquals($output, $this->evaluate($input)); } - public function test_maplist_labda() { + public function test_maplist_labda(): void { + $input = '{@maplist(lambda([ex], x^ex), [1,2,3,4])@}'; $output = '\({\left[ x , x^2 , x^3 , x^4 \right]}\)'; $this->assertEquals($output, $this->evaluate($input)); diff --git a/tests/castext_exception_test.php b/tests/castext_exception_test.php index 9a0553f8eb8..564c7fb95eb 100644 --- a/tests/castext_exception_test.php +++ b/tests/castext_exception_test.php @@ -42,7 +42,8 @@ class castext_exception_test extends qtype_stack_testcase { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_exception_1() { + public function test_exception_1(): void { + $this->expectException(TypeError::class); $at1 = castext2_evaluatable::make_from_source([], null); } @@ -50,7 +51,8 @@ public function test_exception_1() { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_exception_2() { + public function test_exception_2(): void { + $this->expectException(TypeError::class); $at1 = castext2_evaluatable::make_from_source("Hello world", [1]); } diff --git a/tests/castext_test.php b/tests/castext_test.php index 21abf911c35..4637f4235b5 100644 --- a/tests/castext_test.php +++ b/tests/castext_test.php @@ -84,7 +84,8 @@ public function basic_castext_instantiation($strin, $sa, $val, $disp) { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_basic_castext_instantiation() { + public function test_basic_castext_instantiation(): void { + $a1 = ['a:x^2', 'b:(x+1)^2']; $a2 = ['a:x^2)', 'b:(x+1)^2']; @@ -131,7 +132,8 @@ public function test_basic_castext_instantiation() { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_validation_error_castext_text() { + public function test_validation_error_castext_text(): void { + $a = []; $cs = []; foreach ($a as $var) { @@ -158,7 +160,8 @@ public function test_validation_error_castext_text() { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_runtime_error_castext_text() { + public function test_runtime_error_castext_text(): void { + $a = []; $cs = []; foreach ($a as $var) { @@ -185,7 +188,8 @@ public function test_runtime_error_castext_text() { * @covers \qtype_stack\castext2_evaluatable::make_from_source * @covers \qtype_stack\stack_cas_keyval::get_valid */ - public function test_validation_error_castext_session() { + public function test_validation_error_castext_session(): void { + $a = ['a:x+1)^2']; $cs = []; foreach ($a as $var) { @@ -213,7 +217,8 @@ public function test_validation_error_castext_session() { /** * @covers \qtype_stack\stack_cas_session2 */ - public function test_runtime_error_castext_session() { + public function test_runtime_error_castext_session(): void { + $a = ['a:1/0']; $cs = []; foreach ($a as $var) { @@ -239,7 +244,8 @@ public function test_runtime_error_castext_session() { /** * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_if_block() { + public function test_if_block(): void { + $a1 = ['a:true', 'b:is(1>2)', 'c:false']; // From iss309. $c = '[[ if test="false" ]]Alpha[[ elif test="true"]]Beta[[ elif test="false"]]Gamma' @@ -273,7 +279,8 @@ public function test_if_block() { /** * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_if_block_error() { + public function test_if_block_error(): void { + // NOTE... These syntax error tests should be removed. All blocks either work or they do not // if they do not work you see them not being replaced in the output. The old parser // spent way too much time figuring out if a opening block closed or not and that @@ -305,7 +312,8 @@ public function test_if_block_error() { /** * @covers \qtype_stack\stack_cas_castext2_if */ - public function test_broken_block_error() { + public function test_broken_block_error(): void { + $a = ['a:true', 'b:is(1>2)']; $cs = []; foreach ($a as $var) { @@ -322,7 +330,8 @@ public function test_broken_block_error() { /** * @covers \qtype_stack\CTP_Parser */ - public function test_broken_block_error2() { + public function test_broken_block_error2(): void { + $a = ['a:true', 'b:is(1>2)']; $cs = []; foreach ($a as $var) { @@ -341,7 +350,8 @@ public function test_broken_block_error2() { /** * @covers \qtype_stack\stack_cas_castext2_define */ - public function test_define_block() { + public function test_define_block(): void { + $a1 = ['a:2']; $cases = [ @@ -357,7 +367,8 @@ public function test_define_block() { /** * @covers \qtype_stack\stack_cas_castext2_foreach */ - public function test_foreach_block() { + public function test_foreach_block(): void { + $a1 = ['a:[1,2,3]', 'b:{4,5,6,7}']; $cases = [ @@ -379,7 +390,8 @@ public function test_foreach_block() { /** * @covers \qtype_stack\stack_cas_castext2_comment */ - public function test_comment_block_define() { + public function test_comment_block_define(): void { + $a1 = ['a:2']; $cases = [ @@ -404,7 +416,8 @@ public function test_comment_block_define() { * * @covers \qtype_stack\castext2_evaluatable */ - public function test_not_confused_by_pluginfile() { + public function test_not_confused_by_pluginfile(): void { + $c = 'Here {@x@} is some @@PLUGINFILE@@ {@x + 1@} some input'; $ct = castext2_evaluatable::make_from_source($c, 'test-case'); $this->assertTrue($ct->get_valid()); @@ -416,7 +429,8 @@ public function test_not_confused_by_pluginfile() { /** * @covers \qtype_stack\castext2_evaluatable */ - public function test_not_confused_by_pluginfile_real_example() { + public function test_not_confused_by_pluginfile_real_example(): void { + $realexample = '

'; $ct = castext2_evaluatable::make_from_source($realexample, 'test-case'); @@ -429,7 +443,8 @@ public function test_not_confused_by_pluginfile_real_example() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_raw_casstrings() { + public function test_get_all_raw_casstrings(): void { + $raw = 'Take {@x^2+2*x@} and then {@sin(z^2)@}.'; $raws = castext2_parser_utils::get_casstrings($raw); $session = new stack_cas_session2($raws); @@ -441,7 +456,8 @@ public function test_get_all_raw_casstrings() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_raw_casstrings_if() { + public function test_get_all_raw_casstrings_if(): void { + $raw = 'Take {@x^2+2*x@} and then [[ if test="true"]]{@sin(z^2)@}[[/if]].'; $raws = castext2_parser_utils::get_casstrings($raw); $session = new stack_cas_session2($raws); @@ -455,7 +471,8 @@ public function test_get_all_raw_casstrings_if() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_raw_casstrings_foreach() { + public function test_get_all_raw_casstrings_foreach(): void { + $raw = 'Take {@x^2+2*x@} and then[[ foreach t="[1,2,3]"]] {@t@}[[/foreach]].'; $raws = castext2_parser_utils::get_casstrings($raw); $session = new stack_cas_session2($raws); @@ -476,7 +493,8 @@ public function test_get_all_raw_casstrings_foreach() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_raw_casstrings_empty() { + public function test_get_all_raw_casstrings_empty(): void { + $raw = 'Take some text without cas commands.'; $raws = castext2_parser_utils::get_casstrings($raw); $session = new stack_cas_session2($raws); @@ -488,7 +506,8 @@ public function test_get_all_raw_casstrings_empty() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_raw_casstrings_session() { + public function test_get_all_raw_casstrings_session(): void { + $sa = ['p:diff(sans,x)', 'q = int(tans,x)']; foreach ($sa as $s) { @@ -510,7 +529,8 @@ public function test_get_all_raw_casstrings_session() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_todo_tags_null() { + public function test_get_all_todo_tags_null(): void { + $raw = ''; $this->assertFalse(castext2_parser_utils::has_todoblocks($raw)); $tags = castext2_parser_utils::get_todoblocks($raw); @@ -521,7 +541,8 @@ public function test_get_all_todo_tags_null() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_todo_tags_none() { + public function test_get_all_todo_tags_none(): void { + $raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}.'; $this->assertFalse(castext2_parser_utils::has_todoblocks($raw)); $tags = castext2_parser_utils::get_todoblocks($raw); @@ -532,7 +553,8 @@ public function test_get_all_todo_tags_none() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_todo_tags_empty() { + public function test_get_all_todo_tags_empty(): void { + $raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}. [[todo]]Fix me[[/todo]]'; $this->assertTrue(castext2_parser_utils::has_todoblocks($raw)); $tags = castext2_parser_utils::get_todoblocks($raw); @@ -543,7 +565,8 @@ public function test_get_all_todo_tags_empty() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_todo_tags_order() { + public function test_get_all_todo_tags_order(): void { + $raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}. [[todo tags="something,draft"]]Fix me[[/todo]]'; $this->assertTrue(castext2_parser_utils::has_todoblocks($raw)); $tags = castext2_parser_utils::get_todoblocks($raw); @@ -554,7 +577,8 @@ public function test_get_all_todo_tags_order() { /** * @covers \qtype_stack\stack_cas_session2::get_keyval_representation */ - public function test_get_all_todo_tags_multiple() { + public function test_get_all_todo_tags_multiple(): void { + $raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}. [[todo tags="something,draft"]]Fix me[[/todo]]'; $raw .= '[[todo tags="draft,additional"]]Don not forget this as well[[/todo]]'; $this->assertTrue(castext2_parser_utils::has_todoblocks($raw)); @@ -566,7 +590,8 @@ public function test_get_all_todo_tags_multiple() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_redefine_variables() { + public function test_redefine_variables(): void { + // Notice this means that within a session the value of n has to be returned at every stage.... $at1 = castext2_evaluatable::make_from_source( 'Let \(n\) be defined by \({@n:3@}\). Now add one to get \({@n:n+1@}\) and square the result \({@n:n^2@}\).', @@ -580,7 +605,8 @@ public function test_redefine_variables() { /** * @covers \qtype_stack\stack_maths::process_display_castext */ - public function test_fact_sheets() { + public function test_fact_sheets(): void { + $cs2 = new stack_cas_session2([], null, 0); $at1 = castext2_evaluatable::make_from_source("[[facts:calc_diff_linearity_rule]]", 'test-case'); $cs2->add_statement($at1); @@ -594,7 +620,8 @@ public function test_fact_sheets() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_assignmatrixelements() { + public function test_assignmatrixelements(): void { + // Assign a value to matrix entries. $cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3']; @@ -614,7 +641,8 @@ public function test_assignmatrixelements() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_assignmatrixelements_p1() { + public function test_assignmatrixelements_p1(): void { + // Assign a value to matrix entries. $cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3']; @@ -636,7 +664,8 @@ public function test_assignmatrixelements_p1() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_options */ - public function test_assignmatrixelements_p2() { + public function test_assignmatrixelements_p2(): void { + // Assign a value to matrix entries. $cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3']; @@ -657,7 +686,8 @@ public function test_assignmatrixelements_p2() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot() { + public function test_plot(): void { + $a2 = ['p:x^3']; $s2 = []; foreach ($a2 as $s) { @@ -682,7 +712,8 @@ public function test_plot() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot_alttext() { + public function test_plot_alttext(): void { + $a2 = ['p:sin(x)']; $s2 = []; @@ -704,7 +735,8 @@ public function test_plot_alttext() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot_alttext_html() { + public function test_plot_alttext_html(): void { + $s2 = []; $cs2 = new stack_cas_session2($s2, null, 0); @@ -719,7 +751,8 @@ public function test_plot_alttext_html() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot_alttext_error() { + public function test_plot_alttext_error(): void { + $a2 = ['p:sin(x)']; $s2 = []; @@ -742,7 +775,8 @@ public function test_plot_alttext_error() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot_small_margin() { + public function test_plot_small_margin(): void { + $a2 = ['p:sin(x)']; $s2 = []; @@ -763,7 +797,8 @@ public function test_plot_small_margin() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot_nottags() { + public function test_plot_nottags(): void { + $a2 = ['p:sin(x)']; $s2 = []; @@ -784,7 +819,8 @@ public function test_plot_nottags() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_plot_option_error() { + public function test_plot_option_error(): void { + $cs2 = new stack_cas_session2([], null, 0); @@ -801,7 +837,8 @@ public function test_plot_option_error() { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_currency_1() { + public function test_currency_1(): void { + $at1 = castext2_evaluatable::make_from_source('This is system cost \$100,000 to create.', 'test-case'); $this->assertTrue($at1->get_valid()); @@ -810,7 +847,8 @@ public function test_currency_1() { /** * @covers \qtype_stack\castext2_evaluatable::make_from_source */ - public function test_forbidden_words() { + public function test_forbidden_words(): void { + $at1 = castext2_evaluatable::make_from_source('This is system cost {@system("rm /tmp/test")@} to create.', 'test-case'); @@ -821,7 +859,8 @@ public function test_forbidden_words() { /** * @covers \qtype_stack\castext2_parser_utils::math_paint */ - public function test_mathdelimiters1() { + public function test_mathdelimiters1(): void { + $a2 = ['a:2']; $s2 = []; foreach ($a2 as $s) { @@ -840,7 +879,8 @@ public function test_mathdelimiters1() { /** * @covers \qtype_stack\castext2_parser_utils::math_paint */ - public function test_mathdelimiters2() { + public function test_mathdelimiters2(): void { + $a2 = ['a:x^2/(1+x^2)^3', 'p:diff(a,x)']; $s2 = []; foreach ($a2 as $s) { @@ -862,7 +902,8 @@ public function test_mathdelimiters2() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_decimalplaces() { + public function test_disp_decimalplaces(): void { + // The function dispdp only holds the number of decimal places to display. It does not do rounding. // Use dispsf for rounding. $a2 = ['a:float(%e)', 'b:3.99999']; @@ -884,7 +925,8 @@ public function test_disp_decimalplaces() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_decimalplaces2() { + public function test_disp_decimalplaces2(): void { + $a2 = ['a:float(%e)', 'b:-3.99999']; $s2 = []; foreach ($a2 as $s) { @@ -905,7 +947,8 @@ public function test_disp_decimalplaces2() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_decimalplaces_error() { + public function test_disp_decimalplaces_error(): void { + $a2 = ['a:float(%e)', 'b:-3.99999']; $s2 = []; foreach ($a2 as $s) { @@ -926,7 +969,8 @@ public function test_disp_decimalplaces_error() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_mult_blank() { + public function test_disp_mult_blank(): void { + $a2 = ['make_multsgn("blank")', 'b:x*y']; $s2 = []; foreach ($a2 as $s) { @@ -946,7 +990,8 @@ public function test_disp_mult_blank() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_mult_dot() { + public function test_disp_mult_dot(): void { + $a2 = ['make_multsgn("dot")', 'b:x*y']; $s2 = []; foreach ($a2 as $s) { @@ -966,7 +1011,8 @@ public function test_disp_mult_dot() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_mult_cross() { + public function test_disp_mult_cross(): void { + $a2 = ['make_multsgn("cross")', 'b:x*y']; $s2 = []; foreach ($a2 as $s) { @@ -986,7 +1032,8 @@ public function test_disp_mult_cross() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_mult_switch() { + public function test_disp_mult_switch(): void { + $a2 = ['make_multsgn("dot")']; $s2 = []; foreach ($a2 as $s) { @@ -1008,7 +1055,8 @@ public function test_disp_mult_switch() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_equiv_natural_domain() { + public function test_disp_equiv_natural_domain(): void { + $a2 = ['ta:[1/(x-1)+1/(x+1),2*x/(x^2-1)]']; $s2 = []; foreach ($a2 as $s) { @@ -1039,7 +1087,8 @@ public function test_disp_equiv_natural_domain() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_ode1() { + public function test_disp_ode1(): void { + $at1 = new stack_cas_keyval("p1:'diff(y,x,2)+2*y = 0;p2:ev('diff(y,x,2),simp)+2*ev('diff(y,x,2,z,3),simp) = 0;", null, 123); $this->assertTrue($at1->get_valid()); @@ -1060,7 +1109,8 @@ public function test_disp_ode1() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_ode2() { + public function test_disp_ode2(): void { + $vars = "derivabbrev:true;p1:'diff(y,x,2)+2*y = 0;p2:ev('diff(y,x,2),simp)+2*ev('diff(y,x,2,z,3),simp) = 0;"; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -1079,7 +1129,8 @@ public function test_disp_ode2() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_int() { + public function test_disp_int(): void { + $vars = "foo:'int(f(x),x)"; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -1098,7 +1149,8 @@ public function test_disp_int() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_strings_in_castext() { + public function test_strings_in_castext(): void { + $vars = "st1:[\"\;\sin(x^2)\",\"\;\cos(x^2)\"]\n/* And a comment: with LaTeX \;\sin(x) */ \n a:3;"; $at1 = new stack_cas_keyval($vars, null, 123); @@ -1117,7 +1169,8 @@ public function test_strings_in_castext() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_strings_in_castext_escaped() { + public function test_strings_in_castext_escaped(): void { + $vars = 'st:"This is a string with escaped \" strings...."'; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -1135,7 +1188,8 @@ public function test_strings_in_castext_escaped() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_strings_in_castext_translated() { + public function test_strings_in_castext_translated(): void { + $vars = 'st:a and "!AND!"'; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -1160,7 +1214,8 @@ public function test_strings_in_castext_translated() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_strings_only() { + public function test_strings_only(): void { + $s = '{@"This is a string"@} whereas this is empty |{@""@}|. Not quite empty |{@" "@}|.'; $at2 = castext2_evaluatable::make_from_source($s, 'test-case'); @@ -1176,7 +1231,8 @@ public function test_strings_only() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_strings_only_latex() { + public function test_strings_only_latex(): void { + // Remember the quotes below are escaped! $s = '{@"This is a string with LaTeX in it \\\\(\\\\pi\\\\)."@}'; @@ -1193,7 +1249,8 @@ public function test_strings_only_latex() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_strings_embeded() { + public function test_strings_embeded(): void { + $s = '{@"This is a string"+x^2@}.'; $at2 = castext2_evaluatable::make_from_source($s, 'test-case'); @@ -1209,7 +1266,8 @@ public function test_strings_embeded() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_float_default() { + public function test_numerical_display_float_default(): void { + // The number 0.000001 used to be tested, but it was giving weird results. // On some versions of Maxima, including the latest, it comes back as // 10.0e-7, instead of 1.0e-6. Other versions get it right. I did not like @@ -1229,7 +1287,8 @@ public function test_numerical_display_float_default() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_float_decimal() { + public function test_numerical_display_float_decimal(): void { + $st = 'Decimal numbers {@0.1@}, {@0.01@}, {@0.001@}, {@0.0001@}, {@0.00001@}, {@0.000001@}.'; $a2 = ['stackfltfmt:"~f"']; @@ -1252,7 +1311,8 @@ public function test_numerical_display_float_decimal() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_float_scientific() { + public function test_numerical_display_float_scientific(): void { + // The number 0.000001 is handled below, so we can skip on old Maxima where it fails. $st = 'Decimal numbers {@0.1@}, {@0.01@}, {@0.001@}, {@0.0001@}, {@0.00001@}.'; @@ -1276,7 +1336,8 @@ public function test_numerical_display_float_scientific() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_float_scientific_small() { + public function test_numerical_display_float_scientific_small(): void { + // On old Maxima, you get back \(9.999999999999999e-7\). $this->skip_if_old_maxima('5.32.1'); @@ -1305,7 +1366,8 @@ public function test_numerical_display_float_scientific_small() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_1() { + public function test_numerical_display_1(): void { + $s = 'The decimal number {@n:73@} is written in base \(2\) as {@(stackintfmt:"~2r",n)@}, in base \(7\) ' . 'as {@(stackintfmt:"~7r",n)@}, in scientific notation as {@(stackintfmt:"~e",n)@} ' . 'and in rhetoric as {@(stackintfmt:"~r",n)@}.'; @@ -1324,7 +1386,8 @@ public function test_numerical_display_1() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_binary() { + public function test_numerical_display_binary(): void { + $st = 'The number {@73@} is written in base \(2\).'; $a2 = ['stackintfmt:"~b"']; @@ -1348,7 +1411,8 @@ public function test_numerical_display_binary() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_ampersand_roman() { + public function test_numerical_display_ampersand_roman(): void { + // This test makes sure the castext parser to allows @ within strings within the castext. $st = 'The number {@(stackintfmt:"~@r",14)@} is written in Roman numerals.'; $s2 = []; @@ -1368,7 +1432,8 @@ public function test_numerical_display_ampersand_roman() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_roman() { + public function test_numerical_display_roman(): void { + $st = 'The number {@14@} is written in Roman numerals.'; $a2 = ['stackintfmt:"~@r"']; @@ -1392,7 +1457,8 @@ public function test_numerical_display_roman() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_numerical_display_commas() { + public function test_numerical_display_commas(): void { + $st = 'The number {@3.1415@} is written with commas. '; $st .= 'Sets {@{1.2, 4, 5, 3.123}@} and lists {@[1.2, 4, 5, 3.123]@}'; @@ -1419,7 +1485,8 @@ public function test_numerical_display_commas() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_inline_fractions() { + public function test_inline_fractions(): void { + $s = '{@(stack_disp_fractions("i"), 1/x)@} {@(stack_disp_fractions("d"), 1/x)@} {@(stack_disp_fractions("i"), 1/x)@}'; $at2 = castext2_evaluatable::make_from_source($s, 'test-case'); @@ -1434,7 +1501,8 @@ public function test_inline_fractions() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_inline_fractions_all() { + public function test_inline_fractions_all(): void { + $st = '{@1/x@}, {@1/x^2@}, {@1/(a+x)@}, {@1/(2*a)@}, {@1/sin(x+y)@}.'; $a2 = ['stack_disp_fractions("i")']; @@ -1456,7 +1524,8 @@ public function test_inline_fractions_all() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_disp_greek() { + public function test_disp_greek(): void { + $a2 = ['a:Delta', 'b:sin(Delta^2)', 'c:delta', 't:theta']; $s2 = []; foreach ($a2 as $s) { @@ -1479,7 +1548,8 @@ public function test_disp_greek() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_subscripts() { + public function test_subscripts(): void { + $a2 = ['a:texsub(v, 2*alpha)', 'b:texsub(v, texsub(m, n))']; $s2 = []; foreach ($a2 as $s) { @@ -1503,7 +1573,8 @@ public function test_subscripts() { /** * @covers \qtype_stack\stack_cas_castext2_latex */ - public function test_maxima_arrays() { + public function test_maxima_arrays(): void { + $a2 = ['p1:a[2]', 'p2:a[n+1]', 'p3:a[b_c]']; $s2 = []; foreach ($a2 as $s) { @@ -1529,7 +1600,8 @@ public function test_maxima_arrays() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_length() { + public function test_length(): void { + $a2 = ['f(x):=length(x)', 'b:[1,2,3]', 'c:f(b)']; $s2 = []; foreach ($a2 as $s) { @@ -1551,7 +1623,8 @@ public function test_length() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_lambda() { + public function test_lambda(): void { + $a2 = [ 'sfc: lambda([x,n],significantfigures(x,n))', 'n:[3.1234,1]', 'm:apply(sfc,n)', @@ -1579,7 +1652,8 @@ public function test_lambda() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_apply() { + public function test_apply(): void { + $a2 = ['p1:apply("+",[x,y,z]);']; $s2 = []; foreach ($a2 as $s) { @@ -1604,7 +1678,8 @@ public function test_apply() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stackintfmt() { + public function test_stackintfmt(): void { + // Note, we have set up one pattern as CAS strings because we cannot have @ symbols in CAStext at this point. // This will be fixed in castext2 (stateful). $a2 = ['n:1234', 'str1:"~@R"']; @@ -1645,7 +1720,8 @@ public function test_stackintfmt() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stack_disp_comma_separate() { + public function test_stack_disp_comma_separate(): void { + $st = '{@stack_disp_comma_separate([a,b,c])@} and {#stack_disp_comma_separate([a,b,c])#}.'; $s2 = []; @@ -1662,7 +1738,8 @@ public function test_stack_disp_comma_separate() { /** * @covers \qtype_stack\stack_cas_castext2_jsxgraph */ - public function test_stack_jsxgraph_statestore() { + public function test_stack_jsxgraph_statestore(): void { + $st = '[[jsxgraph input-ref-stateStore="stateRef"]]' . 'var board = JXG.JSXGraph.initBoard(divid, {axis: true, showCopyright: false});' . 'var p = board.create(\'point\', [4, 3]);' . @@ -1677,7 +1754,8 @@ public function test_stack_jsxgraph_statestore() { /** * @covers \qtype_stack\stack_cas_castext2_geogebra */ - public function test_stack_geogebra_statestore() { + public function test_stack_geogebra_statestore(): void { + // Eigenen test schreibenXXX. $st = '[[geogebra input-ref-stateStore="stateRef"]]' . '[[/geogebra]]'; @@ -1690,7 +1768,8 @@ public function test_stack_geogebra_statestore() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stack_var_makelist() { + public function test_stack_var_makelist(): void { + $a2 = [ 'vars0:stack_var_makelist(k, 5)', 'vars1:rest(stack_var_makelist(k, 6))', @@ -1717,7 +1796,8 @@ public function test_stack_var_makelist() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stack_simp_false_true() { + public function test_stack_simp_false_true(): void { + $a2 = [ 'simp:false', 'p1:1+1', @@ -1746,7 +1826,8 @@ public function test_stack_simp_false_true() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stack_simp_false_true_false() { + public function test_stack_simp_false_true_false(): void { + // In STACK v<4.3 authors often control simp within a session. $a2 = [ 'simp:false', @@ -1777,7 +1858,8 @@ public function test_stack_simp_false_true_false() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stack_simp_false_castext() { + public function test_stack_simp_false_castext(): void { + // Check all the forms raised in issue #849. $a2 = ['p1:1+1']; $s2 = []; @@ -1806,7 +1888,8 @@ public function test_stack_simp_false_castext() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_ast_container */ - public function test_stack_beta_function_arg() { + public function test_stack_beta_function_arg(): void { + $a2 = [ 'n:1932;', 'f(alfa):=block(x:ifactors(alfa), y:makelist(0,length(x)), ' . @@ -1835,7 +1918,8 @@ public function test_stack_beta_function_arg() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_orderless() { + public function test_orderless(): void { + // The unorder() function is not supported due to the way STACK interacts with Maxima. $vars = "orderless(b);\np1:a+b+c;"; $at1 = new stack_cas_keyval($vars, null, 123); @@ -1866,7 +1950,8 @@ public function test_orderless() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_complex_numbers() { + public function test_display_complex_numbers(): void { + // Typically with simp:true this does not display as a+bi. $vars = "p1:a+b*%i;"; $at1 = new stack_cas_keyval($vars, null, 123); @@ -1885,7 +1970,8 @@ public function test_display_complex_numbers() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_polarform() { + public function test_display_polarform(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -1907,7 +1993,8 @@ public function test_display_polarform() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_logic() { + public function test_display_logic(): void { + $vars = 'make_logic("lang");'; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -1958,7 +2045,8 @@ public function test_display_logic() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_tables() { + public function test_display_tables(): void { + $vars = 'T0:table([x,x^3],[-1,-1],[0,0],[1,1],[2,8],[3,27]);'; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -2025,7 +2113,8 @@ public function test_display_tables() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_equation_match_brackets() { + public function test_display_equation_match_brackets(): void { + $vars = "p1:x+1;\np2:expand(p1^3);"; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -2043,7 +2132,8 @@ public function test_display_equation_match_brackets() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_apply() { + public function test_display_apply(): void { + $vars = "ans1:transpose(matrix([1,1,0,0])); ans2:transpose(matrix([0,1,1,0])); ans3:transpose(matrix([0,0,1,1])); " . "ans4:transpose(matrix([1,0,1,1])); /* The standard basis for R^4 */ " . "SB:setify(maplist(transpose,apply(matrix,args(ident(4))))); /* Form a matrix of the student's vectors.*/ " . @@ -2069,7 +2159,8 @@ public function test_display_apply() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_texput_complex_function() { + public function test_texput_complex_function(): void { + $vars = 'texput(u,lambda([ex],if length(ex)<4 then return("\\bigcup_{?=?}^{?} ? ") else' . 'sconcat("\\bigcup_{" ,tex1(second(ex)), " = ", tex1(third(ex)), "}^{", tex1(fourth(ex)), ' . '"} ", tex1(first(ex)))));'; @@ -2089,7 +2180,8 @@ public function test_texput_complex_function() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_texput_hat() { + public function test_texput_hat(): void { + $vars = 'texput(hat, lambda([ex], sconcat("\\\\hat{", tex1(first(ex)), "}")));'; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -2107,7 +2199,8 @@ public function test_texput_hat() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_tex_aligned() { + public function test_tex_aligned(): void { + $vars = ''; $at1 = new stack_cas_keyval($vars, null, 123); $this->assertTrue($at1->get_valid()); @@ -2127,7 +2220,8 @@ public function test_tex_aligned() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_tree() { + public function test_display_tree(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -2198,7 +2292,8 @@ public function test_display_tree() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_tree_texput() { + public function test_display_tree_texput(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -2222,7 +2317,8 @@ public function test_display_tree_texput() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_constants_texput() { + public function test_display_constants_texput(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -2243,7 +2339,8 @@ public function test_display_constants_texput() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_display_tree_strings() { + public function test_display_tree_strings(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -2266,7 +2363,8 @@ public function test_display_tree_strings() { * @covers \qtype_stack\castext2_evaluatable::make_from_source * @covers \qtype_stack\stack_cas_keyval */ - public function test_stack_csv_formatter() { + public function test_stack_csv_formatter(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -2307,7 +2405,8 @@ public function test_stack_csv_formatter() { * @covers \qtype_stack\castext2_evaluatable::make_from_source * @covers \qtype_stack\stack_cas_keyval */ - public function test_stack_lang() { + public function test_stack_lang(): void { + $options = new stack_options(); $options->set_option('simplify', false); @@ -2341,7 +2440,8 @@ public function test_stack_lang() { * @covers \qtype_stack\castext2_evaluatable::make_from_source * @covers \qtype_stack\stack_cas_keyval */ - public function test_stack_pick_lang() { + public function test_stack_pick_lang(): void { + global $SESSION; // Choose something not English, Australian or Finnish! $SESSION->forcelang = 'cn'; @@ -2369,7 +2469,8 @@ public function test_stack_pick_lang() { * @covers \qtype_stack\castext2_evaluatable::make_from_source * @covers \qtype_stack\stack_cas_keyval */ - public function test_stack_pick_seed() { + public function test_stack_pick_seed(): void { + $a2 = []; $s2 = []; foreach ($a2 as $s) { @@ -2394,7 +2495,8 @@ public function test_stack_pick_seed() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_include_local() { + public function test_include_local(): void { + $options = new stack_options(); $vars = "stack_include_contrib(\"validators.mac\");"; @@ -2415,7 +2517,8 @@ public function test_include_local() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_unary_minus_zeros() { + public function test_unary_minus_zeros(): void { + $options = new stack_options(); $options->set_option('simplify', false); $cs2 = new stack_cas_session2([], $options, 123456); @@ -2434,7 +2537,8 @@ public function test_unary_minus_zeros() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_make_mult_sgn_stackunits() { + public function test_make_mult_sgn_stackunits(): void { + $options = new stack_options(); $options->set_option('simplify', false); $cs2 = new stack_cas_session2([], $options, 123456); @@ -2456,7 +2560,8 @@ public function test_make_mult_sgn_stackunits() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_unexpected_lambda() { + public function test_unexpected_lambda(): void { + $a2 = ['a:b+1', 'c:a-a(d+1)']; $s2 = []; foreach ($a2 as $s) { @@ -2480,7 +2585,8 @@ public function test_unexpected_lambda() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_format_moodle() { + public function test_format_moodle(): void { + $a2 = ['p1:diff(sin(x^2),x)']; $s2 = []; foreach ($a2 as $s) { @@ -2515,7 +2621,8 @@ public function test_format_moodle() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_format_moodle_parsons() { + public function test_format_moodle_parsons(): void { + $a2 = ['thm:"The Great and Wonderful Theorem"', 'proof_steps:[["s1","Proof step 1"],["s2","Proof step 2"]]', ]; $s2 = []; @@ -2551,7 +2658,8 @@ public function test_format_moodle_parsons() { * @covers \qtype_stack\stack_cas_castext2_latex * @covers \qtype_stack\stack_cas_keyval */ - public function test_sqrtdispflag() { + public function test_sqrtdispflag(): void { + // Test 1. $a2 = ['p1:1+sqrt(x)']; $s2 = []; diff --git a/tests/connection_test.php b/tests/connection_test.php index 4231da0a133..26764aa1d5c 100644 --- a/tests/connection_test.php +++ b/tests/connection_test.php @@ -32,7 +32,8 @@ */ class connection_test extends qtype_stack_testcase { - public function test_compute_true() { + public function test_compute_true(): void { + $connection = stack_connection_helper::make(); $strin = 'cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("p",errcatch(diff(x^n,x))),' .' print("] ]"), return(true));'; @@ -46,7 +47,8 @@ public function test_compute_true() { $this->assertEquals($expected, $return); } - public function test_compute_dispvalue() { + public function test_compute_dispvalue(): void { + $connection = stack_connection_helper::make(); $strin = 'cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("p",errcatch(dispdp(1,3))),' .' print("] ]"), return(true));'; @@ -60,7 +62,8 @@ public function test_compute_dispvalue() { $this->assertEquals($expected, $return); } - public function test_compute_dispvalue_units() { + public function test_compute_dispvalue_units(): void { + $connection = stack_connection_helper::make(); $strin = 'cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("p",errcatch(stackunits(dispsf(30,4),kg))),' .' print("] ]"), return(true));'; @@ -77,7 +80,8 @@ public function test_compute_dispvalue_units() { /* * Note, with this test on SBCL the timeout can create a runaway process. */ - public function test_compute_miss_formed_command() { + public function test_compute_miss_formed_command(): void { + $connection = stack_connection_helper::make(); // This will induce a timeout on the CAS because we don't have a well formed CAS statement. $strin = 'cab:block([],print("[STACKSTART ;'; diff --git a/tests/docslib_test.php b/tests/docslib_test.php index 65b4fb8dcad..ae4077eface 100644 --- a/tests/docslib_test.php +++ b/tests/docslib_test.php @@ -37,14 +37,16 @@ */ class docslib_test extends qtype_stack_testcase { - public function test_stack_docs_title_from_filename() { + public function test_stack_docs_title_from_filename(): void { + $this->assertEquals('About', stack_docs_title_from_filename('About')); $this->assertEquals('Some folder', stack_docs_title_from_filename('Some_folder')); $this->assertEquals('Documentation', stack_docs_title_from_filename('Documentation.md')); $this->assertEquals('Future plans', stack_docs_title_from_filename('Future_plans.md')); } - public function test_stack_docs_index() { + public function test_stack_docs_index(): void { + global $CFG; $this->assertEquals(str_replace('WWWROOT', $CFG->wwwroot, '
    ' . @@ -76,7 +78,8 @@ public function test_stack_docs_index() { $CFG->wwwroot . '/question/type/stack/doc.php/Students')); } - public function test_stack_docs_render_markdown() { + public function test_stack_docs_render_markdown(): void { + global $CFG; require_once($CFG->libdir . '/environmentlib.php'); $currentversion = normalize_version(get_config('', 'release')); @@ -109,14 +112,16 @@ public function test_stack_docs_render_markdown() { } } - public function test_stack_docs_render_markdown_with_proof() { + public function test_stack_docs_render_markdown_with_proof(): void { + $md = '

    H1. Assume that \(3 \cdot 2^{172} + 1\) is a perfect square.

    '; $ex = $md . "\n"; $this->assert_content_with_maths_equals($ex, stack_docs_render_markdown($md)); } - public function test_stack_docs_render_markdown_with_table() { + public function test_stack_docs_render_markdown_with_table(): void { + global $CFG; require_once($CFG->libdir . '/environmentlib.php'); $currentversion = normalize_version(get_config('', 'release')); diff --git a/tests/editform_test.php b/tests/editform_test.php index 6fdd6dc3905..25fad4f8a8d 100644 --- a/tests/editform_test.php +++ b/tests/editform_test.php @@ -83,7 +83,8 @@ protected function get_form($questiontext, $specificfeedback) { return new editform_test_class($questiontext, $specificfeedback); } - public function test_get_input_names_from_question_text_default() { + public function test_get_input_names_from_question_text_default(): void { + $form = $this->get_form(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, \qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK); $qtype = new \qtype_stack(); @@ -92,7 +93,8 @@ public function test_get_input_names_from_question_text_default() { $qtype->get_input_names_from_question_text(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT)); } - public function test_get_prt_names_from_question_default() { + public function test_get_prt_names_from_question_default(): void { + $form = $this->get_form(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT, \qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK); $qtype = new \qtype_stack(); diff --git a/tests/fact_sheets_test.php b/tests/fact_sheets_test.php index fb95047bb2d..754de5788c3 100644 --- a/tests/fact_sheets_test.php +++ b/tests/fact_sheets_test.php @@ -32,18 +32,21 @@ */ class fact_sheets_test extends qtype_stack_testcase { - public function test_basic_castext_instantiation() { + public function test_basic_castext_instantiation(): void { + $this->assertEquals([], stack_fact_sheets::get_unrecognised_tags('Hello world')); } - public function test_trap_bad_fact_sheet_names() { + public function test_trap_bad_fact_sheet_names(): void { + $this->assertEquals([0 => 'bad_hint', 1 => 'badder_hint'], stack_fact_sheets::get_unrecognised_tags( "This is some CAStext with a [[facts:bad_hint]] " . "and yet another [[facts:badder_hint]]")); } - public function test_legacy_convert() { + public function test_legacy_convert(): void { + $this->assertEquals("An [[facts:old_hint]] and [[facts:older_hint]].", stack_fact_sheets::convert_legacy_tags("An old_hint and older_hint.")); } diff --git a/tests/graphlayout_test.php b/tests/graphlayout_test.php index 58480c0eaf9..9168fae6481 100644 --- a/tests/graphlayout_test.php +++ b/tests/graphlayout_test.php @@ -42,7 +42,8 @@ class graphlayout_test extends basic_testcase { * /\ * \ */ - public function test_simple_graph() { + public function test_simple_graph(): void { + $graph = new stack_abstract_graph(); $graph->add_node(1, '', 2, 3, '=1', '=0'); $graph->add_node(2, '', null, 4, '+0.1', '-0.1'); @@ -79,7 +80,8 @@ public function test_simple_graph() { * This is quite a common pattern in STACK questions. * Also, here we test layout out a graph where the root node is not first. */ - public function test_linear_graph() { + public function test_linear_graph(): void { + $graph = new stack_abstract_graph(); $graph->add_node(2, '', null, null, '+0.1', '-0.1'); $graph->add_node(1, '', 2, 2, '=1', '=0'); @@ -103,7 +105,8 @@ public function test_linear_graph() { /** * This graph has 1 node and contains a loop. We verify it is detected. */ - public function test_loop_detection() { + public function test_loop_detection(): void { + $graph = new stack_abstract_graph(); $graph->add_node(1, '', 1, 1, '=1', '=0'); $graph->layout(); @@ -124,7 +127,8 @@ public function test_loop_detection() { /** * This graph has 2 distinct nodes. We verify that they are both detected as roots. */ - public function test_two_roots() { + public function test_two_roots(): void { + $graph = new stack_abstract_graph(); $graph->add_node(1, '', null, null, '=1', '=0'); $graph->add_node(2, '', null, null, '=1', '=0'); @@ -145,7 +149,8 @@ public function test_two_roots() { /** * This graph has a link to a non-existent node. We verify that throws an exception. */ - public function test_missing_node() { + public function test_missing_node(): void { + $this->expectException(\coding_exception::class); $graph = new stack_abstract_graph(); $graph->add_node(1, '', null, 2, '=1', '=0'); @@ -156,7 +161,8 @@ public function test_missing_node() { /** * This graph has a link to a non-existent node. We verify that throws an exception. */ - public function test_get_suggested_node_names() { + public function test_get_suggested_node_names(): void { + $graph = new stack_abstract_graph(); $graph->add_node(1, '', 2, 3); $graph->add_node(2, '', 7, null); diff --git a/tests/input_algebraic_test.php b/tests/input_algebraic_test.php index 4c5ad016c3d..ddc791793cf 100644 --- a/tests/input_algebraic_test.php +++ b/tests/input_algebraic_test.php @@ -45,7 +45,8 @@ */ class input_algebraic_test extends qtype_stack_testcase { - public function test_internal_validate_parameter() { + public function test_internal_validate_parameter(): void { + $el = stack_input_factory::make('algebraic', 'input', 'x^2'); $this->assertTrue($el->validate_parameter('boxWidth', 30)); $this->assertFalse($el->validate_parameter('boxWidth', -10)); @@ -57,7 +58,8 @@ public function test_internal_validate_parameter() { $this->assertFalse($el->validate_parameter('showValidation', 5)); } - public function test_render_blank() { + public function test_render_blank(): void { + $el = stack_input_factory::make('algebraic', 'ans1', 'x^2'); $this->assertEquals('set_parameter('options', 'allowempty'); @@ -79,7 +82,8 @@ public function test_render_blank_allowempty() { 'stack1__ans1', false, null)); } - public function test_render_zero() { + public function test_render_zero(): void { + $el = stack_input_factory::make('algebraic', 'ans1', '0'); $this->assertEquals('assertEquals('assertEquals('assertEquals('assertEquals( 'set_parameter('boxWidth', 30); $this->assertEquals('set_parameter('syntaxHint', 'Remove me'); $el->set_parameter('syntaxAttribute', 1); @@ -153,7 +163,8 @@ public function test_render_placeholder() { 'stack1__sans1', false, null)); } - public function test_syntaxhint() { + public function test_syntaxhint(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '[a, b, c]'); $el->set_parameter('syntaxHint', '[?, ?, ?]'); @@ -175,7 +186,8 @@ public function test_syntaxhint() { 'You should replace these with a specific value.', $state->errors); } - public function test_validate_student_response_algebraic_1() { + public function test_validate_student_response_algebraic_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $state = $el->validate_student_response(['sans1' => 'x^2'], $options, 'x^2/(1+x^2)', new stack_cas_security()); @@ -210,7 +222,8 @@ public function test_validate_student_response_algebraic_1() { $this->assertEquals($vr, $el->replace_validation_tags($state, 'sans1', '[[validation:sans1]]')); } - public function test_validate_student_response_algebraic_2() { + public function test_validate_student_response_algebraic_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $state = $el->validate_student_response(['sans1' => '2x(1+x^2)'], $options, 'x^2/(1+x^2)', new stack_cas_security()); @@ -228,7 +241,8 @@ public function test_validate_student_response_algebraic_2() { $this->assertEquals($vr, $el->replace_validation_tags($state, 'sans1', '[[validation:sans1]]')); } - public function test_validate_student_response_algebraic_3() { + public function test_validate_student_response_algebraic_3(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $el->set_parameter('insertStars', 1); @@ -240,7 +254,8 @@ public function test_validate_student_response_algebraic_3() { $this->assertEquals(stack_input::SCORE, $state->status); } - public function test_validate_student_response_algebraic_4() { + public function test_validate_student_response_algebraic_4(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $el->set_parameter('insertStars', 1); @@ -251,7 +266,8 @@ public function test_validate_student_response_algebraic_4() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_algebraic_5() { + public function test_validate_student_response_algebraic_5(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $el->set_parameter('insertStars', 1); @@ -261,7 +277,8 @@ public function test_validate_student_response_algebraic_5() { $this->assertEquals('missing_stars | Variable_function | forbiddenVariable', $state->note); } - public function test_validate_student_response_algebraic_6() { + public function test_validate_student_response_algebraic_6(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $el->set_parameter('insertStars', 1); @@ -271,7 +288,8 @@ public function test_validate_student_response_algebraic_6() { $this->assertEquals('forbiddenFunction', $state->note); } - public function test_validate_student_response_algebraic_7() { + public function test_validate_student_response_algebraic_7(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $el->set_parameter('insertStars', 0); @@ -281,7 +299,8 @@ public function test_validate_student_response_algebraic_7() { $this->assertEquals('missing_stars | Variable_function | forbiddenVariable', $state->note); } - public function test_validate_student_response_algebraic_8() { + public function test_validate_student_response_algebraic_8(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2+1/3'); $el->set_parameter('forbidFloats', true); @@ -291,7 +310,8 @@ public function test_validate_student_response_algebraic_8() { $this->assertEquals('Illegal_floats', $state->note); } - public function test_validate_student_response_algebraic_9() { + public function test_validate_student_response_algebraic_9(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1validate_student_response(['sans1' => '1get_teacher_answer_display('1validate_student_response(['sans1' => 'not false xor not(false)'], $options, @@ -321,7 +342,8 @@ public function test_validate_student_response_algebraic_10() { '{\rm not}\left( \mathbf{False} \right) \]', $state->contentsdisplayed); } - public function test_validate_student_response_algebraic_11() { + public function test_validate_student_response_algebraic_11(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'i*(x+1) + j*(2*x+3) + k*(3*x+4)'); $el->set_parameter('insertStars', 5); @@ -388,7 +410,8 @@ public function test_validate_student_response_algebraic_11() { $state->contentsdisplayed); } - public function test_validate_student_response_too_long() { + public function test_validate_student_response_too_long(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)'); $sa = '1' . str_repeat('0', 32768); @@ -399,7 +422,8 @@ public function test_validate_student_response_too_long() { $this->assertEquals('Your input is longer than permitted by STACK.', $state->errors); } - public function test_validate_student_response_ex() { + public function test_validate_student_response_ex(): void { + // The variable ex is used an argument to some Maxima functions and as a local variable. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3*ex+2*ey+5*ez'); @@ -424,7 +448,8 @@ public function test_validate_student_response_ex() { $this->assertEquals($vr, $el->replace_validation_tags($state, 'sans1', '[[validation:sans1]]')); } - public function test_validate_student_lowest_terms_1() { + public function test_validate_student_lowest_terms_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '12/4'); $el->set_parameter('lowestTerms', true); @@ -434,7 +459,8 @@ public function test_validate_student_lowest_terms_1() { $this->assertEquals('Lowest_Terms', $state->note); } - public function test_validate_student_lowest_terms_2() { + public function test_validate_student_lowest_terms_2(): void { + // This test checks the unary minus is *not* in lowest terms. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '-10/-1'); @@ -445,7 +471,8 @@ public function test_validate_student_lowest_terms_2() { $this->assertEquals('Lowest_Terms', $state->note); } - public function test_validate_student_response_with_minus_zero() { + public function test_validate_student_response_with_minus_zero(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('forbidFloats', false); @@ -469,7 +496,8 @@ public function test_validate_student_response_with_minus_zero() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_with_rationalized() { + public function test_validate_student_response_with_rationalized(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('options', 'rationalized'); @@ -482,7 +510,8 @@ public function test_validate_student_response_with_rationalized() { '', $state->errors); } - public function test_validate_student_response_subscripts() { + public function test_validate_student_response_subscripts(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))'); $state = $el->validate_student_response(['sans1' => 'rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))'], @@ -492,7 +521,8 @@ public function test_validate_student_response_subscripts() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_subscript_compare() { + public function test_validate_student_response_subscript_compare(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x_1'); @@ -521,7 +551,8 @@ public function test_validate_student_response_subscript_compare() { $this->assertEquals('\[ x_{1} \]', $state->contentsdisplayed); } - public function test_validate_student_response_trigexp_1() { + public function test_validate_student_response_trigexp_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'sin(ab)^2'); $state = $el->validate_student_response(['sans1' => 'sin^2(ab)'], $options, 'sin(ab)^2', @@ -532,7 +563,8 @@ public function test_validate_student_response_trigexp_1() { $this->assertEquals('missing_stars | trigexp', $state->note); } - public function test_validate_student_response_insertstars_true_1() { + public function test_validate_student_response_insertstars_true_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); $el->set_parameter('insertStars', 1); @@ -543,7 +575,8 @@ public function test_validate_student_response_insertstars_true_1() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_insertstars_false_1() { + public function test_validate_student_response_insertstars_false_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); $el->set_parameter('insertStars', 0); @@ -553,7 +586,8 @@ public function test_validate_student_response_insertstars_false_1() { $this->assertEquals('missing_stars', $state->note); } - public function test_validate_student_response_insertstars_sqrt_1() { + public function test_validate_student_response_insertstars_sqrt_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*sqrt(2)/3'); $el->set_parameter('insertStars', 1); @@ -569,7 +603,8 @@ public function test_validate_student_response_insertstars_sqrt_1() { $el->get_teacher_answer_display('2*sqrt(2)/3', '\frac{2\cdot \sqrt{2}}{3}')); } - public function test_validate_student_response_sametype_true_1() { + public function test_validate_student_response_sametype_true_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); $el->set_parameter('sameType', false); @@ -580,7 +615,8 @@ public function test_validate_student_response_sametype_true_1() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_sametype_true_2() { + public function test_validate_student_response_sametype_true_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'y=2*x'); $el->set_parameter('sameType', false); @@ -591,7 +627,8 @@ public function test_validate_student_response_sametype_true_2() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_sametype_false_1() { + public function test_validate_student_response_sametype_false_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'y=2*x'); $el->set_parameter('sameType', true); @@ -601,7 +638,8 @@ public function test_validate_student_response_sametype_false_1() { $this->assertEquals('SA_not_equation', $state->note); } - public function test_validate_student_response_sametype_false_2() { + public function test_validate_student_response_sametype_false_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'm*x+c'); $el->set_parameter('sameType', true); @@ -611,7 +649,8 @@ public function test_validate_student_response_sametype_false_2() { $this->assertEquals("ATAlgEquiv_TA_not_equation", $state->note); } - public function test_validate_student_response_sametype_false_3() { + public function test_validate_student_response_sametype_false_3(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '{1,2}'); $el->set_parameter('sameType', true); @@ -621,7 +660,8 @@ public function test_validate_student_response_sametype_false_3() { $this->assertEquals('SA_not_set', $state->note); } - public function test_validate_student_response_sametype_false_4() { + public function test_validate_student_response_sametype_false_4(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x'); $el->set_parameter('sameType', true); @@ -631,7 +671,8 @@ public function test_validate_student_response_sametype_false_4() { $this->assertEquals('SA_not_expression', $state->note); } - public function test_validate_student_response_sametype_subscripts_true_valid() { + public function test_validate_student_response_sametype_subscripts_true_valid(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'mu_0*(I_0-I_1)'); $el->set_parameter('sameType', true); @@ -648,7 +689,8 @@ public function test_validate_student_response_sametype_subscripts_true_valid() } } - public function test_validate_student_response_sametype_subscripts_true_invalid() { + public function test_validate_student_response_sametype_subscripts_true_invalid(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'mu_0*(I_0-I_1)'); $el->set_parameter('sameType', true); @@ -667,7 +709,8 @@ public function test_validate_student_response_sametype_subscripts_true_invalid( } } - public function test_validate_student_response_display_1() { + public function test_validate_student_response_display_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '-3*x^2-4'); $el->set_parameter('insertStars', 1); @@ -682,7 +725,8 @@ public function test_validate_student_response_display_1() { $this->assertEquals('\[ -3\cdot x^2-4 \]', $state->contentsdisplayed); } - public function test_validate_student_response_display_2() { + public function test_validate_student_response_display_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '(3*x+1)*(x+ab)'); $el->set_parameter('insertStars', 1); @@ -693,7 +737,8 @@ public function test_validate_student_response_display_2() { $this->assertEquals('\[ \left(3\cdot x+1\right)\cdot \left(x+{\it ab}\right) \]', $state->contentsdisplayed); } - public function test_validate_student_response_display_3() { + public function test_validate_student_response_display_3(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 's^(24*r)'); $el->set_parameter('insertStars', 1); @@ -706,7 +751,8 @@ public function test_validate_student_response_display_3() { $this->assertEquals('\[ s^{r^{24}} \]', $state->contentsdisplayed); } - public function test_validate_student_response_display_noundiff() { + public function test_validate_student_response_display_noundiff(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'noundiff(y/x^2,x,1)-(2*y)/x = x^3*sin(3*x)'); $el->set_parameter('insertStars', 1); @@ -721,7 +767,8 @@ public function test_validate_student_response_display_noundiff() { '\sin \left( 3\cdot x \right) \]', $state->contentsdisplayed); } - public function test_validate_student_response_extra_evaluation() { + public function test_validate_student_response_extra_evaluation(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'noundiff(y/x^2,x,1)-(2*y)/x = x^3*sin(3*x)'); $el->set_parameter('sameType', false); @@ -736,7 +783,8 @@ public function test_validate_student_response_extra_evaluation() { $state->contentsdisplayed); } - public function test_validate_student_response_single_var_chars_on() { + public function test_validate_student_response_single_var_chars_on(): void { + // Check the single variable character option is tested. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '(3*x+1)*(x+ab)'); @@ -751,7 +799,8 @@ public function test_validate_student_response_single_var_chars_on() { $this->assertEquals('\( \left[ a , b , x \right]\) ', $state->lvars); } - public function test_validate_student_response_single_var_chars_off() { + public function test_validate_student_response_single_var_chars_off(): void { + // Check the single variable character option is tested. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '(3x+1)*(x+ab)'); @@ -766,7 +815,8 @@ public function test_validate_student_response_single_var_chars_off() { $this->assertEquals('\( \left[ {\it ab} , x \right]\) ', $state->lvars); } - public function test_validate_student_response_single_var_chars_div() { + public function test_validate_student_response_single_var_chars_div(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '0set_parameter('insertStars', 2); @@ -780,7 +830,8 @@ public function test_validate_student_response_single_var_chars_div() { $this->assertEquals('\( \left[ d , v \right]\) ', $state->lvars); } - public function test_validate_student_response_allowwords_false() { + public function test_validate_student_response_allowwords_false(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); $state = $el->validate_student_response(['sans1' => 'unknownfunction(x^2+1)+3*x'], $options, '2*x', @@ -788,7 +839,8 @@ public function test_validate_student_response_allowwords_false() { $this->assertEquals(stack_input::INVALID, $state->status); } - public function test_validate_student_response_allowwords_true() { + public function test_validate_student_response_allowwords_true(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); $el->set_parameter('allowWords', 'pop, funney1, unknownfunction'); @@ -799,7 +851,8 @@ public function test_validate_student_response_allowwords_true() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_allowwords_402() { + public function test_validate_student_response_allowwords_402(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); @@ -816,7 +869,8 @@ public function test_validate_student_response_allowwords_402() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_forbidwords_none() { + public function test_validate_student_response_forbidwords_none(): void { + // Some functions are converted to "noun" forms. // When we give feedback "your last answer was..." we want the correct forms, not the "nounint" alternatives. $options = new stack_options(); @@ -831,7 +885,8 @@ public function test_validate_student_response_forbidwords_none() { $this->assertEquals('\( \left[ c , x \right]\) ', $state->lvars); } - public function test_validate_student_response_forbidwords_true() { + public function test_validate_student_response_forbidwords_true(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); $el->set_parameter('forbidWords', 'int, diff'); @@ -846,7 +901,8 @@ public function test_validate_student_response_forbidwords_true() { $this->assertEquals('int(x^2+1,x)+c', $state->contentsdisplayed); } - public function test_validate_student_response_forbidwords_int() { + public function test_validate_student_response_forbidwords_int(): void { + // We need this as an alias. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'int(x^2+1,x)+c'); @@ -860,7 +916,8 @@ public function test_validate_student_response_forbidwords_int() { $this->assertEquals('\( \left[ c , x \right]\) ', $state->lvars); } - public function test_validate_student_response_forbidwords_int_true() { + public function test_validate_student_response_forbidwords_int_true(): void { + // We need this as an alias. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*x'); @@ -874,7 +931,8 @@ public function test_validate_student_response_forbidwords_int_true() { $this->assertEquals('integrate(x^2+1,x)+c', $state->contentsdisplayed); } - public function test_validate_student_response_single_variable() { + public function test_validate_student_response_single_variable(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'cos(a*x)/(x*(ln(x)))'); // Assuming single character variable names. @@ -889,7 +947,8 @@ public function test_validate_student_response_single_variable() { $state->contentsdisplayed); } - public function test_validate_student_response_single_variable_xx() { + public function test_validate_student_response_single_variable_xx(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x'); // Assuming single character variable names. @@ -901,7 +960,8 @@ public function test_validate_student_response_single_variable_xx() { $this->assertEquals('\[ x\cdot x \]', $state->contentsdisplayed); } - public function test_validate_student_response_single_variable_subscripts() { + public function test_validate_student_response_single_variable_subscripts(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'a*b_c*d'); // Assuming single character variable names. @@ -915,7 +975,8 @@ public function test_validate_student_response_single_variable_subscripts() { $this->assertEquals('\[ a\cdot {b}_{{\it cd}} \]', $state->contentsdisplayed); } - public function test_validate_student_response_single_variable_subscripts2() { + public function test_validate_student_response_single_variable_subscripts2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'a*v_max'); // Assuming single character variable names. @@ -929,7 +990,8 @@ public function test_validate_student_response_single_variable_subscripts2() { $this->assertEquals('\[ a\cdot {v}_{{\it max}} \]', $state->contentsdisplayed); } - public function test_validate_student_response_single_variable_trigexp() { + public function test_validate_student_response_single_variable_trigexp(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'sin(ab)^2'); // Assuming single character variable names. @@ -943,7 +1005,8 @@ public function test_validate_student_response_single_variable_trigexp() { $this->assertEquals('\[ \sin ^2\left(a\cdot b\right) \]', $state->contentsdisplayed); } - public function test_validate_student_response_single_variable_trigexp_2() { + public function test_validate_student_response_single_variable_trigexp_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'sin(ab)^2'); // Assuming single character variable names. @@ -957,7 +1020,8 @@ public function test_validate_student_response_single_variable_trigexp_2() { $this->assertEquals('missing_stars | trigexp', $state->note); } - public function test_validate_student_response_functions_variable() { + public function test_validate_student_response_functions_variable(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'a/(a*(x+1)+2)'); @@ -967,7 +1031,8 @@ public function test_validate_student_response_functions_variable() { $this->assertEquals("missing_stars | Variable_function", $state->note); } - public function test_validate_student_response_simp_1() { + public function test_validate_student_response_simp_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '[1,4,9,16,25,36,49,64]'); $el->set_parameter('options', 'simp'); @@ -982,7 +1047,8 @@ public function test_validate_student_response_simp_1() { $state->contentsdisplayed); } - public function test_validate_student_response_simp_float_1() { + public function test_validate_student_response_simp_float_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '7.0'); $el->set_parameter('forbidFloats', false); @@ -998,7 +1064,8 @@ public function test_validate_student_response_simp_float_1() { $state->contentsdisplayed); } - public function test_validate_student_response_simp_float_2() { + public function test_validate_student_response_simp_float_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '7.0'); $el->set_parameter('forbidFloats', false); @@ -1015,7 +1082,8 @@ public function test_validate_student_response_simp_float_2() { $state->contentsdisplayed); } - public function test_validate_lg_1() { + public function test_validate_lg_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'lg(27,3)'); $state = $el->validate_student_response(['sans1' => 'lg(27,3)'], $options, 'lg(27,3)', new stack_cas_security()); @@ -1028,7 +1096,8 @@ public function test_validate_lg_1() { $el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed)); } - public function test_validate_lg_10() { + public function test_validate_lg_10(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'lg(23,10)'); $state = $el->validate_student_response(['sans1' => 'lg(23,10)'], $options, 'lg(23,10)', new stack_cas_security()); @@ -1041,7 +1110,8 @@ public function test_validate_lg_10() { $el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed)); } - public function test_validate_lg_10b() { + public function test_validate_lg_10b(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'lg(19)'); $state = $el->validate_student_response(['sans1' => 'lg(19)'], $options, 'lg(19)', new stack_cas_security()); @@ -1054,7 +1124,8 @@ public function test_validate_lg_10b() { $el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed)); } - public function test_validate_ln() { + public function test_validate_ln(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3 ln 19'); $el->set_parameter('insertStars', 4); @@ -1065,7 +1136,8 @@ public function test_validate_ln() { $this->assertEquals('3 ln 19', $state->contentsdisplayed); } - public function test_validate_set_1() { + public function test_validate_set_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '{a,b,c}'); $state = $el->validate_student_response(['sans1' => '{a,b,c}'], $options, '{a,b,c}', new stack_cas_security()); @@ -1074,7 +1146,8 @@ public function test_validate_set_1() { $this->assertEquals('\[ \left \{a , b , c \right \} \]', $state->contentsdisplayed); } - public function test_validate_or_1() { + public function test_validate_or_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x=1 or x=1'); $state = $el->validate_student_response(['sans1' => 'x=1 or x=1'], $options, 'x=1 or x=1', @@ -1084,7 +1157,8 @@ public function test_validate_or_1() { $this->assertEquals('\[ x=1\,{\text{ or }}\, x=1 \]', $state->contentsdisplayed); } - public function test_validate_units() { + public function test_validate_units(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '9'); $state = $el->validate_student_response(['sans1' => '9*hz'], $options, '9', new stack_cas_security()); @@ -1094,7 +1168,8 @@ public function test_validate_units() { $this->assertEquals('\[ 9\cdot {\it hz} \]', $state->contentsdisplayed); } - public function test_validate_string_same_type() { + public function test_validate_string_same_type(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '"A random string"'); $el->set_parameter('sameType', true); @@ -1105,7 +1180,8 @@ public function test_validate_string_same_type() { $this->assertEquals('\[ \text{Hello world} \]', $state->contentsdisplayed); } - public function test_validate_string_same_type_lt() { + public function test_validate_string_same_type_lt(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '"A random string"'); $el->set_parameter('sameType', true); @@ -1116,7 +1192,8 @@ public function test_validate_string_same_type_lt() { $this->assertEquals('\[ \text{Hello < world} \]', $state->contentsdisplayed); } - public function test_validate_string_same_type_invalid1() { + public function test_validate_string_same_type_invalid1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^2'); $el->set_parameter('sameType', true); @@ -1126,7 +1203,8 @@ public function test_validate_string_same_type_invalid1() { $this->assertEquals('\[ \text{Hello world} \]', $state->contentsdisplayed); } - public function test_validate_string_same_type_invalid2() { + public function test_validate_string_same_type_invalid2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '"A random string"'); $el->set_parameter('sameType', true); @@ -1137,7 +1215,8 @@ public function test_validate_string_same_type_invalid2() { $this->assertEquals('\[ x^2 \]', $state->contentsdisplayed); } - public function test_validate_student_response_with_allowempty() { + public function test_validate_student_response_with_allowempty(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('options', 'allowempty'); @@ -1151,7 +1230,8 @@ public function test_validate_student_response_with_allowempty() { $el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed)); } - public function test_validate_student_response_with_allowempty_stars() { + public function test_validate_student_response_with_allowempty_stars(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('options', 'allowempty'); @@ -1185,7 +1265,8 @@ public function test_validate_student_response_with_allowempty_stars() { $el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed)); } - public function test_validate_string_same_type_invalid_division_zero() { + public function test_validate_string_same_type_invalid_division_zero(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^3'); $el->set_parameter('sameType', true); @@ -1195,7 +1276,8 @@ public function test_validate_string_same_type_invalid_division_zero() { $this->assertEquals('\[ \frac{x}{0} \]', $state->contentsdisplayed); } - public function test_validate_student_response_star_space_1() { + public function test_validate_student_response_star_space_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)'); $el->set_parameter('insertStars', 1); @@ -1212,7 +1294,8 @@ public function test_validate_student_response_star_space_1() { $el->get_teacher_answer_display('3*sin(a*b)', '3\\, \\sin(a \cdot b)')); } - public function test_validate_student_response_star_space_2() { + public function test_validate_student_response_star_space_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)'); $el->set_parameter('insertStars', 2); @@ -1225,7 +1308,8 @@ public function test_validate_student_response_star_space_2() { '3*sin(a_b).', $state->errors); } - public function test_validate_student_response_star_space_3() { + public function test_validate_student_response_star_space_3(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)'); $el->set_parameter('insertStars', 3); @@ -1240,7 +1324,8 @@ public function test_validate_student_response_star_space_3() { $state->errors); } - public function test_validate_student_response_star_space_4() { + public function test_validate_student_response_star_space_4(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)'); $el->set_parameter('insertStars', 4); @@ -1252,7 +1337,8 @@ public function test_validate_student_response_star_space_4() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_star_space_5() { + public function test_validate_student_response_star_space_5(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)'); $el->set_parameter('insertStars', 5); @@ -1264,7 +1350,8 @@ public function test_validate_student_response_star_space_5() { $this->assertEquals('', $state->errors); } - public function test_validate_student_response_almost_cardano() { + public function test_validate_student_response_almost_cardano(): void { + // This has a double +- in the input. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x=-b+-sqrt(b*c^2-a)'); @@ -1278,7 +1365,8 @@ public function test_validate_student_response_almost_cardano() { '{\left({-q \pm \sqrt{q^2-p^3}}\right)}^{\frac{1}{3}} \]', $state->contentsdisplayed); } - public function test_validate_student_response_prefixpm() { + public function test_validate_student_response_prefixpm(): void { + // This has a prefix +- in the input. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x= +- b'); @@ -1295,7 +1383,8 @@ public function test_validate_student_response_prefixpm() { . 'x = +-b, would be correct.', $el->get_teacher_answer_display('x= #pm# b', 'x= \pm b')); } - public function test_validate_student_response_pm_expr() { + public function test_validate_student_response_pm_expr(): void { + // This has an expression with more than one +- in the input. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'a +- b +- c'); @@ -1311,7 +1400,8 @@ public function test_validate_student_response_pm_expr() { . 'a+-b+-c, would be correct.', $el->get_teacher_answer_display('a#pm#b#pm#c', '{a \pm b \pm c}')); } - public function test_validate_student_response_pm_eq() { + public function test_validate_student_response_pm_eq(): void { + // This has an expression with more than one +- in an equation in the input. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x +- a = y +- b'); @@ -1328,7 +1418,8 @@ public function test_validate_student_response_pm_eq() { $el->get_teacher_answer_display('x #pm# a = y #pm# b', '{x \pm a}={y \pm b}')); } - public function test_validate_student_response_without_pm() { + public function test_validate_student_response_without_pm(): void { + // This has an expression without +- in the input. $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x-3'); @@ -1341,7 +1432,8 @@ public function test_validate_student_response_without_pm() { $this->assertEquals('\[ x-3 \]', $state->contentsdisplayed); } - public function test_validate_student_response_with_align_right() { + public function test_validate_student_response_with_align_right(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('options', 'align:right'); @@ -1362,7 +1454,8 @@ public function test_validate_student_response_with_align_right() { $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_monospace() { + public function test_validate_student_response_with_monospace(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('options', 'align:right, monospace'); @@ -1384,7 +1477,8 @@ public function test_validate_student_response_with_monospace() { $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_no_monospace_default_on() { + public function test_validate_student_response_with_no_monospace_default_on(): void { + $options = new stack_options(); set_config('inputmonospace', '0,1,2', 'qtype_stack'); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); @@ -1407,7 +1501,8 @@ public function test_validate_student_response_with_no_monospace_default_on() { $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_no_monospace_single_default_on() { + public function test_validate_student_response_with_no_monospace_single_default_on(): void { + $options = new stack_options(); set_config('inputmonospace', '0', 'qtype_stack'); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); @@ -1430,7 +1525,8 @@ public function test_validate_student_response_with_no_monospace_single_default_ $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_no_monospace_default_off() { + public function test_validate_student_response_with_no_monospace_default_off(): void { + $options = new stack_options(); set_config('inputmonospace', '1,2', 'qtype_stack'); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); @@ -1453,7 +1549,8 @@ public function test_validate_student_response_with_no_monospace_default_off() { $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_monospace_true_default_off() { + public function test_validate_student_response_with_monospace_true_default_off(): void { + $options = new stack_options(); set_config('inputmonospace', '1,2', 'qtype_stack'); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); @@ -1476,7 +1573,8 @@ public function test_validate_student_response_with_monospace_true_default_off() $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_monospace_false_default_on() { + public function test_validate_student_response_with_monospace_false_default_on(): void { + $options = new stack_options(); set_config('inputmonospace', '0,1,2', 'qtype_stack'); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); @@ -1499,7 +1597,8 @@ public function test_validate_student_response_with_monospace_false_default_on() $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_monospace_false_default_off() { + public function test_validate_student_response_with_monospace_false_default_off(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); $el->set_parameter('options', 'align:right, monospace:false'); @@ -1521,7 +1620,8 @@ public function test_validate_student_response_with_monospace_false_default_off( $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_with_monospace_default_on() { + public function test_validate_student_response_with_monospace_default_on(): void { + $options = new stack_options(); set_config('inputmonospace', '0', 'qtype_stack'); $el = stack_input_factory::make('algebraic', 'sans1', '1/2'); @@ -1544,7 +1644,8 @@ public function test_validate_student_response_with_monospace_default_on() { $el->render($state, 'stack1__ans1', false, null)); } - public function test_validate_student_response_noununits() { + public function test_validate_student_response_noununits(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '9.81*m/s'); $el->set_parameter('forbidFloats', false); @@ -1576,7 +1677,8 @@ public function test_validate_student_response_noununits() { $el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed)); } - public function test_validate_student_response_subtlesurds() { + public function test_validate_student_response_subtlesurds(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'ans1', '((-1)+sqrt(11))/10'); @@ -1611,7 +1713,8 @@ public function test_validate_student_response_subtlesurds() { $this->assertEquals('', $state->note); } - public function test_validate_student_response_subtlefrac() { + public function test_validate_student_response_subtlefrac(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'ans1', '-a/b'); @@ -1639,7 +1742,8 @@ public function test_validate_student_response_subtlefrac() { $this->assertEquals('', $state->note); } - public function test_validate_student_response_subtle_pm() { + public function test_validate_student_response_subtle_pm(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'ans1', '-a/b'); @@ -1654,7 +1758,8 @@ public function test_validate_student_response_subtle_pm() { $this->assertEquals('', $state->note); } - public function test_validate_student_response_realsets_sametype_1() { + public function test_validate_student_response_realsets_sametype_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '%union(oo(1,2),(3,4))'); $el->set_parameter('sameType', true); @@ -1672,7 +1777,8 @@ public function test_validate_student_response_realsets_sametype_1() { $this->assertEquals('', $state->note); } - public function test_validate_student_response_realsets_sametype_2() { + public function test_validate_student_response_realsets_sametype_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '{3,4,5}'); $el->set_parameter('sameType', true); @@ -1695,7 +1801,8 @@ public function test_validate_student_response_realsets_sametype_2() { '\[ \left[ 3,\, 4\right) \]'); } - public function test_validate_student_response_realsets_sametype_err() { + public function test_validate_student_response_realsets_sametype_err(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})'); $el->set_parameter('sameType', true); @@ -1782,7 +1889,8 @@ public function test_validate_student_response_realsets_sametype_err() { '\[ \left( -\infty ,\, -4\right) \cup x^2 \]'); } - public function test_validate_student_response_realsets_sametype_ok() { + public function test_validate_student_response_realsets_sametype_ok(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})'); $el->set_parameter('sameType', true); @@ -1798,7 +1906,8 @@ public function test_validate_student_response_realsets_sametype_ok() { '\[ \left( a,\, b\right] \]'); } - public function test_validate_student_response_root() { + public function test_validate_student_response_root(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'x^(1/n)'); $el->set_parameter('sameType', true); @@ -1814,7 +1923,8 @@ public function test_validate_student_response_root() { '\[ \sqrt[n]{x} \]'); } - public function test_validate_student_response_tex() { + public function test_validate_student_response_tex(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '{}'); @@ -1829,7 +1939,8 @@ public function test_validate_student_response_tex() { '\​[x^2\​]'); } - public function test_validate_student_response_xss_1() { + public function test_validate_student_response_xss_1(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})'); @@ -1856,7 +1967,8 @@ public function test_validate_student_response_xss_1() { $this->assertEquals($ta, $state->contentsdisplayed); } - public function test_validate_student_response_xss_2() { + public function test_validate_student_response_xss_2(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})'); @@ -1882,7 +1994,8 @@ public function test_validate_student_response_xss_2() { $this->assertEquals($ua, $state->contentsdisplayed); } - public function test_validate_student_response_xss_3() { + public function test_validate_student_response_xss_3(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})'); @@ -1927,7 +2040,8 @@ public function test_validate_student_response_xss_3() { $this->assertEquals($ua, $state->contentsdisplayed); } - public function test_validate_student_response_xss_4() { + public function test_validate_student_response_xss_4(): void { + $options = new stack_options(); $ta = '"Hello world"'; $el = stack_input_factory::make('algebraic', 'sans1', $ta); @@ -2010,7 +2124,8 @@ public function test_validate_student_response_xss_4() { $this->assertEquals($cd, $state->contentsdisplayed); } - public function test_validate_hideanswer() { + public function test_validate_hideanswer(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'state', '[x^2]'); $el->set_parameter('options', 'hideanswer'); @@ -2022,7 +2137,8 @@ public function test_validate_hideanswer() { $this->assertEquals('', $el->get_teacher_answer_display("[SOME JSON]", "\[ \text{[SOME MORE JSON]} \]")); } - public function test_validate_student_response_ntuple() { + public function test_validate_student_response_ntuple(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', 'ntuple(1,-1)'); $el->set_parameter('sameType', true); @@ -2040,7 +2156,8 @@ public function test_validate_student_response_ntuple() { $el->get_teacher_answer_display('ntuple(1,-1)', '\left(1, -1\right)')); } - public function test_validate_student_response_ntuple_forbid() { + public function test_validate_student_response_ntuple_forbid(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '[1,2]'); $el->set_parameter('forbidWords', 'ntuple'); @@ -2054,7 +2171,8 @@ public function test_validate_student_response_ntuple_forbid() { $this->assertEquals('Coordinates are not permitted in this input.', $state->errors); } - public function test_validate_student_response_no_dot_dot() { + public function test_validate_student_response_no_dot_dot(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '3.14*2.78'); $el->set_parameter('forbidFloats', false); @@ -2069,7 +2187,8 @@ public function test_validate_student_response_no_dot_dot() { 'use normal multiplication "*" instead for the same result. 3.14 . 2.78', $state->errors); } - public function test_validate_consolidatesubscripts() { + public function test_validate_consolidatesubscripts(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'state', 'M_1'); $el->set_parameter('options', 'consolidatesubscripts'); @@ -2080,7 +2199,8 @@ public function test_validate_consolidatesubscripts() { $this->assertEquals('\[ M_{1} \]', $state->contentsdisplayed); } - public function test_validate_checkvars() { + public function test_validate_checkvars(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'ans2', 'a+b+c'); @@ -2113,7 +2233,8 @@ public function test_validate_checkvars() { 'These variables are missing: a, b, c.', $state->errors); } - public function test_invalid_validator_name() { + public function test_invalid_validator_name(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'state', 'x^2'); $el->set_parameter('options', 'validator:bad%functionname'); @@ -2126,7 +2247,8 @@ public function test_invalid_validator_name() { $el->get_errors()); } - public function test_missing_validator_() { + public function test_missing_validator_(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'state', 'x^2'); $el->set_parameter('options', 'validator:missingfunction'); @@ -2142,7 +2264,8 @@ public function test_missing_validator_() { $state->errors); } - public function test_validate_student_response_conjugate() { + public function test_validate_student_response_conjugate(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '2*conjugate(x)'); $state = $el->validate_student_response(['sans1' => 'conjugate(x)'], $options, 'conjugate(x)', @@ -2173,7 +2296,8 @@ public function test_validate_student_response_conjugate() { $this->assertEquals('\( \left[ x \right]\) ', $state->lvars); } - public function test_decimal_output_0() { + public function test_decimal_output_0(): void { + $options = new stack_options(); $options->set_option('decimals', ','); $el = stack_input_factory::make('algebraic', 'state', '{3.1415,2.71}', $options); @@ -2199,7 +2323,8 @@ public function test_decimal_output_0() { $el->get_teacher_answer_display('{3.1415,2.71}', '\{3{,}1415 ; 2{,}7100 \right \}')); } - public function test_decimal_output_1() { + public function test_decimal_output_1(): void { + $options = new stack_options(); $options->set_option('decimals', ','); $el = stack_input_factory::make('algebraic', 'state', '{3.1415,2.71}', $options); @@ -2219,7 +2344,8 @@ public function test_decimal_output_1() { $el->get_teacher_answer_display('{3.1415,2.71}', '\{3{,}1415 ; 2{,}71 \right \}')); } - public function test_decimal_output_2() { + public function test_decimal_output_2(): void { + $options = new stack_options(); $options->set_option('decimals', ','); $el = stack_input_factory::make('algebraic', 'state', '{3.1415,2.71}', $options); @@ -2234,7 +2360,8 @@ public function test_decimal_output_2() { $this->assertEquals('', $state->errors); } - public function test_decimal_output_3() { + public function test_decimal_output_3(): void { + $options = new stack_options(); $options->set_option('decimals', ','); $el = stack_input_factory::make('algebraic', 'state', '{3.14,2.7100}', $options); @@ -2249,7 +2376,8 @@ public function test_decimal_output_3() { $this->assertEquals('', $state->errors); } - public function test_decimal_output_4() { + public function test_decimal_output_4(): void { + $options = new stack_options(); $options->set_option('decimals', '.'); $options->set_option('scientificnotation', 'E'); @@ -2264,7 +2392,8 @@ public function test_decimal_output_4() { $this->assertEquals('', $state->errors); } - public function test_decimal_output_5() { + public function test_decimal_output_5(): void { + $options = new stack_options(); $options->set_option('decimals', ','); $options->set_option('scientificnotation', 'E'); @@ -2279,7 +2408,8 @@ public function test_decimal_output_5() { $this->assertEquals('', $state->errors); } - public function test_decimal_output_matrix_1() { + public function test_decimal_output_matrix_1(): void { + $options = new stack_options(); $options->set_option('decimals', ','); // Teacher must use correct syntax. @@ -2303,7 +2433,8 @@ public function test_decimal_output_matrix_1() { $this->assertEquals('', $state->errors); } - public function test_decimal_output_matrix_2() { + public function test_decimal_output_matrix_2(): void { + $options = new stack_options(); $options->set_option('decimals', ','); // Teacher must use correct syntax. @@ -2321,7 +2452,8 @@ public function test_decimal_output_matrix_2() { $this->assertEquals('forbiddenCharDecimal', $state->note); } - public function test_validate__string() { + public function test_validate__string(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', '"A random string"'); $state = $el->validate_student_response(['sans1' => '"Lots of stuff:!$%^&*?@;"'], @@ -2331,7 +2463,8 @@ public function test_validate__string() { $this->assertEquals('\[ \text{Lots of stuff:!\$\%^&*?@;} \]', $state->contentsdisplayed); } - public function test_validate_student_response_single_var_chars_unicode_superscript() { + public function test_validate_student_response_single_var_chars_unicode_superscript(): void { + $options = new stack_options(); $el = stack_input_factory::make('algebraic', 'sans1', ''); $el->set_parameter('insertStars', 2); @@ -2347,7 +2480,8 @@ public function test_validate_student_response_single_var_chars_unicode_superscr $this->assertEquals('', $state->lvars); } - public function test_validate_student_response_km() { + public function test_validate_student_response_km(): void { + // This needs to be available as a variable. // However, km is a function in the descriptive package. See issue #1331. $options = new stack_options(); diff --git a/tests/input_boolean_rendering_test.php b/tests/input_boolean_rendering_test.php index 50df8360a33..a766c6c39b3 100644 --- a/tests/input_boolean_rendering_test.php +++ b/tests/input_boolean_rendering_test.php @@ -44,7 +44,8 @@ class input_boolean_rendering_test extends question_testcase { // phpcs:ignore moodle.Commenting.MissingDocblock.Function - protected function expected_choices() { + protected function expected_choices(): void { + return [ stack_boolean_input::F => stack_string('false'), stack_boolean_input::T => stack_string('true'), @@ -52,7 +53,8 @@ protected function expected_choices() { ]; } - public function test_render_not_answered() { + public function test_render_not_answered(): void { + $el = stack_input_factory::make('boolean', 'ans1', stack_boolean_input::T); $this->assert(new \question_contains_select_expectation( 'stack1__ans1', $this->expected_choices(), stack_boolean_input::NA), @@ -61,7 +63,8 @@ public function test_render_not_answered() { 'stack1__ans1', false, null)); } - public function test_render_true() { + public function test_render_true(): void { + $el = stack_input_factory::make('boolean', 'ans2', stack_boolean_input::T); $this->assert(new \question_contains_select_expectation('stack1__ans2', $this->expected_choices(), stack_boolean_input::T), $el->render(new stack_input_state( @@ -69,7 +72,8 @@ public function test_render_true() { 'stack1__ans2', false, null)); } - public function test_render_false() { + public function test_render_false(): void { + $el = stack_input_factory::make('boolean', 'ans3', stack_boolean_input::T); $this->assert(new \question_contains_select_expectation('stack1__ans3', $this->expected_choices(), stack_boolean_input::F), $el->render(new stack_input_state( @@ -77,7 +81,8 @@ public function test_render_false() { 'stack1__ans3', false, null)); } - public function test_render_disabled() { + public function test_render_disabled(): void { + $el = stack_input_factory::make('boolean', 'input', stack_boolean_input::T); $this->assert(new \question_contains_select_expectation('stack1__ans1', $this->expected_choices(), stack_boolean_input::NA, false), $el->render(new stack_input_state( diff --git a/tests/input_boolean_validation_test.php b/tests/input_boolean_validation_test.php index e75a3105888..0734ba50dff 100644 --- a/tests/input_boolean_validation_test.php +++ b/tests/input_boolean_validation_test.php @@ -42,7 +42,8 @@ * @covers \stack_boolean_input */ class input_boolean_validation_test extends qtype_stack_testcase { - public function test_validate_student_response_true() { + public function test_validate_student_response_true(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'true'); $state = $el->validate_student_response(['sans1' => 'true'], $options, 'true', new stack_cas_security()); @@ -51,7 +52,8 @@ public function test_validate_student_response_true() { $this->assertEquals('\[ \mathbf{True} \]', $state->contentsdisplayed); } - public function test_validate_student_response_false() { + public function test_validate_student_response_false(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'true'); $state = $el->validate_student_response(['sans1' => 'false'], $options, 'true', new stack_cas_security()); @@ -60,7 +62,8 @@ public function test_validate_student_response_false() { $this->assertEquals('\[ \mathbf{False} \]', $state->contentsdisplayed); } - public function test_validate_student_response_na() { + public function test_validate_student_response_na(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'true'); $state = $el->validate_student_response([], $options, 'true', new stack_cas_security()); @@ -69,7 +72,8 @@ public function test_validate_student_response_na() { $this->assertEquals('', $state->contentsdisplayed); } - public function test_validate_student_response_error() { + public function test_validate_student_response_error(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'true'); $state = $el->validate_student_response(['sans1' => 'frog'], $options, 'true', new stack_cas_security()); @@ -78,7 +82,8 @@ public function test_validate_student_response_error() { $this->assertEquals('frog', $state->contentsdisplayed); } - public function test_validate_student_response_emptyanswer() { + public function test_validate_student_response_emptyanswer(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'EMPTYANSWER'); $state = $el->validate_student_response(['sans1' => 'true'], $options, 'true', new stack_cas_security()); @@ -87,7 +92,8 @@ public function test_validate_student_response_emptyanswer() { $this->assertEquals('\[ \mathbf{True} \]', $state->contentsdisplayed); } - public function test_validate_student_response_emptyanswer_option_sa() { + public function test_validate_student_response_emptyanswer_option_sa(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'true'); $el->set_parameter('options', 'allowempty'); @@ -96,7 +102,8 @@ public function test_validate_student_response_emptyanswer_option_sa() { $this->assertEquals('EMPTYANSWER', $state->contentsmodified); } - public function test_validate_student_response_emptyanswer_option_ta() { + public function test_validate_student_response_emptyanswer_option_ta(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'sans1', 'EMPTYANSWER'); $el->set_parameter('options', 'allowempty'); @@ -105,7 +112,8 @@ public function test_validate_student_response_emptyanswer_option_ta() { $this->assertEquals('EMPTYANSWER', $state->contentsmodified); } - public function test_validate_hideanswer() { + public function test_validate_hideanswer(): void { + $options = new stack_options(); $el = stack_input_factory::make('boolean', 'state', 'false'); $el->set_parameter('options', 'hideanswer'); diff --git a/tests/input_checkbox_test.php b/tests/input_checkbox_test.php index 9b71d690168..f3a1b06101d 100644 --- a/tests/input_checkbox_test.php +++ b/tests/input_checkbox_test.php @@ -45,7 +45,8 @@ class input_checkbox_test extends qtype_stack_testcase { // phpcs:ignore moodle.Commenting.MissingDocblock.Function - protected function expected_choices() { + protected function expected_choices(): void { + return [ '' => stack_string('notanswered'), '1' => 'x+1', @@ -55,7 +56,8 @@ protected function expected_choices() { } // phpcs:ignore moodle.Commenting.MissingDocblock.Function - protected function expected_choices_latex() { + protected function expected_choices_latex(): void { + return [ '' => stack_string('notanswered'), '1' => 'x+1', @@ -71,11 +73,13 @@ protected function make_checkbox($parameters = []) { } // phpcs:ignore moodle.Commenting.MissingDocblock.Function - protected function make_ta() { + protected function make_ta(): void { + return '[[x+1,true],[x+2,false],[sin(pi*n),false]]'; } - public function test_simple_checkbox() { + public function test_simple_checkbox(): void { + // @codingStandardsIgnoreStart $el = stack_input_factory::make('checkbox', 'ans1', '[[1+x,true],[2+y,false]]', null, array()); // @codingStandardsIgnoreEnd @@ -93,7 +97,8 @@ public function test_simple_checkbox() { $this->assertEquals($expected, $el->get_teacher_answer_display(false, false)); } - public function test_simple_casstring_checkbox() { + public function test_simple_casstring_checkbox(): void { + // @codingStandardsIgnoreStart $el = stack_input_factory::make('checkbox', 'ans1', '[[1+x,true],[2+y,false]]', null, array('options' => 'casstring')); @@ -108,7 +113,8 @@ public function test_simple_casstring_checkbox() { stack_input::SCORE, [''], '', '', '', '', ''), 'stack1__ans1', false, null)); } - public function test_bad_teacheranswer() { + public function test_bad_teacheranswer(): void { + $el = $this->make_checkbox(); $el->adapt_to_model_answer('[x]'); $expected = '