Hot tip 🔥

If you're passing a lot of arguments to a constructor or method, try to see if you can group them and create a new class/object with the arguments as properties. It'll better describe the domain and provide additional documentation🙂

P.S. these are called DTOs (Data Transfer Objects) or Value Objects

Sign in to participate in the conversation
PHP Community on Mastodon

Open source. Open community. We are dedicated to building and enriching the PHP community.