Commit Graph

26 Commits

Author SHA1 Message Date
edae9f26e4 Reduce number of classes 2024-11-13 22:23:43 +00:00
667656b1c6 Split AsyncHandlerListManager
this allows further code deduplication at the expense of needing 2 calls to unregister all handlers
2024-11-13 22:08:28 +00:00
8aed5d6b27 Handler inheritance is now working
this code should also perform somewhat better
2024-11-13 20:35:14 +00:00
17ae932d31 HandlerListManager: added getter 2024-11-13 15:36:51 +00:00
8f48fe4856 Fully separate hierarchies for sync & async events
there's no way to combine these without causing type compatibility issues for one side or the other.
we might be able to use traits to reduce duplication, but the separation here seems to be necessary.
2024-11-13 15:35:41 +00:00
c1e3903934 fix PHPstan 2024-01-21 12:04:23 +01:00
d6b7a9ed45 merge remote tracking upstream 2024-01-21 11:28:24 +01:00
f82c422f64 remove using of Event API 2024-01-21 11:25:34 +01:00
80125f9b19 Modernize single-use phpstan-template tags 2023-12-20 15:20:28 +00:00
2608637210 HandlerListManager: track RegisteredListenerCache directly
This change improves the performance of calling an event with 0 handlers by about 10% with no other changes.

Since we have to access the list eventually anyway, we can cut out some unnecessary work by returning the handlers from the cache directly, instead of fetching the HandlerList for no reason.

This also improves the performance of Event::hasHandlers() by about 40%, which is pretty significant (120 ns -> 80 ns).
2023-08-01 17:37:49 +01:00
3b6ff3c42b Apply union types in some places (BC breaks) 2022-11-23 14:03:35 +00:00
dce8bd6d21 CS: Standardize new with braces 2022-08-15 17:16:23 +01:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
eb95e2a97e Modernize private property declarations in src/event 2022-05-17 20:45:50 +01:00
aa6bd4438a Replace disallowed operators in src/event/ 2022-01-20 19:17:17 +00:00
2ad5de379f HandlerListManager::unregisterAll() accepts RegisteredListener
since all this function is doing is passing the object on to the HandlerList, it should accept RegisteredListener, like HandlerList::unregister().
2021-08-10 15:28:11 +01:00
041d314190 HandlerListManager: apply class-string type for getListFor() parameter 2021-08-05 20:11:58 +01:00
fb4b92d1f4 HandlerListManager: fixed missing null type flag 2020-09-06 16:12:54 +01:00
b3df5f4e95 CS: strip unneeded phpdoc 2020-06-18 20:01:49 +01:00
cc549630e5 HandlerListManager: fixed @param doc comment not referring to correct ReflectionClass
phpstan doesn't notice this because of the phpstan-param doc directly underneath.
2020-05-30 22:29:30 +01:00
85f3dca11b HandlerListManager: make resolveNearestHandleableParent() a little easier to follow
and also sidestep phpstan complaining about using loop vars outside of loop
2020-02-07 22:07:36 +00:00
a3bffd375b master-specific addendum to cd55cdf5c6 2020-01-22 15:07:47 +00:00
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
0e1cea043a added some phpstan-specific generic type annotations 2020-01-13 15:05:02 +00:00
e5b02ee5e0 make logic for fetching handler lists more consistent 2019-08-23 17:16:07 +01:00
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00