fixed userBlockService controller type check to use "instanceof" to allow overridden controllers

This commit is contained in:
tonis ormisson
2022-10-05 13:35:35 +03:00
parent 1b1f7b0ece
commit 1c16ece741

View File

@ -32,8 +32,8 @@ class UserBlockService implements ServiceInterface
$controller, $controller,
SecurityHelper $securityHelper SecurityHelper $securityHelper
) { ) {
if (!in_array(get_class($controller), [AdminController::class, AdminControllerRest::class])) { if (!($controller instanceof AdminController || $controller instanceof AdminControllerRest)) {
throw new TypeError('Argument controller must be either of type ' throw new TypeError('Argument controller must be either of type '
. AdminController::class . ' or ' . AdminControllerRest::class . ', ' . get_class($controller) . ' given'); . AdminController::class . ' or ' . AdminControllerRest::class . ', ' . get_class($controller) . ' given');
} }
$this->model = $model; $this->model = $model;