From 7ed381cd344841e8275c87b7b22e82ea6c8c2dd3 Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Thu, 8 Dec 2022 09:21:29 +0100 Subject: [PATCH] Fix access error in Maintainer Since PHP 8.x I get the error `"$field must not be accessed before initialization"` when iterating the maintainers and accessing their properties. Not all 3 fields are always set. --- src/Packagist/Api/Result/Package/Maintainer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Packagist/Api/Result/Package/Maintainer.php b/src/Packagist/Api/Result/Package/Maintainer.php index 5160c90..d9cbdd5 100644 --- a/src/Packagist/Api/Result/Package/Maintainer.php +++ b/src/Packagist/Api/Result/Package/Maintainer.php @@ -8,11 +8,11 @@ class Maintainer extends AbstractResult { - protected string $name; + protected string $name = ''; - protected string $email; + protected string $email = ''; - protected string $homepage; + protected string $homepage = ''; public function getName(): string {