Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/State/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,16 @@ public static function addGlobalEventProcessor(callable $eventProcessor): void
self::$globalEventProcessors[] = $eventProcessor;
}

/**
* Gets the list of global event processors that are applied in {@see Scope::applyToEvent}.
*
* @return callable[]
*/
public static function getGlobalEventProcessors(): array
{
return self::$globalEventProcessors;
}

/**
Comment on lines +369 to 372
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new public method getGlobalEventProcessors() lacks test coverage. Since this codebase has comprehensive test coverage for the Scope class (as seen in tests/State/ScopeTest.php), this new public API should include tests to verify it returns the correct array of global event processors, especially after calling addGlobalEventProcessor().

Copilot uses AI. Check for mistakes.
* Clears the scope and resets any data it contains.
*
Expand Down Expand Up @@ -464,7 +474,7 @@ public function applyToEvent(Event $event, ?EventHint $hint = null, ?Options $op
$hint = new EventHint();
}

foreach (array_merge(self::$globalEventProcessors, $this->eventProcessors) as $processor) {
foreach (array_merge(self::getGlobalEventProcessors(), $this->eventProcessors) as $processor) {
$event = $processor($event, $hint);

if ($event === null) {
Expand Down