Skip to content

Commit f91e948

Browse files
committed
fix(event): skip InstrumentationGuard trace frames on Windows by joining the skip path with DIRECTORY_SEPARATOR.
1 parent 85bd52f commit f91e948

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## 0.1.1 Under development
99

10+
- fix(event): skip `InstrumentationGuard` trace frames on Windows by joining the skip path with `DIRECTORY_SEPARATOR`.
11+
1012
## 0.1.0 October 16, 2026
1113

1214
- feat: initial development release.

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"mutation-static": [
7474
"Composer\\Config::disableProcessTimeout",
7575
"./vendor/bin/phpstan clear-result-cache",
76-
"php -d memory_limit=-1 vendor/bin/infection --threads=4 --ignore-msi-with-no-mutations --min-msi=100 --min-covered-msi=100 --static-analysis-tool=phpstan --static-analysis-tool-options='--memory-limit=-1'"
76+
"php -d memory_limit=-1 vendor/bin/infection --initial-tests-php-options='-d memory_limit=-1' --test-framework-extra-args='-d memory_limit=-1' --threads=4 --ignore-msi-with-no-mutations --min-msi=100 --min-covered-msi=100 --static-analysis-tool=phpstan --static-analysis-tool-options='--memory-limit=-1'"
7777
],
7878
"rector": "./vendor/bin/rector process",
7979
"static": "./vendor/bin/phpstan --memory-limit=-1",

‎src/Panel/Event/EventCapture.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public static function trace(array $frames, int $limit, array $skipFiles = []):
5858
$result = [];
5959
$skipFiles[] = __FILE__;
6060

61-
$skipFiles[] = dirname(__DIR__, 2) . '/Instrumentation/InstrumentationGuard.php';
61+
$skipFiles[] = dirname(__DIR__, 2)
62+
. DIRECTORY_SEPARATOR . 'Instrumentation'
63+
. DIRECTORY_SEPARATOR . 'InstrumentationGuard.php';
6264

6365
foreach ($frames as $frame) {
6466
if (count($result) >= min(16, $limit)) {

‎tests/Panel/Event/EventInspectionTest.php‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
namespace PHPForge\Debug\Tests\Panel\Event;
66

77
use Closure;
8+
use PHPForge\Debug\Instrumentation\InstrumentationGuard;
89
use PHPForge\Debug\Panel\Event\{EventCapture, EventInspection, EventInspectorRenderer, EventRow, EventSequence, EventSnapshot};
910
use PHPForge\Debug\Storage\HydrationException;
1011
use PHPForge\Debug\Tests\Provider\EventInspectionProvider;
1112
use PHPUnit\Framework\Attributes\{DataProviderExternal, Group};
1213
use PHPUnit\Framework\TestCase;
14+
use ReflectionClass;
1315

1416
use function array_replace;
1517
use function strlen;
@@ -614,6 +616,26 @@ public function testTraceNeverRetainsArgumentsOrObjects(): void
614616
);
615617
}
616618

619+
public function testTraceSkipsInstrumentationGuardFramesWithNativeSeparators(): void
620+
{
621+
$frames = [
622+
[
623+
'file' => (string) (new ReflectionClass(InstrumentationGuard::class))->getFileName(),
624+
'line' => 36,
625+
],
626+
[
627+
'file' => '/app/event.php',
628+
'line' => 42,
629+
],
630+
];
631+
632+
self::assertSame(
633+
['/app/event.php:42'],
634+
EventCapture::trace($frames, 16),
635+
'Instrumentation guard frames must be skipped on every platform.',
636+
);
637+
}
638+
617639
private static function row(float $time): EventRow
618640
{
619641
return new EventRow($time, 'render', 'ViewEvent', '0', 'View');

0 commit comments

Comments
 (0)