Skip to content

Instantly share code, notes, and snippets.

@mcsee
Created December 13, 2025 22:48
Show Gist options
  • Select an option

  • Save mcsee/65956b492933a751f412d955899f6365 to your computer and use it in GitHub Desktop.

Select an option

Save mcsee/65956b492933a751f412d955899f6365 to your computer and use it in GitHub Desktop.
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
<?php
final class UserRepository {
private Database $database;
public function __construct(Database $database) {
$this->database = $database;
}
public function find(UserId $id): User {
return $this->database->fetchUser($id);
}
}
// You removed credentials, SQL, and infrastructure noise.
// Now reviewers can discuss design and behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment