DEV Community

Cover image for DTO vs VO in PHP

DTO vs VO in PHP

Maico Orazio on February 10, 2024

Data Transfer Objects (DTOs) and Value Objects (VOs) are particularly useful when working with dynamically typed languages like PHP, where switchin...
Collapse
 
chrisgalliano profile image
Christian Galliano

omg dude why are you checking things like this

match (true) {
      ($this->amount <= 0) => throw new InvalidPriceAmountException('amount is negative'),
      default => true
};
Enter fullscreen mode Exit fullscreen mode

this is crazy 😭 just use if

Collapse
 
insign profile image
Hélio oliveira

VO example?