Skip to content

Commit

Permalink
Set default value of user to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
cpt-erwin committed Dec 7, 2020
1 parent 21c2fe3 commit a67a68b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions core/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class App
public Database $db;
public static App $app;
public Controller $controller;
public ?UserModel $user;
public ?UserModel $user = null;

public function __construct(string $rootPath, array $config)
{
Expand All @@ -40,10 +40,7 @@ public function __construct(string $rootPath, array $config)
if ($primaryValue) {
$primaryKey = $this->userClass::primaryKey();
$this->user = $this->userClass::findOne([$primaryKey => $primaryValue]);
} else {
$this->user = null;
}

}

public function run() {
Expand Down

0 comments on commit a67a68b

Please sign in to comment.