public function removeAttachment(PermissionAttachment $attachment)
{
if ($attachment === null) {
throw new \InvalidStateException("Attachment cannot be null");
}
if (isset($this->attachments[spl_object_hash($attachment)])) {
unset($this->attachments[spl_object_hash($attachment)]);
if (($ex = $attachment->getRemovalCallback()) !== null) {
$ex->attachmentRemoved($attachment);
}
$this->recalculatePermissions();
}
}