I'm working with symfony, and I'm trying to apply SOLID principles and practicing Design Patterns for Code refactoring.
I have 2 questions :
- what design patterns should i always use when using Symfony or other php framework
- Why an interface extends another interface instead of implementing it ?
For example :
<?php
namespace Doctrine\Bundle\DoctrineBundle\EventSubscriber;
use Doctrine\Common\EventSubscriber;
interface EventSubscriberInterface extends EventSubscriber
{
}
namespace Doctrine\Common;
/**
* An EventSubscriber knows himself what events he is interested in.
* If an EventSubscriber is added to an EventManager, the manager invokes
* {@link getSubscribedEvents} and registers the subscriber as a listener for all
* returned events.
*/
interface EventSubscriber
{
/**
* Returns an array of events this subscriber wants to listen to.
*
* @return string[]
*/
public function getSubscribedEvents();
}
Why i can't just implement the interface or extends a class or abstract class instead of an interface ?
Aucun commentaire:
Enregistrer un commentaire