mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-11 08:13:58 +02:00
Use PHP constructor property promotion
This commit is contained in:
@@ -70,11 +70,8 @@ include 'views/foo-list.php';
|
||||
<?php
|
||||
class FooModel
|
||||
{
|
||||
protected $db;
|
||||
|
||||
public function __construct(PDO $db)
|
||||
public function __construct(protected PDO $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function getAllFoos() {
|
||||
|
Reference in New Issue
Block a user