Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions general/development/policies/deprecation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ debugging('foobar() is deprecated. Please use foobar::blah() instead.', DEBUG_DE
<TabItem value="core_deprecation" label="Using the \core\deprecation API from Moodle 4.4">

```php
#[\core\attribute\deprecated('foobar::blahv()', since: '4.4', mdl: 'MDL-XXXXX')]
public function foobar(): void {
#[\core\attribute\deprecated('foobar::blah()', since: '4.4', mdl: 'MDL-XXXXX')]
public function foobar(int $old, array $params): array {
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
// Call new method if possible or retain existing code.
return foobar::blah($old, $params);
}
```

Expand Down Expand Up @@ -135,16 +137,18 @@ throw new coding_exception(

```php
#[\core\attribute\deprecated('foobar::blah()', since: '4.4', mdl: 'MDL-XXXXX', final: true)]
public function foobar(): void {
public function foobar(int $old, array $params): array {
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
return [];
}
```

</TabItem>

</Tabs>

- All function parameters should be removed.
- Keep the existing parameters and return type for both functions and methods.
- The deprecation 'since' tag should remain as the version where the initial deprecation happened.
- Deprecated classes must be completely removed.
- The content of the PHPDoc should be removed, leaving only the `@deprecated` tag with the notice and, optionally, the replacement information. This includes all `@param`, `@return`, and other tags, as well as the description.
- External functions deprecation process is different from the standard deprecation and functions should be completely removed.
Expand Down