MDL-69145 core: Set the default filterset join type to ALL

* Plus minor PHPDoc type fix for the JOINTYPE_DEFAULT constants
This commit is contained in:
Jun Pataleta 2020-11-24 22:28:46 +08:00
parent 7fa836cf36
commit a489f20f17
3 changed files with 9 additions and 4 deletions

View File

@ -41,7 +41,7 @@ use Iterator;
*/
class filter implements Countable, Iterator, JsonSerializable {
/** @var in The default filter type (ANY) */
/** @var int The default filter type (ANY) */
const JOINTYPE_DEFAULT = 1;
/** @var int None of the following match */

View File

@ -40,8 +40,8 @@ use moodle_exception;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class filterset implements JsonSerializable {
/** @var in The default filter type (ANY) */
const JOINTYPE_DEFAULT = 1;
/** @var int The default filter type (ALL) */
const JOINTYPE_DEFAULT = 2;
/** @var int None of the following match */
const JOINTYPE_NONE = 0;
@ -53,7 +53,7 @@ abstract class filterset implements JsonSerializable {
const JOINTYPE_ALL = 2;
/** @var int The join type currently in use */
protected $jointype = self::JOINTYPE_DEFAULT;
protected $jointype = null;
/** @var array The list of combined filter types */
protected $filtertypes = null;
@ -90,6 +90,9 @@ abstract class filterset implements JsonSerializable {
* @return int
*/
public function get_join_type(): int {
if ($this->jointype === null) {
$this->jointype = self::JOINTYPE_DEFAULT;
}
return $this->jointype;
}

View File

@ -7,6 +7,8 @@ information provided here is intended especially for developers.
* Final deprecation i_dock_block() in behat_deprecated.php
* Final deprecation of get_courses_page. Function has been removed and core_course_category::get_courses() should be
used instead.
* \core_table\local\filter\filterset::JOINTYPE_DEFAULT is being changed from 1 (ANY) to 2 (ALL). Filterset implementations
can override the default filterset join type by overriding \core_table\local\filter\filterset::get_join_type() instead.
=== 3.10 ===
* PHPUnit has been upgraded to 8.5. That comes with a few changes: