I have a few plugins in the plugins database, and few outside of it. Every now and then a Moodle API change breaks one of my plugins. Well if we didn't have API changes there wouldn't be much to Moodle with. So I grumble a bit, sometimes a lot, and then just get on with it.
In one of these breakages last year a function declaration in the plugin parent class (the repository), that I need to override, changed to static,
ie the function in v2.2 was:
public function instance_config_form($mform) {
But in 2.3 that became:
public static function instance_config_form($mform) {
So my plugin now has a 2.2 and a 2.3+ version because I don't know any way of dealing with that in PHP
Now I just found that another of my plugins, has a similar issue, though I think it just throws strict warnings. The function get_files in /mod/assign/assignmentplugin has gone from:
public function get_files(stdClass $submission) {
to
public function get_files(stdClass $submissionorgrade, stdClass$user){
Now this has happened sometime between 2.4 being released and now. So I can't just do a simple "is it version 2.3 or 2.4" check.
Can anyone offer a clever way of handling either of these situations within my code, so I don't need to manage 2 versions of the plugin that differ only in a single line.
Thanks