Skip to content

Commit

Permalink
return cloned object issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Dec 7, 2018
1 parent d34407e commit 8251e99
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ValueObjectBuilder.php
Expand Up @@ -50,8 +50,9 @@ public function __call(string $name, array $values)
sprintf('Invalid property name (%s) for the defined schema!', $propertyName)
);
}
$this->data->{$propertyName} = $values[0];
return $this;
$new = clone $this;
$new->data->{$propertyName} = $values[0];
return $new;
}

public function build() : ValueObjectInterface
Expand Down

0 comments on commit 8251e99

Please sign in to comment.