Skip to content

Commit 657004b

Browse files
authored
Merge pull request #1931 from brefphp/public-events-api
Mark the Bref events API as stable
2 parents 8b42e44 + c840217 commit 657004b

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

src/Bref.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ class Bref
1212
{
1313
private static ?Closure $containerProvider = null;
1414
private static ?ContainerInterface $container = null;
15-
/**
16-
* TODO deprecate hooks when the event dispatcher is stable.
17-
*/
15+
/** @deprecated Use Bref::events()->subscribe() instead */
1816
private static array $hooks = [
1917
'beforeStartup' => [],
2018
'beforeInvoke' => [],
@@ -31,9 +29,6 @@ public static function setContainer(Closure $containerProvider): void
3129
self::$containerProvider = $containerProvider;
3230
}
3331

34-
/**
35-
* @internal This API is experimental and may change at any time.
36-
*/
3732
public static function events(): EventDispatcher
3833
{
3934
if (! isset(self::$eventDispatcher)) {
@@ -48,6 +43,8 @@ public static function events(): EventDispatcher
4843
* Warning: hooks are low-level extension points to be used by framework
4944
* integrations. For user code, it is not recommended to use them. Use your
5045
* framework's extension points instead.
46+
*
47+
* @deprecated Use Bref::events()->subscribe() instead.
5148
*/
5249
public static function beforeStartup(Closure $hook): void
5350
{
@@ -60,6 +57,8 @@ public static function beforeStartup(Closure $hook): void
6057
* Warning: hooks are low-level extension points to be used by framework
6158
* integrations. For user code, it is not recommended to use them. Use your
6259
* framework's extension points instead.
60+
*
61+
* @deprecated Use Bref::events()->subscribe() instead.
6362
*/
6463
public static function beforeInvoke(Closure $hook): void
6564
{

src/Listener/BrefEventSubscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* Warning: Bref events are low-level extension points to be used by framework
1414
* integrations. For user code, it is not recommended to use them. Use your
1515
* framework's extension points instead.
16-
*
17-
* @internal This API is experimental and may change at any time.
1816
*/
1917
abstract class BrefEventSubscriber
2018
{

src/Listener/EventDispatcher.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
use Bref\Event\Handler;
88
use Psr\Http\Server\RequestHandlerInterface;
99

10-
/**
11-
* @internal This API is experimental and may change at any time.
12-
*/
1310
final class EventDispatcher extends BrefEventSubscriber
1411
{
1512
/**
1613
* @param BrefEventSubscriber[] $subscribers
14+
*
15+
* @internal This method is called by Bref and should not be called by user code.
1716
*/
1817
public function __construct(
1918
private array $subscribers = [],

0 commit comments

Comments
 (0)