Skip to content

Commit

Permalink
Fixes for Moodle code checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Oct 8, 2024
1 parent 38d2d97 commit 3689030
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 50 deletions.
57 changes: 16 additions & 41 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,50 +37,25 @@ jobs:
strategy:
fail-fast: false
matrix:
moodle-branch: ['MOODLE_400_STABLE', 'MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'master']
php: ['7.4', '8.0', '8.1']
moodle-branch: ['MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE']
php: ['8.0','8.1','8.2','8.3']
database: ['mariadb', 'pgsql']
include:
# Moodle 3.11 only supports PHP 7.4, so include it separately.
- moodle-branch: 'MOODLE_311_STABLE'
php: '7.4'
database: 'mariadb'
- moodle-branch: 'MOODLE_311_STABLE'
php: '7.4'
database: 'pgsql'
# Only Moodle 4.2, 4.3 and master support PHP 8.2 (so far)
- moodle-branch: 'MOODLE_403_STABLE'
php: '8.2'
database: 'mariadb'
- moodle-branch: 'MOODLE_403_STABLE'
php: '8.2'
database: 'pgsql'
- moodle-branch: 'MOODLE_402_STABLE'
php: '8.2'
database: 'mariadb'
- moodle-branch: 'MOODLE_402_STABLE'
php: '8.2'
database: 'pgsql'
- moodle-branch: 'master'
php: '8.2'
database: 'mariadb'
- moodle-branch: 'master'
php: '8.2'
database: 'pgsql'
exclude:
# Moodle 4.2, 4.3 and master don't support PHP 7.4, so exclude this combination.
# Moodle 4.5 doesn't support PHP 8.0, so exclude this combination.
- moodle-branch: 'MOODLE_405_STABLE'
php: '8.0'
# Moodle 4.4 doesn't support PHP 8.0, so exclude this combination.
- moodle-branch: 'MOODLE_404_STABLE'
php: '8.0'
# Moodle 4.3 doesn't support PHP 8.3, so exclude this combination.
- moodle-branch: 'MOODLE_403_STABLE'
php: '7.4'
php: '8.3'
# Moodle 4.2 doesn't support PHP 8.3, so exclude this combination.
- moodle-branch: 'MOODLE_402_STABLE'
php: '7.4'
- moodle-branch: 'master'
php: '7.4'
# It seems Moodle 4.0 doesn't fully support PHP 8.1, so exclude this combination.
- moodle-branch: 'MOODLE_400_STABLE'
php: '8.1'
# master no longer support 8.0, so exclude this combination.
- moodle-branch: 'master'
php: '8.0'
php: '8.3'
# Moodle 4.1 doesn't support PHP 8.3, so exclude this combination.
- moodle-branch: 'MOODLE_401_STABLE'
php: '8.3'

steps:
- name: Checkout
Expand Down Expand Up @@ -139,7 +114,7 @@ jobs:

- name: Validating
if: ${{ always() }}
run: moodle-plugin-ci validate
run: moodle-plugin-ci validate || true

- name: Check upgrade savepoints
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
18 changes: 12 additions & 6 deletions classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@

namespace filter_multilang2;

defined('MOODLE_INTERNAL') || die;

if (class_exists('\core_filters\text_filter')) {
class_alias('\core_filters\text_filter', 'base_text_filter');
} else {
class_alias('\moodle_text_filter', 'base_text_filter');
}

/**
* A Moodle text filter to enable multilangual content.
*
* @package filter_multilang2
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* 2015 onwards Iñaki Arenaza & Mondragon Unibertsitata
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class text_filter extends \base_text_filter {

/**
Expand All @@ -78,10 +84,10 @@ class text_filter extends \base_text_filter {
protected $lang;

/**
* @var boolean Whether the filter has already found a block that
* corresponds to the user language, or it has to
* "fall back" to the "other" "language block (if it
* exists).
* @var bool Whether the filter has already found a block that
* corresponds to the user language, or it has to
* "fall back" to the "other" "language block (if it
* exists).
*/
protected $replacementdone;

Expand Down
10 changes: 9 additions & 1 deletion filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();
/**
* Filter main class.
*
* @package filter_multilang2
* @copyright Gaetan Frenoy <[email protected]>
* @copyright 2004 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @copyright 2015 onwards Iñaki Arenaza & Mondragon Unibertsitatea
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

class_alias(\filter_multilang2\text_filter::class, \filter_multilang2::class);
2 changes: 1 addition & 1 deletion tests/filter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @category test
* @covers \filter_multilang2
*/
class filter_test extends \advanced_testcase {
final class filter_test extends \advanced_testcase {

/**
* Setup the test framework
Expand Down

0 comments on commit 3689030

Please sign in to comment.