Skip to content

Adapt signature of frontend methods.#11

Open
srobotta wants to merge 1 commit intotimhunt:mainfrom
srobotta:changed-frontend-signature
Open

Adapt signature of frontend methods.#11
srobotta wants to merge 1 commit intotimhunt:mainfrom
srobotta:changed-frontend-signature

Conversation

@srobotta
Copy link

@srobotta srobotta commented Feb 9, 2026

Hi @timhunt

During a run of behat tests I discovered that the signatore of two frontend methods have been changed. This causes a deprecation error:

019 Scenario: I can create a numerical question with an option to catch all student responses. # /selenium/moodle/public/mod/lesson/tests
/behat/all_other_answers_catch.feature:31
      And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1  # /srv/selenium.bfh.ch/moodle-5011/public/mod/lesson/tests
/behat/all_other_answers_catch.feature:25
        Exception: PHP errors found:
        Unknown error type: availability_quizquestion\frontend::allow_add(): Implicitly marking parameter $section as nullable is deprecated, the explici
t nullable type must be used instead at /selenium/moodle/public/availability/condition/quizquestion/classes/frontend.php: 77 in /selenium/moodle/public/lib/behat/classes/behat_session_trait.php:948
        Stack trace:
        #0 /selenium.bfh.ch/moodle-5011/public/lib/behat/classes/behat_session_trait.php(1158): behat_base->look_for_exceptions()
        #1 /selenium/moodle/public/auth/tests/behat/behat_auth.php(64): behat_base->execute()
        #2 /selenium/moodle/public/lib/behat/classes/behat_session_trait.php(1149): behat_auth->i_log_in_as()
        #3 /selenium/moodle/public/lib/tests/behat/behat_navigation.php(685): behat_base->execute()
        #4 /selenium/moodle/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(110): behat_navigation->i_am_on_page_instance_logged_in_as()
...

The PR changes the signature of the two methods:

availability_quizquestion\frontend::allow_add()
availability_quizquestion\frontend::get_javascript_init_params()

to be in accordance with the parent.

Best regards, Stephan

PS. Moodle used for testing is 5.1.2, installed question_availability plugin: 2022092000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant