Skip to content

Commit 4c16324

Browse files
authored
refactor: Remove deprecated EVENT_PRIORITY_* (#9401)
* refactor: Remove deprecated `EVENT_PRIORITY_*` * docs: Update changelog, userguide
1 parent 797d377 commit 4c16324

File tree

6 files changed

+10
-23
lines changed

6 files changed

+10
-23
lines changed

app/Config/Constants.php

-15
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,3 @@
7777
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
7878
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
7979
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
80-
81-
/**
82-
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
83-
*/
84-
define('EVENT_PRIORITY_LOW', 200);
85-
86-
/**
87-
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
88-
*/
89-
define('EVENT_PRIORITY_NORMAL', 100);
90-
91-
/**
92-
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
93-
*/
94-
define('EVENT_PRIORITY_HIGH', 10);

tests/system/Events/EventsTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public function testListeners(): void
9999
$callback2 = static function (): void {
100100
};
101101

102-
Events::on('foo', $callback1, EVENT_PRIORITY_HIGH);
103-
Events::on('foo', $callback2, EVENT_PRIORITY_NORMAL);
102+
Events::on('foo', $callback1, Events::PRIORITY_HIGH);
103+
Events::on('foo', $callback2, Events::PRIORITY_NORMAL);
104104

105105
$this->assertSame([$callback1, $callback2], Events::listeners('foo'));
106106
}
@@ -145,14 +145,14 @@ public function testPriority(): void
145145
$result = 1;
146146

147147
return false;
148-
}, EVENT_PRIORITY_NORMAL);
148+
}, Events::PRIORITY_NORMAL);
149149
// Since this has a higher priority, it will
150150
// run first.
151151
Events::on('foo', static function () use (&$result): bool {
152152
$result = 2;
153153

154154
return false;
155-
}, EVENT_PRIORITY_HIGH);
155+
}, Events::PRIORITY_HIGH);
156156

157157
$this->assertFalse(Events::trigger('foo', 'bar'));
158158
$this->assertSame(2, $result);

user_guide_src/source/changelogs/v4.6.0.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ Removed Deprecated Items
198198
- **Logger:** The deprecated ``CodeIgniter\Log\Logger::cleanFilenames()`` and
199199
``CodeIgniter\Test\TestLogger::cleanup()`` have been removed. Use the
200200
``clean_path()`` function instead.
201-
**Router:** The deprecated ``CodeIgniter\Router\Exceptions\RedirectException`` has been removed. Use ``CodeIgniter\HTTP\Exceptions\RedirectException`` instead.
201+
- **Router:** The deprecated ``CodeIgniter\Router\Exceptions\RedirectException`` has been removed. Use ``CodeIgniter\HTTP\Exceptions\RedirectException`` instead.
202+
- **Constants:** The deprecated constants ``EVENT_PRIORITY_*`` in has been removed. Use the class constants ``CodeIgniter\Events\Events::PRIORITY_LOW``, ``CodeIgniter\Events\Events::PRIORITY_NORMAL`` and ``CodeIgniter\Events\Events::PRIORITY_HIGH`` instead.
202203

203204
************
204205
Enhancements

user_guide_src/source/extending/events.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ but you might find they aid readability:
5151

5252
.. literalinclude:: events/004.php
5353

54-
.. important:: The constants ``EVENT_PRIORITY_LOW``, ``EVENT_PRIORITY_NORMAL`` and ``EVENT_PRIORITY_HIGH`` are deprecated, and the definitions are moved to ``app/Config/Constants.php``. These will be removed in future releases.
54+
.. important:: The constants ``EVENT_PRIORITY_LOW``, ``EVENT_PRIORITY_NORMAL`` and ``EVENT_PRIORITY_HIGH`` has been removed in v4.6.0.
5555

5656
Once sorted, all subscribers are executed in order. If any subscriber returns a boolean false value, then execution of
5757
the subscribers will stop.

user_guide_src/source/installation/upgrade_460.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,5 @@ All Changes
221221
This is a list of all files in the **project space** that received changes;
222222
many will be simple comments or formatting that have no effect on the runtime:
223223

224-
- app/Config/Feature.php
224+
- app/Config/Feature.php
225+
- app/Config/Constants.php

utils/phpstan-baseline/method.notFound.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 41 errors
1+
# total 40 errors
22

33
parameters:
44
ignoreErrors:

0 commit comments

Comments
 (0)