Skip to content

Commit ed339b1

Browse files
committed
refactor: Remove deprecated EVENT_PRIORITY_*
1 parent f67bc68 commit ed339b1

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

app/Config/Constants.php

Lines changed: 0 additions & 15 deletions
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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ final class EventsTest extends CIUnitTestCase
2929
{
3030
/**
3131
* Accessible event manager instance
32+
*
33+
* @var MockEvents
3234
*/
3335
private Events $manager;
3436

@@ -96,8 +98,8 @@ public function testListeners(): void
9698
$callback2 = static function (): void {
9799
};
98100

99-
Events::on('foo', $callback1, EVENT_PRIORITY_HIGH);
100-
Events::on('foo', $callback2, EVENT_PRIORITY_NORMAL);
101+
Events::on('foo', $callback1, Events::PRIORITY_HIGH);
102+
Events::on('foo', $callback2, Events::PRIORITY_NORMAL);
101103

102104
$this->assertSame([$callback1, $callback2], Events::listeners('foo'));
103105
}
@@ -142,14 +144,14 @@ public function testPriority(): void
142144
$result = 1;
143145

144146
return false;
145-
}, EVENT_PRIORITY_NORMAL);
147+
}, Events::PRIORITY_NORMAL);
146148
// Since this has a higher priority, it will
147149
// run first.
148150
Events::on('foo', static function () use (&$result): bool {
149151
$result = 2;
150152

151153
return false;
152-
}, EVENT_PRIORITY_HIGH);
154+
}, Events::PRIORITY_HIGH);
153155

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

utils/phpstan-baseline/method.notFound.neon

Lines changed: 1 addition & 6 deletions
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:
@@ -47,11 +47,6 @@ parameters:
4747
count: 3
4848
path: ../../tests/system/Debug/ExceptionHandlerTest.php
4949

50-
-
51-
message: '#^Call to an undefined method CodeIgniter\\Events\\Events\:\:unInitialize\(\)\.$#'
52-
count: 1
53-
path: ../../tests/system/Events/EventsTest.php
54-
5550
-
5651
message: '#^Call to an undefined method CodeIgniter\\HTTP\\Request\:\:getCookie\(\)\.$#'
5752
count: 2

0 commit comments

Comments
 (0)