M
M
Michael2018-02-28 19:19:22
PHP
Michael, 2018-02-28 19:19:22

Should I always write implements?

When you need to inherit a class that implements some kind of interface, I don’t know if implements should be added to the heir.
Example:

interface ObserverInterface
{
    public function execute();
}

abstract class ParentClass implements ObserverInterface
{
}

class ChildClass extends ParentClass // implements ObserverInterface ?
{
    public function execute()
    {
    }
}

I know that this is not necessary for work, but how is it according to the standard?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maksim Fedorov, 2018-02-28
@springimport

It just doesn't make sense, because the child class already has all the protected and public methods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question