Skip to content

Commit d7d02f9

Browse files
committed
Final deprecation policy update to keep method signature
1 parent 8b6b54c commit d7d02f9

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

  • general/development/policies/deprecation

general/development/policies/deprecation/index.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ debugging('foobar() is deprecated. Please use foobar::blah() instead.', DEBUG_DE
6363
<TabItem value="core_deprecation" label="Using the \core\deprecation API from Moodle 4.4">
6464

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

@@ -135,16 +137,18 @@ throw new coding_exception(
135137

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

143146
</TabItem>
144147

145148
</Tabs>
146149

147-
- All function parameters should be removed.
150+
- Keep the existing parameters and return type for both functions and methods.
151+
- The deprecation 'since' tag should remain as the version where the initial deprecation happened.
148152
- Deprecated classes must be completely removed.
149153
- 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.
150154
- External functions deprecation process is different from the standard deprecation and functions should be completely removed.

0 commit comments

Comments
 (0)