Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into refactor-summary
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Debugger.php
  • Loading branch information
vjik committed Feb 3, 2025
2 parents c8185a6 + eb01a60 commit f51b5d2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/di-console.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@
),
'excludedClasses' => $params['yiisoft/yii-debug']['excludedClasses'],
],
'reset' => function () {
/** @var Debugger $this */
$this->allowStart = true;
},
],
];
4 changes: 4 additions & 0 deletions config/di-web.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@
),
'excludedClasses' => $params['yiisoft/yii-debug']['excludedClasses'],
],
'reset' => function () {
/** @var Debugger $this */
$this->allowStart = true;
},
],
];
18 changes: 16 additions & 2 deletions src/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ final class Debugger
private readonly DataNormalizer $dataNormalizer;

/**
* @var string|null ID of the current request. `null` if debugger is not active.
* @psalm-var non-empty-string|null
* @var non-empty-string|null ID of the current request. `null` if debugger is not active.
*/
private ?string $id = null;

/**
* @var bool Whether debugger startup is allowed.
*/
private bool $allowStart = true;

/**
* @param StorageInterface $storage The storage to store collected data.
* @param CollectorInterface[] $collectors Collectors to be used.
Expand Down Expand Up @@ -100,7 +104,17 @@ public function getId(): string
*/
public function start(object $event): void
{
if (!$this->allowStart) {
return;
}

if (!$this->debuggerStartupPolicy->satisfies($event)) {
$this->allowStart = false;
$this->kill();
return;
}

if ($this->isActive()) {
return;
}

Expand Down

0 comments on commit f51b5d2

Please sign in to comment.