Skip to content

Commit

Permalink
Closures made static, comment added
Browse files Browse the repository at this point in the history
  • Loading branch information
luzrain committed Feb 28, 2024
1 parent cbf8efd commit 258ffd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Attribute/OnEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
public string $event;
public int $priority;

/**
* @param class-string<Event> $event
*/
public function __construct(string $event, int $priority = 0)
{
$this->event = $event;
Expand Down
4 changes: 2 additions & 2 deletions src/config/compilerpass.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public function process(ContainerBuilder $container): void
}

// Commands have the highest priority by default
\usort($controllersMap, fn(array $a, array $b) => \str_starts_with($a['value'], '/') ? -1 : 1);
\usort($controllersMap, static fn(array $a, array $b) => \str_starts_with($a['value'], '/') ? -1 : 1);

// Sort by priority
\usort($controllersMap, fn(array $a, array $b) => $b['priority'] <=> $a['priority']);
\usort($controllersMap, static fn(array $a, array $b) => $b['priority'] <=> $a['priority']);

foreach ($controllersMap as $id => $row) {
unset($controllersMap[$id]['priority']);
Expand Down

0 comments on commit 258ffd4

Please sign in to comment.