Skip to content

Commit

Permalink
MDL-59562 core: updated type hint of new function
Browse files Browse the repository at this point in the history
  • Loading branch information
Peterburnett committed Jan 16, 2020
1 parent 4fac690 commit 72aac06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/classes/plugin_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,9 @@ protected function resolve_dependency_requirements(\core\plugininfo\base $plugin
*
* @param \core\plugininfo\base $plugin the plugin we are checking
* @param int $branch the moodle branch to check support for
* @return bool
* @return string
*/
public function check_explicitly_supported($plugin, $branch) : bool {
public function check_explicitly_supported($plugin, $branch) : string {
// Check for correctly formed supported.
if (isset($plugin->pluginsupported)) {
// Broken apart for readability.
Expand Down
4 changes: 2 additions & 2 deletions lib/classes/plugininfo/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ public function load_disk_version() {
if (is_array($plugin->supported) && $isint && $isrange) {
$this->pluginsupported = $plugin->supported;
} else {
throw new coding_exception('Incorrect syntax in $plugin->supported in '."$this->name");
throw new coding_exception('Incorrect syntax in plugin supported declaration in '."$this->name");
}
}

if (isset($plugin->incompatible) && $plugin->incompatible !== null) {
if ((ctype_digit($plugin->incompatible) || is_int($plugin->incompatible)) && (int) $plugin->incompatible > 0) {
$this->pluginincompatible = intval($plugin->incompatible);
} else {
throw new coding_exception('Incorrect syntax in $plugin->incompatible in '."$this->name");
throw new coding_exception('Incorrect syntax in plugin incompatible declaration in '."$this->name");
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/tests/plugininfo/base_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function test_load_disk_version_invalid_supported_version($supported, $in
$pluginman->add_fake_plugin_info($plugininfo);

$this->expectException(\coding_exception::class);
$this->expectExceptionMessage('Incorrect syntax in $plugin->supported in example');
$this->expectExceptionMessage('Incorrect syntax in plugin supported declaration in example');
$plugininfo->load_disk_version();
}

Expand Down Expand Up @@ -147,7 +147,7 @@ public function test_load_disk_version_invalid_incompatible_version($incompatibl
$pluginman->add_fake_plugin_info($plugininfo);

$this->expectException(\coding_exception::class);
$this->expectExceptionMessage('Incorrect syntax in $plugin->incompatible in example');
$this->expectExceptionMessage('Incorrect syntax in plugin incompatible declaration in example');
$plugininfo->load_disk_version();
}

Expand Down

0 comments on commit 72aac06

Please sign in to comment.