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
Allow options to be marked as deprecated #27
Comments
I tried to implement it. I prefer to not use a custom error handler to detect warnings here, so I added Processor::getWarnings(). $processor = new Processor;
$schema = Expect::structure([
'old' => Expect::int()->deprecated('The option %path% is deprecated'),
]);
$processor->process($schema, ['old' => 1]);
var_dump($processor->getWarnings()); // ["The option 'old' is deprecated"] Theoretically, this creates room for other possible warnings, not only for deprecation notes. |
dg
added a commit
that referenced
this issue
Oct 14, 2020
dg
added a commit
that referenced
this issue
Oct 14, 2020
That implementation works for me. Thanks so much! |
dg
added a commit
that referenced
this issue
Oct 15, 2020
dg
added a commit
that referenced
this issue
Oct 15, 2020
dg
added a commit
that referenced
this issue
Oct 15, 2020
dg
added a commit
that referenced
this issue
Oct 15, 2020
dg
added a commit
that referenced
this issue
Oct 29, 2020
dg
added a commit
that referenced
this issue
Oct 29, 2020
dg
added a commit
that referenced
this issue
Oct 29, 2020
dg
added a commit
that referenced
this issue
Oct 29, 2020
dg
added a commit
that referenced
this issue
Oct 30, 2020
dg
added a commit
that referenced
this issue
Oct 30, 2020
dg
added a commit
that referenced
this issue
Nov 2, 2020
dg
added a commit
that referenced
this issue
Nov 4, 2020
dg
added a commit
that referenced
this issue
Nov 6, 2020
dg
added a commit
that referenced
this issue
Nov 25, 2020
dg
added a commit
that referenced
this issue
Nov 25, 2020
dg
added a commit
that referenced
this issue
Nov 25, 2020
dg
added a commit
that referenced
this issue
Nov 25, 2020
dg
added a commit
that referenced
this issue
Nov 25, 2020
dg
added a commit
that referenced
this issue
Dec 8, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 15, 2020
dg
added a commit
that referenced
this issue
Dec 16, 2020
dg
added a commit
that referenced
this issue
Dec 17, 2020
dg
added a commit
that referenced
this issue
Dec 17, 2020
dg
added a commit
that referenced
this issue
Dec 18, 2020
dg
added a commit
that referenced
this issue
Dec 20, 2020
dg
added a commit
that referenced
this issue
Dec 20, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
I would like the ability to mark certain options as being 'deprecated'. These are elements that are still currently allowed but may be removed in future versions. Using a deprecated option should cause a silenced
E_USER_DEPRECATED
error to triggered when used.Proposed implementation
Add a new method called
deprecated()
to theBase
trait - something like this:Users can then flag options as deprecated like so:
At some point during the
complete()
method call we'd raise a silenced deprecation error if any value was provided:Why a silenced error?
The
@trigger_error('...', E_USER_DEPRECATED)
pattern is borrowed from Symfony and other projects:See https://symfony.com/doc/4.4/contributing/code/conventions.html#deprecating-code for more details.
Outstanding questions
Context
too if that's desired?Am I willing to implement this?
Yes - but I could use a little guidance on the best place to put the deprecation check and how to properly determine if a value is given or omitted.
The text was updated successfully, but these errors were encountered: