mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/16010] Enforce alphabetical order for events in events.md
PHPBB3-16010
This commit is contained in:
@@ -143,6 +143,8 @@ class md_exporter
|
||||
|
||||
list($event_name, $details) = explode("\n===\n", $event, 2);
|
||||
$this->validate_event_name($event_name);
|
||||
$sorted_events = [$this->current_event, $event_name];
|
||||
natsort($sorted_events);
|
||||
$this->current_event = $event_name;
|
||||
|
||||
if (isset($this->events[$this->current_event]))
|
||||
@@ -150,6 +152,12 @@ class md_exporter
|
||||
throw new \LogicException("The event '{$this->current_event}' is defined multiple times");
|
||||
}
|
||||
|
||||
// Use array_values() to get actual first element and check against natural order
|
||||
if (array_values($sorted_events)[0] === $event_name)
|
||||
{
|
||||
throw new \LogicException("The event '{$sorted_events[1]}' should be defined before '{$sorted_events[0]}'");
|
||||
}
|
||||
|
||||
if (($this->filter == 'adm' && strpos($this->current_event, 'acp_') !== 0)
|
||||
|| ($this->filter == 'styles' && strpos($this->current_event, 'acp_') === 0))
|
||||
{
|
||||
|
Reference in New Issue
Block a user