Skip to content
Open
Changes from 2 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
10 changes: 9 additions & 1 deletion src/State/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@
self::$globalEventProcessors[] = $eventProcessor;
}

/**
* Get the global event processors {@see Scope::applyToEvent}.
*/
public static function getGlobalEventProcessors(): array

Check failure on line 365 in src/State/Scope.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method Sentry\State\Scope::getGlobalEventProcessors() return type has no value type specified in iterable type array.
{
return self::$globalEventProcessors;
}

/**
Comment on lines 362 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 return type annotation is incomplete. The method should include a psalm-var annotation to match the type annotation on the property definition (lines 91-93). This is important for static analysis tools to understand that the returned array contains callables with a specific signature.

Consider adding the psalm annotation:
@psalm-return array<callable(Event, EventHint): ?Event>

Copilot uses AI. Check for mistakes.
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 +472,7 @@
$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
Loading