Skip to content

Fix typo, invalid definition and add missing condition to check - #514

Merged
GromNaN merged 1 commit into
symfony:masterfrom
HypeMC:minor-fixes
Sep 5, 2025
Merged

GromNaN merged 1 commit into
symfony:masterfrom
HypeMC:minor-fixes

Conversation

@HypeMC

@HypeMC HypeMC commented Aug 30, 2025

Copy link
Copy Markdown
Member

A few minor issues I noticed while working on some other PRs.

Comment on lines -758 to +762
$hub = new Definition(
$hubId = \sprintf('monolog.handler.%s.hub', $name);
$hub = $container->setDefinition($hubId, new Definition(
'Sentry\\State\\Hub',
[new Reference($clientId)]
);
$container->setDefinition(\sprintf('monolog.handler.%s.hub', $name), $hub);
));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never worked correctly. The monolog.handler.%s.hub service was registered but never actually used. Instead, the entire definition was passed as an argument, resulting in the creation of two separate services: the unused monolog.handler.%s.hub service and an anonymous service that was passed to the handler.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be covered by a test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GromNaN I've updated the existing tests.

Comment thread composer.json
Comment on lines -20 to +29
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"monolog/monolog": "^1.25.1 || ^2.0 || ^3.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
"monolog/monolog": "^1.25.1 || ^2.0 || ^3.0"
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^7.1"
"symfony/phpunit-bridge": "^7.1",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really an issue, but I figure it can't hurt to have the dependencies sorted.

->scalarNode('buffer_size')->defaultValue(0)->end() // fingers_crossed and buffer
->booleanNode('flush_on_overflow')->defaultFalse()->end() // buffer
->scalarNode('handler')->end() // fingers_crossed and buffer
->scalarNode('handler')->end() // fingers_crossed, buffer, filter, deduplication, sampling

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for a future improvement, the info() method can be used to make this details more accessible.

Comment thread DependencyInjection/Configuration.php Outdated
Comment on lines -758 to +762
$hub = new Definition(
$hubId = \sprintf('monolog.handler.%s.hub', $name);
$hub = $container->setDefinition($hubId, new Definition(
'Sentry\\State\\Hub',
[new Reference($clientId)]
);
$container->setDefinition(\sprintf('monolog.handler.%s.hub', $name), $hub);
));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be covered by a test?

@GromNaN

GromNaN commented Sep 5, 2025

Copy link
Copy Markdown
Member

Thank you @HypeMC.

@GromNaN
GromNaN merged commit 9913d9c into symfony:master Sep 5, 2025
19 checks passed
@HypeMC
HypeMC deleted the minor-fixes branch September 5, 2025 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants