The __construct constructor runs when an object is created and initializes its state. Since PHP 8, property promotion declares and assigns properties directly in the constructor signature by adding visibility to the parameters, which avoids repetitive code.
Example
class Produit {
public function __construct(
public string $nom,
public float $prix,
) {}
}