What is the purpose of an empty interface?

Asked

Viewed 38 times

2

I was looking at exceptions to the rule validation engine Respect Validation, and discovered something that caught my attention.

This is the interface ExceptionInterface, that apparently, there is no code in it, that is, there is no member to be implemented in the classes that implement this interface.

See the interface:

<?php   

namespace Respect\Validation\Exceptions;

interface ExceptionInterface
{
}

And the class ValidationException implements this interface. And most exceptions of this engine extend from class ValidationException, such as the class CpfException which is Exception for invalid Cpfs.

Doubts

  1. I would like to know what is the purpose of an interface "empty"?
  2. A "blank" interface is unique to PHP or other languages have "empty" interfaces as well?
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.