Update AbstractAnnotation.php

Fixed value is not array, but not null.
This commit is contained in:
李铭昕 2019-06-24 16:07:27 +08:00
parent c62a0a006b
commit 2b4e52fafb

View File

@ -20,9 +20,11 @@ abstract class AbstractAnnotation implements AnnotationInterface, Arrayable
{
public function __construct($value = null)
{
foreach ($value ?? [] as $key => $val) {
if (property_exists($this, $key)) {
$this->{$key} = $val;
if (is_array($value)) {
foreach ($value as $key => $val) {
if (property_exists($this, $key)) {
$this->{$key} = $val;
}
}
}
}