How to make deprecation notices throw ErrorException? #61742
Unanswered
rickyheijnen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a CI/CD pipeline where I want to catch deprecation notices and fail the build before deploying to production. However, I've discovered that Symfony's
ErrorHandler
explicitly excludesE_DEPRECATED
andE_USER_DEPRECATED
from being thrown as exceptions.In
/symfony/error-handler/ErrorHandler.php
, thethrowAt()
method has this logic:The
& ~\E_USER_DEPRECATED & ~\E_DEPRECATED
part explicitly prevents deprecations from being thrown as exceptions.My use case:
Questions:
Is there a recommended way to make deprecations throw exceptions in specific environments (like
build
ortest
)? Or are there alternative approaches I should consider for CI/CD deprecation detection?I understand that deprecations are typically meant to be warnings rather than fatal errors in normal operation, but for CI/CD purposes, having them fail builds would be extremely valuable for maintaining code quality.
Thanks for any guidance!
Beta Was this translation helpful? Give feedback.
All reactions