Type hinting methods called from builder method
Consider an Active Record implementation which uses a static builder to return instances of a model. Here is a very reduced version of the ModelBuilder and Model classes to demonstrate, with all code irrelevant to the question removed: class ModelBuilder { public function __construct($class) { $this->class = $class } private function _execute() { $result = $pdo->query("SELECT * FROM {$this->class}"); return $result->fetchAll(PDO::FETCH_CLASS, $this->class); } public function all() { return $this->_execute(); } public function one() { return $this->_execute()[0]; } } class Model { public static
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.