Hook: Don't abort loading remaining hooks due to one broken hook
`Hook::all()` shouldn't abort loading the remaining hooks when one of the provided hook is broken.
This commit is contained in:
parent
dec24686bc
commit
ce012dcdb2
|
@ -266,23 +266,21 @@ class Hook
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function all($name)
|
public static function all($name): array
|
||||||
{
|
{
|
||||||
$name = self::normalizeHookName($name);
|
$name = self::normalizeHookName($name);
|
||||||
if (! self::has($name)) {
|
if (! self::has($name)) {
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (self::$hooks[$name] as $key => $hook) {
|
foreach (self::$hooks[$name] as $key => $hook) {
|
||||||
list($class, $alwaysRun) = $hook;
|
list($class, $alwaysRun) = $hook;
|
||||||
if ($alwaysRun || self::hasPermission($class)) {
|
if ($alwaysRun || self::hasPermission($class)) {
|
||||||
if (self::createInstance($name, $key) === null) {
|
self::createInstance($name, $key);
|
||||||
return array();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset(self::$instances[$name]) ? self::$instances[$name] : array();
|
return self::$instances[$name] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue