Skip to content

Commit aae85a0

Browse files
author
janvt
authored
Merge pull request #6 from geekcell/fix/loosen-user-interface-check
fix: remove UserInterface check for can/cannot methods
2 parents 07f7c07 + adda951 commit aae85a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Trait/HasPolicies.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ trait HasPolicies
3030
*/
3131
public function can(string $ability, mixed $subject, mixed ...$extraArgs): bool
3232
{
33-
$this->ensureUserInterface();
34-
3533
$methodArgs = [$this];
3634
if (is_object($subject)) {
3735
$methodArgs[] = $subject;
@@ -72,10 +70,12 @@ public function cannot(string $ability, mixed $subject = null, mixed ...$extraAr
7270
}
7371

7472
/**
75-
* Check if user has role
73+
* Check if user has role.
74+
* User must implement UserInterface.
7675
*
7776
* @param string $role
7877
* @return bool
78+
* @throws \BadMethodCallException
7979
*/
8080
public function is(string $role): bool
8181
{

0 commit comments

Comments
 (0)