-
-
Notifications
You must be signed in to change notification settings - Fork 461
ref: replace symfony options resolver with custom resolver #1914
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
base: 5.x
Are you sure you want to change the base?
Conversation
if (!$isValid) { | ||
// Since defaults are used as fallback values if passed options are invalid, we want to | ||
// get hard errors here to make sure we have something to fall back to. | ||
throw new \InvalidArgumentException(\sprintf('Invalid default for option "%s"', $option)); |
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 added the throw here to make it easier for us to debug and to make sure we have proper defaults that adhere to the specified rules.
As per comment, we also need some defaults to fall back to so I think it makes sense to keep this, but I'm open for discussions
# Conflicts: # src/Event.php # src/EventHint.php # src/Integration/IntegrationRegistry.php # src/Options.php # src/Stacktrace.php # src/State/Scope.php # src/UserDataBag.php
$logger = $options['logger'] ?? $this->getLoggerOrNullLogger(); | ||
|
||
return $this->resolver->resolve($options, $logger); | ||
} |
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.
Bug: Logger Initialization Issue
When resolveWithLogger
is called from the constructor, it attempts to retrieve a logger. If no logger is explicitly provided in the constructor options, the fallback path accesses $this->options['logger']
before $this->options
has been initialized, causing a fatal error.
Description
This PR replaces
symfony/options-resolver
with a custom option resolver that acts almost as a drop in replacement, but comes with a reduced feature set.Notable changes between symfony and our resolver:
I also had to replace usages of PHP 8+ features since they used a polyfill which was pulled in through the
symfony/options-resolver
.Issues
resolves #1896
closes PHP-24