|
8 | 8 |
|
9 | 9 | namespace XWP\Contracts\Hook;
|
10 | 10 |
|
| 11 | +use ReflectionClass; |
| 12 | +use ReflectionMethod; |
| 13 | + |
11 | 14 | /**
|
12 | 15 | * Hook decorator functionality.
|
13 | 16 | *
|
14 |
| - * @template T |
15 |
| - * |
16 | 17 | * ! Global properties shared among hooks and handlers
|
17 | 18 | *
|
| 19 | + * @template THndlr of object |
| 20 | + * @template TRflct of ReflectionClass<THndlr>|ReflectionMethod |
| 21 | + * |
18 | 22 | * @property-read string $tag Hook name. Can use the `vsprinf` format in combination with `$modifiers`.
|
19 | 23 | * @property-read array|int|string|callable $priority Hook priority. Can be a number, callable, or a string. Strings are treated as filters, which will be applied to the default priority.
|
20 | 24 | * @property-read int $context Context bitmask determining where the hook can be invoked.
|
21 |
| - * @property-read string|false $requires Prerequisite hook that must be invoked before this hook. Handler classname, or Classname, method array. |
| 25 | + * @property-read string|array|false $requires Prerequisite hook that must be invoked before this hook. Handler classname, or Classname, method array. |
22 | 26 | * @property-read string|array|false $modifiers Replacement pairs for the tag name.
|
23 | 27 | * @property-read int $real_priority Actual priority of the hook.
|
24 | 28 | * @property-read array|callable|false $conditional Hook conditional. Callable which will be invoked to determine if the hook should be invoked.
|
| 29 | + * @property-read TRflct $reflector Reflector instance. |
25 | 30 | */
|
26 | 31 | interface Hookable {
|
27 | 32 | /**
|
@@ -83,16 +88,8 @@ interface Hookable {
|
83 | 88 | /**
|
84 | 89 | * Set the reflector
|
85 | 90 | *
|
86 |
| - * @param \Reflector $reflector Reflector instance. |
87 |
| - * @return static |
88 |
| - */ |
89 |
| - public function set_reflector( \Reflector $reflector ): static; |
90 |
| - |
91 |
| - /** |
92 |
| - * Set the hook target. |
93 |
| - * |
94 |
| - * @param array|T $target Hook target. |
| 91 | + * @param TRflct $reflector Reflector instance. |
95 | 92 | * @return static
|
96 | 93 | */
|
97 |
| - public function set_target( array|object $target ): static; |
| 94 | + public function set_reflector( ReflectionClass|ReflectionMethod $reflector ): static; |
98 | 95 | }
|
0 commit comments