| Total Complexity | 9 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Coverage | 78.26% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class TransientMetadata implements Property |
||
| 10 | { |
||
| 11 | /** @var ClassMetadata */ |
||
| 12 | protected $declaringClass; |
||
| 13 | |||
| 14 | /** @var \ReflectionProperty */ |
||
| 15 | protected $reflection; |
||
| 16 | |||
| 17 | /** @var string */ |
||
| 18 | protected $name; |
||
| 19 | |||
| 20 | 30 | public function __construct(string $name) |
|
| 21 | { |
||
| 22 | 30 | $this->name = $name; |
|
| 23 | 30 | } |
|
| 24 | |||
| 25 | /** |
||
| 26 | * {@inheritdoc} |
||
| 27 | */ |
||
| 28 | 45 | public function getDeclaringClass() : ComponentMetadata |
|
| 29 | { |
||
| 30 | 45 | return $this->declaringClass; |
|
| 31 | } |
||
| 32 | |||
| 33 | 30 | public function setDeclaringClass(ComponentMetadata $declaringClass) : void |
|
| 34 | { |
||
| 35 | 30 | $this->declaringClass = $declaringClass; |
|
|
|
|||
| 36 | 30 | } |
|
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | 30 | public function getName() : string |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | public function isPrimaryKey() : bool |
||
| 50 | { |
||
| 51 | return false; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritdoc} |
||
| 56 | */ |
||
| 57 | public function setValue($object, $value) : void |
||
| 58 | { |
||
| 59 | $this->reflection->setValue($object, $value); |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * {@inheritdoc} |
||
| 64 | */ |
||
| 65 | 429 | public function getValue($object) |
|
| 66 | { |
||
| 67 | 429 | return $this->reflection->getValue($object); |
|
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * {@inheritdoc} |
||
| 72 | */ |
||
| 73 | 880 | public function setReflectionProperty(\ReflectionProperty $reflectionProperty) : void |
|
| 76 | 880 | } |
|
| 77 | |||
| 78 | /** |
||
| 79 | * {@inheritdoc} |
||
| 80 | */ |
||
| 81 | 853 | public function wakeupReflection(ReflectionService $reflectionService) : void |
|
| 88 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.