-
Notifications
You must be signed in to change notification settings - Fork 730
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
Review deprecations triggering #1823
Conversation
src/Query/Match.php
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
namespace Elastica\Query; | |||
|
|||
\trigger_error('Elastica\Query\Match is deprecated. Use Elastica\Query\MatchQuery instead. From PHP 8 match is reserved word and this class will be removed in further Elastica releases', \E_USER_DEPRECATED); | |||
trigger_deprecation('ruflin/elastica', '7.0.1', 'The "%s" class is deprecated, use "%s" instead. "match" is a reserved keyword starting from PHP 8.0. It will be removed in 8.0.', Match::class, MatchQuery::class); |
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.
Maybe 7.1.0
instead? I don't know which next version you have in mind @ruflin
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.
Lets put 7.1.0 for now.
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.
Perfect, I'm updating it and previously merged deprecations
fd4a6c6
to
3adef71
Compare
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.
I'm undecided if we should just go with silencing with @
or add the dependency. I'm always a bit torn on adding more dependencies at the same time it is nice to unify.
src/Query/Match.php
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
namespace Elastica\Query; | |||
|
|||
\trigger_error('Elastica\Query\Match is deprecated. Use Elastica\Query\MatchQuery instead. From PHP 8 match is reserved word and this class will be removed in further Elastica releases', \E_USER_DEPRECATED); | |||
trigger_deprecation('ruflin/elastica', '7.0.1', 'The "%s" class is deprecated, use "%s" instead. "match" is a reserved keyword starting from PHP 8.0. It will be removed in 8.0.', Match::class, MatchQuery::class); |
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.
Lets put 7.1.0 for now.
Yes I added silencing with |
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.
Thanks, I fully support this change!
Silencing the deprecations is a must because this is what makes them opt-in:
- without the silencing operator, ppl MUST configure their prod to ignore the deprecations: that means ppl are forced to opt-out;
- with silencing, deprecations are silent, unless one decides to use a tool that gathers them and reports them appropriately (such as Symfony's): this is opt-in.
About symfony/deprecation-contracts
, it's been designed to help the community standardize on a very simple and generic signature and implementation. I wish all PHP projects would adopt it. That would help build better tools to display nice deprecation reports.
👍 on my side!
aa04173
to
2ec4657
Compare
See elastic/elasticsearch-php#973 for details about why unsilenced deprecations can cause issues.
Symfony link related in the elasticsearch issue is outdated as it points to current version which use
trigger_deprecation
, see this link instead.Here what is stated in the symfony documentation:
I added
symfony/deprecation-contracts
to better handle deprecations (they take care of silencing the deprecations).