Cytat
Catchable fatal error: Argument 1 passed to Theme::__construct() must be an instance of Config, none given, called in /var/www/index.php on line 8 and defined in /var/www/theme.php on line 7
index.php
include_once 'config.php'; include_once 'theme.php'; $test = new Theme;
theme.php
class Theme { private $db; public function __construct(Config $db) { $this->db = $db; } public function show() { return $this->db; } }
config.php
class Config { public $host; private $user; private $pswd; private $baza; public function __construct() { $this->host = 'host'; $this->user = 'user'; $this->pswd = 'password'; $this->baza = 'baza'; } }
Jak to naprawić?