Ignore suppressed E_USER_*
errors again
#5326
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Basically, there are two ways to silence error levels:
error levels which should be silenced/not displayed
@
to enforce silencingthe error level, unrelated to the set error reporting
level
For example, it's possible that
E_ALL
has been setas global error_level() and therefore triggering a
user deprecation/warning/error using the
trigger_error
method will be displayed. If the
@
silence operatoris used before the
trigger_error()
call, the erroris silenced.
However, registered error handler will be called for all
errors, despite it has been silenced or not for both possible
ways to silence a error levels. ErrorHandler check the
passed
$errorNumber
against the result of error_reporting()to determine if the errorNumber/errorLevel is supressed or
not. That check will also detect a errorNumber as beeing
silenced if the
@
silence operator has been used, whichcould and should be taken as a intentional and enforced
silencing of an error (knowing that it would fail).
There are multple use-cases, where for e.g. silenced user
deprecation should not be taken as such, displayed and fail.
MockBuilder converts
@deprecated
method docblock annotationsto silenced
@trigger_error('', E_USER_DEPRECATED)
calls.Having a
@deprecated
annonation does not mean, that theoriginal method call would trigger an
E_USER_DEPRECATED
error - and it's arguable that it should be a hard enforcement
by PHPUnit to decide this and doing the conversion.
Therefore, this change removes the possible silenceable error
level list check from the
ErrorHander
. This restores how ithas worked in PHPUnit v9 without opening follow up issues.
This can be reintroduced, either in a configurable way or the
same if related questions has been properly thought about and
solved before:
removed
if silenced error levels should be stay silenced or not.
This means not only in one direction.
Related: #5325