Skip to content
Snippets Groups Projects
Commit 65bc6543 authored by totten's avatar totten
Browse files

HookStyleListener - Convey hook results. Refine type-hints.

Note: This is uncommon and discouraged for new hooks, but some hooks require returning values, e.g

```php
function hook_foo() {
  return ['my-data'];
}
```

This should fix compatibility with those.
parent 60a1dbc1
Branches
Tags
No related merge requests found
......@@ -30,10 +30,11 @@ class HookStyleListener {
}
public function __invoke(GenericHookEvent $e) {
return call_user_func_array($this->callback, $e->getHookValues());
$result = call_user_func_array($this->callback, $e->getHookValues());
$e->addReturnValues($result);
}
public function __toString() {
public function __toString(): string {
$name = EventPrinter::formatName($this->callback);
return preg_replace('/\(\$?e?\)$/', '(&...)', $name);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment