Skip to content

Commit c584cf5

Browse files
committed
Tested the Controller
1 parent 92ce90d commit c584cf5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

code_samples/back_office/limitation/src/Controller/CustomController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ public function customAction(Request $request): Response
3838

3939
private function getCustomLimitationValue(): bool
4040
{
41-
$customLimitationValues = $this->permissionChecker->getRestrictions($this->permissionResolver->hasAccess('custom_module', 'custom_function_2'), CustomLimitationValue::class);
41+
$hasAccess = $this->permissionResolver->hasAccess('custom_module', 'custom_function_2');
42+
43+
if (is_bool($hasAccess)) {
44+
return $hasAccess;
45+
}
46+
47+
$customLimitationValues = $this->permissionChecker->getRestrictions($hasAccess, CustomLimitationValue::class);
4248

4349
return $customLimitationValues['value'] ?? false;
4450
}

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ parameters:
240240
count: 1
241241
path: code_samples/back_office/images/src/PlaceholderProvider.php
242242

243-
-
244-
message: '#^Parameter \#1 \$hasAccess of method Ibexa\\Contracts\\AdminUi\\Permission\\PermissionCheckerInterface\:\:getRestrictions\(\) expects array\<mixed\>, array\<array\<string, array\<Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Policy\>\|Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Limitation\|null\>\>\|bool given\.$#'
245-
identifier: argument.type
246-
count: 1
247-
path: code_samples/back_office/limitation/src/Controller/CustomController.php
248-
249243
-
250244
message: '#^Method App\\Security\\MyPolicyProvider\:\:getFiles\(\) return type has no value type specified in iterable type array\.$#'
251245
identifier: missingType.iterableValue

0 commit comments

Comments
 (0)