Вурдалак, не получится. И дело не в доктрине, а в php.
PHP:
<?php
//test.php
trait Foo
{
/**
* @var int
*/
protected $id;
public function getId()
{
return $this->id;
}
}
class Bar
{
use Foo;
/**
* @ORM\Id
*/
protected $id;
}
$refl = new ReflectionClass('Bar');
echo $refl->getProperty('id')->getDocComment(), PHP_EOL;
Код:
$ php test.php
PHP Strict standards: Bar and Foo define the same property ($id) in the composition of Bar. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /Users/nkt/Desktop/test.php on line 23
PHP Stack trace:
PHP 1. {main}() /Users/nkt/Desktop/test.php:0
Strict standards: Bar and Foo define the same property ($id) in the composition of Bar. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /Users/nkt/Desktop/test.php on line 23
Call Stack:
0.0002 233056 1. {main}() /Users/nkt/Desktop/test.php:0
/**
* @ORM\Id
*/
Правда судя по всему это похоже на баг. В доке описано, что не меняя сигнатуру, можно заново определять свойство.
http://php.net/manual/ru/language.oop5.traits.php - 12 пример, прям перед комментами
ЗЫ а не, не баг. Написано же Stricts Standarts. Все равно, не приятное поведение
