Skip to content

Conversation

@gmazzap
Copy link
Contributor

@gmazzap gmazzap commented Jun 10, 2025

When introducing the support for Monolog v3 (alongside v2), we added a Levels class, which was a duplicate of a Monolog v2 class removed in Monolog v3.

Adding that class made it easy to refer to the same class regardless of having Monolog v2 or v3 as a dependency.

However, the Levels class was a 100% duplication of the code we already have in the LogLevel class, which has existed since Wonollog v1. This is why this PR removes that duplicate class and always uses the LogLevel class.

This has teh additional side-effect of being able to remove asll the PHPStan "ingnore deprecated" comments that we needed to have because the constant is deprecated in Monolog v3.

Note: In Monolog v3, the Levels class is removed and its functionality is replaced by a Level enum. Our LogLevel class (abstract with final methods, and not instantiable) can't be replaced with an enum because it has some logic that requires supporting static state, but enums don't support properties.

@gmazzap gmazzap merged commit 0fdc06d into 3.x Jun 10, 2025
66 checks passed
@gmazzap gmazzap deleted the remove-duplicate-levels branch June 10, 2025 14:23
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.

1 participant