Skip to content

Commit

Permalink
MDL-80677 core: deprecation::from should always return
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Mar 11, 2024
1 parent 57ec38d commit f09d886
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/classes/deprecation.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public static function from(array|string|object $reference): ?deprecated {
// The reference is an array, but it's not an object or a class that currently exists.
return null;
}

// The reference is none of the above.
return null;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/tests/deprecation_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ public static function from_provider(): array {
// Deprecated global function.
['core\fixtures\deprecated_function', true],
['core\fixtures\not_deprecated_function', false],

// Empty array.
[[], false],
];
}

Expand Down

0 comments on commit f09d886

Please sign in to comment.