Skip to content

Commit be83b6d

Browse files
committed
Add guidance on deprecations
1 parent f31ebf3 commit be83b6d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

contributing/internals.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ afraid to use it when it's needed and can help things.
4444
- Start simple, refactor as necessary to achieve clean separation of
4545
code, but don't overdo it.
4646

47+
## Deprecations
48+
49+
Deprecations happen when code no longer fits its purpose or is superseded by better solutions.
50+
In such cases, it's important that deprecations are documented clearly to guide developers during
51+
their upgrade process.
52+
53+
- Add `@deprecated` tags in the doc block of deprecated functions, methods, classes, etc. Include
54+
the version number where the deprecation was introduced, a description of why it's deprecated,
55+
and recommended replacement(s), if any. If there are multiple alternative approaches, list all of them.
56+
57+
- Do not add `@deprecated` tags to a function/method if you only mean to deprecate its parameter(s).
58+
This will cause the whole function/method to be marked as deprecated by IDEs. Instead, trigger
59+
a deprecation inside the function/method body if those parameters are passed. Ensure to include
60+
the version number since when the deprecation occurred. Optionally, but encouraged, add a `@todo`
61+
comment so that it can be found later on.
62+
63+
- User-facing deprecation warnings should also be triggered via the framework's deprecation handling
64+
mechanism (e.g., `@trigger_error()` or error log entries) to alert end users.
65+
66+
- Do not add new tests for deprecated code paths. Instead, use tools and static analysis to ensure
67+
that no code within the framework or official packages is using the deprecated functionality.
68+
69+
- Document all deprecations in the changelog file for that release, under a "Deprecations"
70+
section, so users are informed when upgrading.
71+
4772
## Testing
4873

4974
Any new packages submitted to the framework must be accompanied by unit

system/Language/en/Images.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
'invalidDirection' => 'Flip direction can be only "vertical" or "horizontal". Given: "{0}"',
3434
'exifNotSupported' => 'Reading EXIF data is not supported by this PHP installation.',
3535

36-
// @deprecated
36+
// @deprecated 4.7.0
3737
'libPathInvalid' => 'The path to your image library is not correct. Please set the correct path in your image preferences. "{0}"',
3838
];

0 commit comments

Comments
 (0)