Typed proprety [my obet] must not be accessed before initialization [closed]

When I try to run the following code test :

<?php

require_once('../model/SqliteConnection.php');
require_once('../model/UserDAO.php');
require_once('../model/Utilisateur.php');

function testConnection(): void {
    try {
        $dbc = SqliteConnection::getInstance()->getConnection();
        if ($dbc instanceof PDO) {
            echo "Connexion réussie à la base de données.n";
        } else {
            echo "Echec de la connexion à la base de données.n";
        }
    } catch (Exception $e) {
        echo "Erreur lors de la connexion : " . $e->getMessage();
    }
}


function testUtilisateursDAOFindAll(UserDAO $dao): void {
    try {
        $results = $dao->findAll();
        if (is_array($results)) {
            echo "findAll a retourné un tableau contenant " . count($results) . " utilisateurs.n";
            foreach ($results as $utilisateur) {
                echo $utilisateur->__toString(). "n";
            }
        } else {
            echo "findAll n'a pas retourné un tableau.n";
        }
    } catch (Exception $e) {
        echo "Erreur lors de l'exécution de findAll : " . $e->getMessage() . "n";
    }
}


$dao = UserDAO::getInstance();

testUtilisateursDAOFindAll($dao);

?>

I got the follow error :

PHP Fatal error:  Uncaught Error: Typed property Utilisateur::$password must not be accessed before initialization in /home/pierre-louis/Documents/Semestre 3/R3.01/sport_track_web_app_php/model/Utilisateur.php:93
Stack trace:
#0 /home/pierre-louis/Documents/Semestre 3/R3.01/sport_track_web_app_php/tests/sqlite_connection_test.php(31): Utilisateur->__toString()
#1 /home/pierre-louis/Documents/Semestre 3/R3.01/sport_track_web_app_php/tests/sqlite_connection_test.php(297): testUtilisateursDAOFindAll()
#2 {main}
  thrown in /home/pierre-louis/Documents/Semestre 3/R3.01/sport_track_web_app_php/model/Utilisateur.php on line 93

To help you, here is the 2 other code used in this method :

<?php
#[AllowDynamicProperties]
class Utilisateur{
    private String $nom;
    private String $prenom;
    private String $email;
    private String $dateNaissance;
    private float $poids;
    private float $taille;
    private String $sexe;
    private String $password;


    public function  __construct() {
    }
    public function init(String $e, String $n, String $p, String $d, String $s, float $t, float $po, String $m): void{
        $this->nom = $n;
        $this->prenom = $p;
        $this->email = $e;
        $this->password = $m;
        $this->taille = $t;
        $this->poids = $po;
        $this->sexe = $s;
        $this->dateNaissance = $d;
    }

    public function getNom(): String {
        return $this->nom;
    }
    public function getPrenom(): String {
        return $this->prenom; 
    }

    public function getEmail(): String {
        return $this->email; 
    }

    public function getTaille(): float {
        return $this->taille; 
    }

    public function getPoids(): float {
        return $this->poids; 
    }

    public function getDateNaissance(): String {
        return $this->dateNaissance; 
    }

    public function getSexe(): string {
        return $this->sexe; 
    }

    public function getMdp(): String {
        return $this->password; 
    }

    public function setPrenom(String $prenom): void {
        $this->prenom = $prenom;
    }

    public function setEmail(String $mail): void {
        $this->email = $mail;
    }

    public function setNom(String $nom): void {
        $this->nom = $nom;
    }

    public function setPoids(float $poids): void {
        $this->poids = $poids;
    }

    public function setTaille(float $taille): void {
        $this->taille = $taille;
    }

    public function setSexe(String $sexe): void {
        $this->sexe = $sexe;
    }

    public function setMdp(String $mdp): void {
        $this->mdp = $mdp;
    }

    public function setDate(String $date): void {
        $this->dateNaissance = $date;
    }

    public function  __toString(): string {
        return $this->nom. " ". $this->prenom. " ". $this->email. " ". $this->poids. " ". $this->taille. " ". $this->sexe. " ". $this->dateNaissance. " ". $this->password;
    }
}
?>
<?php
require_once('SqliteConnection.php');
class UserDAO {
    private static UserDAO $dao;

    private function __construct() {}

    public static function getInstance(): UserDAO {
        if(!isset(self::$dao)) {
            self::$dao= new UserDAO();
        }
        return self::$dao;
    }

    public final function findAll(): Array{
        $dbc = SqliteConnection::getInstance()->getConnection();
        $stmt = $dbc->query("select * from utilisateurs");
        $results = $stmt->fetchAll(PDO::FETCH_CLASS, 'Utilisateur');
        
        return $results;
    }

    public final function insert(Utilisateur $u): bool {
        if($u instanceof Utilisateur){
            $dbc = SqliteConnection::getInstance()->getConnection();
            // prepare the SQL statement
            $query = "insert into utilisateurs (email, nom, prenom, dateNaissance, sexe, poids, taille, motDePasse) values (:e,:n,:p,:d,:s,:po,:t,:m)";
            $stmt = $dbc->prepare($query);

            // bind the paramaters
            $stmt->bindValue(':e',$u->getEmail(),PDO::PARAM_STR);
            $stmt->bindValue(':n',$u->getNom(),PDO::PARAM_STR);
            $stmt->bindValue(':p',$u->getPrenom(),PDO::PARAM_STR);
            $stmt->bindValue(':d',$u->getDateNaissance(),PDO::PARAM_STR);
            $stmt->bindValue(':s',$u->getSexe(),PDO::PARAM_STR);
            $stmt->bindValue(':po',$u->getPoids(),PDO::PARAM_STR);
            $stmt->bindValue(':t',$u->getTaille(),PDO::PARAM_STR);
            $stmt->bindValue(':m',$u->getMdp(),PDO::PARAM_STR);

            // execute the prepared statement and return it
            return $stmt->execute();
        }
    }

    public final function delete(Utilisateur $obj): bool {
        $dbc = SqliteConnection::getInstance()->getConnection();
        $idUser = $obj->getEmail();
        $query = "delete from utilisateurs where email = :email";
        $stmt = $dbc->prepare(query: $query);
        $stmt->bindValue(':email', $obj->getEmail(), PDO::PARAM_STR);
        
        return $stmt->execute();
    }

    public function update(Utilisateur $obj): bool {
        $dbc = SqliteConnection::getInstance()->getConnection();
        $idUser = $obj->getEmail();
        $query = "update utilisateurs set nom = :n, prenom = :p, poids = :po, taille = :t, sexe = :s, dateNaissance = :d, motDePasse = :mdp WHERE email = :e";
        $stmt = $dbc->prepare(query: $query);
        $stmt->bindValue(':e', $obj->getEmail(), PDO::PARAM_STR);
        $stmt->bindValue(':n', $obj->getNom(), PDO::PARAM_STR);
        $stmt->bindValue(':p', $obj->getPrenom(), PDO::PARAM_STR);
        $stmt->bindValue(':po', $obj->getPoids(), PDO::PARAM_STR);
        $stmt->bindValue(':t', $obj->getTaille(), PDO::PARAM_STR);
        $stmt->bindValue(':s', $obj->getSexe(), PDO::PARAM_STR);
        $stmt->bindValue(':d', $obj->getDateNaissance(), PDO::PARAM_STR);
        $stmt->bindValue(':mdp', $obj->getMdp(), PDO::PARAM_STR);
        
        return $stmt->execute();
    }
}
?>

For your information, my connection to my database is OK and all the other CRUD operations are working

I’ve tried to change variables, I’ve read my code several times and i searched on internet but I’ve find nothing.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật