0
votes

I'm pretty new to Symfony framework, when I was trying to create a form based on its cookbook instructions, I faced a weird error. As I traced SF's debug tool, I found that there's a class which implements two interfaces both have same method. based on this question, I think this is a conflict. Am I right?

error:

Compile Error: Can't inherit abstract function Symfony\Component\Validator\ValidatorInterface::validate() (previously declared abstract in Symfony\Component\Validator\Validator\ValidatorInterface)

first interface:

vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\ValidatorInterface.php

vendor\symfony\symfony\src\Symfony\Component\Validator\ValidatorInterface.php

class implementing them:

vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveValidator.php

1
If you would've read any comment or further answer on that references question you would know that it is indeed possible since PHP-5.3.9.Markus Malkusch

1 Answers

0
votes

Regardless of that outdated referenced answer implementing two interfaces with the identical signature is valid since PHP-5.3.9:

Prior to PHP 5.3.9, a class could not implement two interfaces that specified a method with the same name, since it would cause ambiguity. More recent versions of PHP allow this as long as the duplicate methods have the same signature.

Don't even think about implementing anything against a dead PHP version.