I am trying to write a Doctrine Extensions- based library that provides this interface:
namespace Gedmo\Mapping; use Doctrine\Common\Persistence\Mapping\ClassMetadata; interface Driver { public function readExtendedMetadata(ClassMetadata $meta, array &$config); public function setOriginalDriver($driver); }
In my own code, I implement this interface:
namespace Avit\Schedulable\Mapping\Driver; use Gedmo\Mapping\Driver, Doctrine\Common\Persistence\Mapping\ClassMetadata, Doctrine\Common\Annotations\AnnotationReader; class Annotation implements Driver { public function readExtendedMetadata(ClassMetadata $meta, array &$config) {
The error I get: Avit \ Schedulable \ Mapping \ Driver \ Annotation :: readExtendedMetadata () declaration must be compatible with the name Gedmo \ Mapping \ Driver :: readExtendedMetadata ()
I can avoid the error by removing the ClassMetadata method for my method.
I have information that this error occurs when the namespace is incompatible. This makes sense as I declare this class in my own namespace, however I am imposing the same Doctrine namespace for ClassMetadata that uses the original Driver interface.
Why is the type hint not recognized?
source share