From 4da8de004199a641676e5603a022e92d8e34aa2b Mon Sep 17 00:00:00 2001 From: Shaun Date: Fri, 9 Nov 2018 22:26:01 -0500 Subject: [PATCH 1/2] Reduce potential confusion in priority explanation I always get tripped up by event priority. In my mind, I think priority 1 executes before priority 2. I'm backwards, I know... This PR should help remove any confusion for myself and others by explicitly stating "priority 3 executes before priority 2" and so on. --- components/event_dispatcher.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index f3edc1a5cec..f9c2411b0ad 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -147,11 +147,12 @@ The ``addListener()`` method takes up to three arguments: #. The event name (string) that this listener wants to listen to; #. A PHP callable that will be executed when the specified event is dispatched; -#. An optional priority integer (higher equals more important and therefore - that the listener will be triggered earlier) that determines when a listener - is triggered versus other listeners (defaults to ``0``). If two listeners - have the same priority, they are executed in the order that they were - added to the dispatcher. +#. An optional priority integer that determines when a listener is triggered + versus other listeners (defaults to ``0``). A higher priority integer means + the listener will be triggered earlier. So, priority 3 executes before + priority 2. Priority 2 executes before priority 1. Priority 1 executes before + priority 0, and so on. If two listeners have the same priority, they are + executed in the order that they were added to the dispatcher. .. note:: From afc8c31a312d57ad8904ca851936fc730b691b75 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 12 Nov 2018 08:40:06 +0100 Subject: [PATCH 2/2] Reworded --- components/event_dispatcher.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index f9c2411b0ad..0ea0f54af91 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -147,12 +147,10 @@ The ``addListener()`` method takes up to three arguments: #. The event name (string) that this listener wants to listen to; #. A PHP callable that will be executed when the specified event is dispatched; -#. An optional priority integer that determines when a listener is triggered - versus other listeners (defaults to ``0``). A higher priority integer means - the listener will be triggered earlier. So, priority 3 executes before - priority 2. Priority 2 executes before priority 1. Priority 1 executes before - priority 0, and so on. If two listeners have the same priority, they are - executed in the order that they were added to the dispatcher. +#. An optional priority, defined as a positive or negative integer (defaults to + ``0``). The higher the priority, the earlier the listener is called. If two + listeners have the same priority, they are executed in the order that they + were added to the dispatcher. .. note::