[GH-ISSUE #1951] Rename TestCase class to prevent import conflicts with PHPUnit's TestCase #842

Closed
opened 2026-03-04 03:01:19 +03:00 by kerem · 4 comments
Owner

Originally created by @staabm on GitHub (Mar 6, 2025).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1951

Monolog version 3

Write your question here.

today I was stumbling over a problem of wrongly used TestCase class because autocompletion liked monologs class more then the phpunit one.

this remindet me of a similar issue we had in the past with PHPStan: https://github.com/phpstan/phpstan-src/pull/634

do you think monolog could make a similar move and deprecate+rename the monologs' TestCase class so autocompletion in popular IDEs won't accidentally add monologs TestCase class instead of e.g. PHPunits class?

I think most arguments why this is a good idea and actually the root cause is a phpstorm bug was already discussed in the linked PHPStan issue. I think a lot of people would have less problems when this class would be renamed, even though its totally fine because its in a dedicated namespace.

Originally created by @staabm on GitHub (Mar 6, 2025). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1951 Monolog version 3 Write your question here. today I was stumbling over a problem of wrongly used `TestCase` class because autocompletion liked monologs class more then the phpunit one. this remindet me of a similar issue we had in the past with PHPStan: https://github.com/phpstan/phpstan-src/pull/634 do you think monolog could make a similar move and deprecate+rename the monologs' TestCase class so autocompletion in popular IDEs won't accidentally add monologs TestCase class instead of e.g. PHPunits class? I think most arguments why this is a good idea and actually the root cause is a phpstorm bug was already discussed in the linked PHPStan issue. I think a lot of people would have less problems when this class would be renamed, even though its totally fine because its in a dedicated namespace.
kerem 2026-03-04 03:01:19 +03:00
  • closed this issue
  • added the
    Support
    label
Author
Owner

@staabm commented on GitHub (Mar 6, 2025):

just found a duplicate which already got closed: https://github.com/Seldaek/monolog/issues/1677

<!-- gh-comment-id:2704380281 --> @staabm commented on GitHub (Mar 6, 2025): just found a duplicate which already got closed: https://github.com/Seldaek/monolog/issues/1677
Author
Owner

@Seldaek commented on GitHub (Mar 15, 2025):

Is the @internal workaround not working anymore?

<!-- gh-comment-id:2726540617 --> @Seldaek commented on GitHub (Mar 15, 2025): Is the `@internal` workaround not working anymore?
Author
Owner

@Seldaek commented on GitHub (Mar 15, 2025):

I mean renaming to MonologTestCase or something would be fine I think, with the deprecated/alias one extending from it and having the @internal tag. Do you want to PR this?

<!-- gh-comment-id:2726542667 --> @Seldaek commented on GitHub (Mar 15, 2025): I mean renaming to MonologTestCase or something would be fine I think, with the deprecated/alias one extending from it and having the `@internal` tag. Do you want to PR this?
Author
Owner

@staabm commented on GitHub (Mar 15, 2025):

Sure

<!-- gh-comment-id:2726554183 --> @staabm commented on GitHub (Mar 15, 2025): Sure
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#842
No description provided.