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
|
||||
*/
|
||||
public static function all($name)
|
||||
public static function all($name): array
|
||||
{
|
||||
$name = self::normalizeHookName($name);
|
||||
if (! self::has($name)) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
foreach (self::$hooks[$name] as $key => $hook) {
|
||||
list($class, $alwaysRun) = $hook;
|
||||
if ($alwaysRun || self::hasPermission($class)) {
|
||||
if (self::createInstance($name, $key) === null) {
|
||||
return array();
|
||||
}
|
||||
self::createInstance($name, $key);
|
||||
}
|
||||
}
|
||||
|
||||
return isset(self::$instances[$name]) ? self::$instances[$name] : array();
|
||||
return self::$instances[$name] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue