While it's technically correct... Anons can't have an email "validated"....
The error should first probably say the user needs to be logged in, before showing that error.
public function userCanExecute( User $user ) { return $user->isEmailConfirmed(); } public function displayRestrictionError() { throw new \PermissionsError( null, [ 'mwoauthconsumerregistration-need-emailconfirmed' ] ); }