mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 16:15:49 +03:00
[GH-ISSUE #1640] PHPstan support for "formatted" value of record #697
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#697
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sonklein on GitHub (Mar 4, 2022).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1640
Hello,
I'm currently trying to test my logs using the Monolog TestHandler (through symfony)
I wanted to see if my logs were correctly formatted as we use our own Formatter. When I dump my logs the record contains the "formatted" key and I can actually test it's value, it works fine.
My issue is when I try to pass PHPStan on it :
98 Call to static method PHPUnit\Framework\Assert::assertArrayHasKey() with 'formatted' and array('message' => string, 'context' => array, 'level' => 100|200|250|300|400|500|550|600, 'level_name' => 'ALERT'|'CRITICAL'|'DEBUG'|'EMERGENCY'|'ERROR'|'INFO'|'NOTICE'|'WARNING', 'channel' => string, 'datetime' => DateTimeImmutable, 'extra' => array) will always evaluate to false.From my understanding, it misses something in TestCase.php :
Or is there any other way to get the formatted output ?
In the meantime I added a /* @phpstan-ignore-line */ next to my test
@Seldaek commented on GitHub (Mar 13, 2022):
This should hopefully become easier with Monolog 3.0 as the record is now an object, see https://github.com/Seldaek/monolog/pull/1635 for the WIP.