/** * Creates a new instance to which the given specs have been merged. In case of conflicts, the existing values are * kept. * * @param self $specs * * @return self */ public function mergeWith(self $specs) : self { $clone = clone $this; if (null === $clone->constructor) { $clone->constructor = $specs->constructor; } $clone->properties = $this->properties->mergeWith($specs->properties); $clone->calls = $this->calls->mergeWith($specs->calls); return $clone; }