In this specific example it apparently has no role. Too many abstract examples do not teach the use of something, except in rare cases. The example may be fictitious, but when you analyze whether the concept is being followed, it can simply put any nonsense. It’s not just putting any set of words. Context programming is very important. The detail is what defines what to do. Meaningful names are documentation and can explain what is taking place there. This code says nothing unless it is a test, it gives no context.
This is a case where the interface is not being useful because it was put in place to illustrate something meaningless. Interfaces are useful to abstract ideas, to establish contracts when necessary. This case is not necessary.
If it was a real case she’d have one or more method signatures which would serve as a contract, so the type of interface could be used somewhere and any class that implements the interface could be used in a given algorithm. Which is very weird in a language that preaches dynamic typing, worse, weak typing, but we already know, it’s PHP, it’s part of the unofficial philosophy to do weird things.
If you don’t have an advantage, a specific function, don’t use it. That goes for anything. Utility occurs in complex systems where contracts need to be respected.
Some interface questions available on the site that should help you understand:
The interface forces you to implement the methods in the class.
– Roberto de Campos
That’s all it’s good for, Roberto?
– Lucas de Carvalho
Related or duplicate: When to use Inheritance, Abstract Class, Interface or a Trait?
– Jéf Bueno
Related or duplicate: Abstract Class X Interface
– Jéf Bueno
Related or duplicate: In object orientation, why interfaces are useful?
– Jéf Bueno
Related: Programming for interface and not for implementation, why?
– Jéf Bueno
Related or duplicate: How and when to use Interface?
– Jéf Bueno
Possible duplicate of What is the difference between Classes and Interfaces?
– Daniel Omine