-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
Handle composed monolog-bridge activation strategy #336
Conversation
3a07f6b
to
7d1983e
Compare
4bab351
to
9187278
Compare
5d7d11c
to
7660e8c
Compare
Travis builds are failing under the new version of xdebug, you can fix that with setting XDEBUG_MODE to "coverage" in the config. See https://travis-ci.community/t/xdebug-3-is-installed-by-default-breaking-builds/10748 |
@nico-incubiq Thanks I added a commit |
@pvgnd any chance you could fix the PR to pass all tests? |
Of course, I will try to take some time to fix tests by the end of the
week.
Le mer. 30 déc. 2020 à 15:04, jokaorgua <[email protected]> a écrit :
… @pvgnd <https://github.com/pvgnd> any chance you could fix the PR to pass
all tests?
I think your fix is very important because this will fix a lot of
deprecated warnings for all users who uses fingers_crossed in symfony 5.2
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#336 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHSZYD22OXHGQCH7V7CDXTSXMXORANCNFSM4KWCPP5A>
.
|
d962597
to
a928f4e
Compare
a928f4e
to
bbf53e9
Compare
bbf53e9
to
86646d5
Compare
@nicolas-grekas done, branch rebased |
if (!class_exists(HttpCodeActivationStrategy::class)) { | ||
$this->markTestSkipped('Symfony Monolog 4.1+ is needed.'); | ||
} | ||
if (!\class_exists(SwitchUserTokenProcessor::class)) { | ||
$this->markTestSkipped('Symfony Monolog 5.2+ is needed.'); | ||
} |
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.
Not sure why fabbot.io is not running, but either we use class_exists with or without a leading backslash 🧐 can you please check or reopen the PR to trigger fabbot again?
I am currently on a phone 📱
Thanks
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.
Reopening does not trigger fabbot, apparently.
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.
generally, it will work in both cases, but \class_exists()
will be slightly faster, as parser will not check current namespace for such function and will check global namespace right away.
but in terms of code style consistency, IMO there shouldn't be such mix of usage. Either with backslashes, either without ;)
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 think the implementation could be simplified a lot (cf my comment)
$activationDef = new Definition('Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy', [ | ||
new Reference('request_stack'), | ||
$handler['excluded_404s'], | ||
$handler['action_level'] | ||
]); | ||
if ($isLegacyBridge) { | ||
$activationDef = new Definition('Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy', [ | ||
new Reference('request_stack'), | ||
$handler['excluded_404s'], | ||
$handler['action_level'] | ||
]); | ||
} else { | ||
$activationDef = new Definition('Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy', [ | ||
new Reference('request_stack'), | ||
$handler['excluded_404s'], | ||
new Definition('Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy', [ | ||
$handler['action_level'] | ||
]) | ||
]); | ||
} |
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.
IMHO all this can be simplified to
+ $activation = $handler['action_level'];
+ if (class_exists(SwitchUserTokenProcessor::class)) {
+ $action = new Definition(ErrorLevelActivationStrategy::class, [
+ $activation
+ ])
+ }
// ...
if (...) {
$activationDef = new Definition('Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy', [
new Reference('request_stack'),
$handler['excluded_404s'],
- $handler['action_level']
+ $activation
]);
$activation = new Reference($handlerId.'.not_found_strategy');
} elseif (...) {
$activationDef = new Definition('Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy', [
new Reference('request_stack'),
$handler['excluded_http_codes'],
- $handler['action_level']
+ $activation
]);
$activation = new Reference($handlerId.'.http_code_strategy');
- } else {
- $activation = $handler['action_level'];
}
{ | ||
if (\class_exists(SwitchUserTokenProcessor::class)) { |
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.
if (\class_exists(SwitchUserTokenProcessor::class)) { | |
if (class_exists(SwitchUserTokenProcessor::class)) { |
same everywhere
Is fabbot enabled on this project? |
Indeed, it seems like it's not enabled, regarding others PR for this project. |
@pvgnd maybe you could help a bit to move this further ? |
Ping @stof 🙏 |
closed in favor of #388 |
Related to symfony/symfony#35740
This PR instantiate the new HttpCodeActivationStrategy & NotFoundActivationStrategy with an inner strategy instead of an actionLevel
closes #369