PHP는 동일한 형질을 두 번 컴파일하려고 시도하는 것 같습니다.다른 특성 및 클래스에서 동일한 형질을 참조하십시오.
use Behat\MinkExtension\Context\MinkDictionary;
class FeatureContext
{
use MinkDictionary, OrderDictionary;
}
use Behat\MinkExtension\Context\MinkDictionary;
trait OrderDictionary
{
//if you comment out this line, everything works, but methodFromMinkTrait is
//unresolved
use MinkDictionary;
public function myMethod($element, $text)
{
//some method that uses methods from MinkDictionary
return $this->methodFromMinkTrait();
}
}
컴파일은 치명적인 오류와 함께 실패
Fatal error: Trait method setMink has not been applied, because there are collisions with other trait methods on LunchTime\DeliveryBundle\Features\Context\FeatureContext
setMink
method is only defined inMinkDictionary
trait.
문제는 OrderDictionary
와 FeatureContext
모두 MinkDictionary
에서 방법을 사용하여 점이다. 그것이 OrderDictionary
에 use MinkDictionary
을 추가 한 이유입니다. 허용되지 않습니까? 만약 당신이 그것을 언급한다면, 모든 것이 작동하지만, 편집자는 많은 미해결의 방법을 보여주고 있습니다 - 그들이 어디에서 왔는지 알지 못합니다.
에서 "MinkDictionary을 사용하여"문을 제거 : http://www.xpertdeveloper.com/2011/11/trait-in-php/ – jrfish