Closed
Closed
Copy link
Description
Currently, nothing prevent users to use scalar for the $object
parameter in VoterInterface::vote(TokenInterface $token, $object, array $attributes)
.
We already depreciated VoterInterface::supportsAttribute
and VoterInterface::supportsClass
.
So I propose this new interface:
interface VoterInterface
{
const ACCESS_GRANTED = 1;
const ACCESS_ABSTAIN = 0;
const ACCESS_DENIED = -1;
/**
* Returns the vote for the given parameters.
*
* This method must return one of the following constants:
* ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
*
* @param TokenInterface $token A TokenInterface instance
* @param mixed $subject The subject to secure
* @param array $attributes An array of attributes associated with the method being invoked
*
* @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED
*/
public function vote(TokenInterface $token, $subject, array $attributes);
}