-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add constants to BC promise #5672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,10 @@ Add type hint to an argument No | |
Remove type hint of an argument No | ||
Change argument type No | ||
Change return type No | ||
**Constants** | ||
Add constant Yes | ||
Remove constant No | ||
Change value of a constant Yes [1]_ [5]_ | ||
============================================== ============== | ||
|
||
Changing Classes | ||
|
@@ -253,6 +257,10 @@ Change return type Yes | |
**Static Methods** | ||
Turn non static into static No | ||
Turn static into non static No | ||
**Constants** | ||
Add constant Yes | ||
Remove constant No | ||
Change value of a constant Yes [1]_ [5]_ | ||
================================================== ============== | ||
|
||
.. [1] Should be avoided. When done, this change must be documented in the | ||
|
@@ -267,6 +275,13 @@ Turn static into non static No | |
.. [4] When changing the parent class, the original parent class must remain an | ||
ancestor of the class. | ||
|
||
.. [5] The value of a constant may only be changed when the constants aren't | ||
used in configuration (e.g. Yaml and XML files), as these do not support | ||
constants and have to hardcode the value. For instance, event name | ||
constants can't change the value without introducing a BC break. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or when the value can be used in serialize/unserialize There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That can apply to any constant, isn't it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think Nicolas' point is probably that if a value will likely be used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should simply add:
To your point Wouter, technically any constant could be used in a configuration file too - but there are a few that are very commonly used (i.e. it's a "main supported use-case") - and it's those that we should avoid). |
||
Additionally, if a constant will likely be used in objects that are | ||
serialized, the value of a constant should not be changed. | ||
|
||
.. _Semantic Versioning: http://semver.org/ | ||
.. _scalar type: http://php.net/manual/en/function.is-scalar.php | ||
.. _boolean values: http://php.net/manual/en/function.boolval.php | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yaml should be removed until symfony/symfony#18626 is merged in 3.2